Help with Subproduct Layout

General ShopSite user discussion

Help with Subproduct Layout

Postby tom0360 » Thu Apr 29, 2010 5:59 am

What I would like to do is assign text products PRODUCT.Field7 area such as item1, item2, item3

Then assign those products to another product as subproducts.

Then on the product template separate those subproducts based on text in PRODUCT.Field7

Something like:

[-- LOOP SUBPRODUCTS --]

Item1
[-- If SUBPRODUCT.Field7 item1 --] [-- SUBPRODUCTS --]
[-- ELSE --]

item2
[-- If SUBPRODUCT.Field7 item2 --] [-- SUBPRODUCTS --]

Item3
[-- If SUBPRODUCT.Field7 item3 --] [-- SUBPRODUCTS --]
[-- End_If --]

[-- END_LOOP SUBPRODUCTS --]

I am having much better luck adding the statement to the subproduct area in the template like:

[-- DEFINE SUBPRODUCT --] [-- If PRODUCT.Field7 item1 --] Quantity: [-- Product.Name --] - Add [-- PRODUCT.SaleAmount --]

[-- ELSE --] [-- If PRODUCT.Field7 item2 --] Quantity: [-- Product.Name --] - Add [-- PRODUCT.SaleAmount --]

[-- End_If --] [-- End_If --] [-- END_DEFINE SUBPRODUCT --]

Still it is not separating the subproducts by the field7 though.

Is this possible and if so can you explain how to do this?

Thank you for any help

Tom


Figured it out
Thanks
tom0360
 
Posts: 34
Joined: Tue Aug 22, 2006 10:55 am

Postby Jim » Thu Apr 29, 2010 9:08 am

In your product template you need to do multiple [-- LOOP SUBPRODUCTS --]
sections that will output the subproduct in the way you want it to display.

First you need to set a VAR to determine what format the subproduct is going to use. Then have a section of your define for the subproduct do a check of the VAR and execute specific code based on the the VAR.

There have been several discussion of doing multiple loops of products or links in the forum that might give you an idea of how this is done if you do a search. Then just apply the same logic only for the sub products.

here is some pseudo code to do what I mention.

set VAR for item1
[-- VAR.ITEM "item1" --]
now do loop subproducts
[-- LOOP SUBPRODUCTS --]
[-- SUBPRODUCTS --]
[-- END_LOOP SUBPRODUCTS --]

set VAR for next set of subproducts
[--VAR.ITEM "item2" --]
now do loop subproducts
[-- LOOP SUBPRODUCTS --]
[-- SUBPRODUCTS --]
[-- END_LOOP SUBPRODUCTS --]

set VAR for next set of subproducts
[--VAR.ITEM "item3" --]
now do loop subproducts
[-- LOOP SUBPRODUCTS --]
[-- SUBPRODUCTS --]
[-- END_LOOP SUBPRODUCTS --]


In the Define Subproduct section you need to look at the VAR and do the appropriate action depending on what the value of VAR.ITEM is

[-- IF VAR.ITEM "item1' --]
do what you do if the text is item1

[-- ELSE_IF VAR.ITEM "item2 --]
do what you need if the text is item2


[-- ELSE_IF VAR.ITEM "item3" --]
do what you need to do if the text is item3

[-- END_IF --]
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby tom0360 » Thu Apr 29, 2010 4:02 pm

Thanks Jim, I did get it figured out.

Tom
tom0360
 
Posts: 34
Joined: Tue Aug 22, 2006 10:55 am


Return to User Forum

Who is online

Users browsing this forum: No registered users and 150 guests