luigi7up wrote:
> @anja
> This solution works fine but I thought I could do it more elegant :)
> thanks
>
> @grigri
> I'll try this... I don't get it at first glance but I'll try it. It
> seems like something worth of try...
> I'll tell you how it went
>
> P.S. Username "griGri" has something to do with climbing device or
> not?
>
>
> On Nov 19, 12:24 pm, grigri <[EMAIL PROTECTED]> wrote:
>   
>> Hi Luka
>>
>> This sounds like a job for Set::combine() :
>>
>> <?php
>> $options = Set::combine(
>>         $product['ProductVariant'],
>>         '{n}.id',
>>         array(
>>                 '{0} | {1} - {2}',
>>                 '{n}.sex', '{n}.size', '{n}.price'
>>         )
>> );
>>
>> echo $form->select('variant', $options);
>> ?>
>>
>> hth
>> grigri
>>
>> On Nov 19, 10:42 am, luigi7up <[EMAIL PROTECTED]> wrote:
>>
>>     
>>> Hello I need help with populating drop down select element.
>>>       
>>> I have following data in array $product that is available in my view
>>>       
>>> Array
>>> (
>>>     [Product] => Array
>>>         (
>>>             [id] => 1
>>>             [product_category_id] => 1
>>>             [user_id] => 26
>>>             [title] => Nije Vuk Ovca
>>>             [folder] => nije_vuk_ovca
>>>             [price] => 85
>>>             [special] => 0
>>>             [published] => 1
>>>             [created] =>
>>>             [modified] => 2008-11-07 11:56:06
>>>         )
>>>       
>>>     [ProductVariant] => Array
>>>         (
>>>             [0] => Array
>>>                 (
>>>                     [id] => 1
>>>                     [product_id] => 1
>>>                     [sex] => male
>>>                     [size] => S
>>>                     [extras] =>
>>>                     [price] =>
>>>                 )
>>>       
>>>             [1] => Array
>>>                 (
>>>                     [id] => 2
>>>                     [product_id] => 1
>>>                     [sex] => male
>>>                     [size] => M
>>>                     [extras] =>
>>>                     [price] =>
>>>                 )
>>>       
>>>             [2] => Array
>>>                 (
>>>                     [id] => 3
>>>                     [product_id] => 1
>>>                     [sex] => male
>>>                     [size] => L
>>>                     [extras] =>
>>>                     [price] =>
>>>                 )
>>>       
>>> )
>>>       
>>> ****
>>> As you can see Product has it's variants because PRODUCT model hasMany
>>> PRODUCT_VARIANTS.
>>> In my product view I want drop down menu (SELECT) with all variants of
>>> product to be populated in following way:
>>>       
>>
Isn't  $this->Product->ProductVariant->find('list') what you're loooking 
for?

I'm using something similar at http://anunciostotal.net/ads/add to 
populate the subcategories and provinces select boxes.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to