Page 1 of 1

Products module and multiple field value

Posted: Fri May 18, 2012 10:31 am
by kube
Hi cmsms's people,

Here is a little problem i've been loosing hair with lately:

- In a product summary, i need to generate a list of related products to a specific product.
- So i have added a "related" product field. This field is a textfield.
- At this point i ca use this: fieldid="3" fieldval=$entry->id where 3 is designating the "ralted" field.

- Now, a product can be related to several others. So i was planning to use coma separated values in that field.
- That of course doesn't work...(well i didn't manage to get it working to be more precise) :'(

I am under the impression that this feature could be easily added to the Product module (by exploding the list in php and then generating the correct sql query. maybe add a specific attribute to the module ex: fieldvalues). Calguy ?

OR

maybe one of you Geniuses have a solution my blind mind cannot see ?
Please help my hair grow back again O0

Re: Products module and multiple field value

Posted: Wed May 23, 2012 6:29 pm
by maranc
Create your field caled "related". Enter id of related products using commas, example: "1,3,4" (when 1 or 3 or 4 are related products to the viewed product. Then inside detail template use following code:

{Products productlist=$entry->fields.related->value}

Best regards,
Marek A.

Re: Products module and multiple field value

Posted: Wed May 23, 2012 8:32 pm
by kube
Thx Marek,

However that works the opposite way of what i need:
- I have a list of specific services (products), say A
- I also have products (chemicals). I'll call those B
- The goal is when i display a A detail, i show a list of B products that are used in it. So the {product} call lies in the A view.
- There ar more B's than A's. So it will be easier to encode the services (A) that use the products in the products (B).

The way you do is quite the opposite as you propose to encode in A all B's that are used...

Yeah i know, it's wicked (so am i) :P