Testing for Subproducts (IF...ELSE)

General ShopSite user discussion

Testing for Subproducts (IF...ELSE)

Postby Gavin Guest » Tue May 17, 2005 8:14 am

Hello,

I am using ShopSite Pro 7.1.4, and I am having a problem when trying to
determine if a product has subproducts in my custom template. I have been
successfully using IF ELSE statements to test for all sorts of other items
for quite some time, but now that we're adding subproducts for a client,
this issue has gotten the better of me. I have scoured all documentation I
can find regarding IF tests, subproducts and custom templates to no avail.

Currently, when subproducts exist, the following shopsite code works like a
dream:
--- Begin ---
[-- IF PRODUCT.SUBPRODUCTS --]
<div class="right">
<h4>Related Products</h4>
[-- LOOP SUBPRODUCTS --]
[-- SUBPRODUCTS --]
[-- END_LOOP SUBPRODUCTS --]
</div>
[-- ELSE --]
[-- END_IF --]

[-- IF PRODUCT.Field2 --]
<div class="item_attribute">Dimensions as Shown:<p
class="attribute_value">[-- PRODUCT.Field2 --]</p></div>
[--Else--]
[--End_If--]

--- End ---

Again, the above works fine when subproducts exist. When the do not exist
the div class right and the h4 are in the source and displaying on my page.

Using [-- IF SUBPRODUCTS --] simply doesn't work at all.

It's entirely possible that I'm missing something minute and silly, but I'm
too close to it now. Any insight is appreciated.

Warmest Regards,

Gavin Guest
Graphic Designer
Ebeacon
Gavin Guest
 

Re: Testing for Subproducts (IF...ELSE)

Postby loren_d_c » Tue May 17, 2005 8:23 am

I'm not sure why that doesn't work, but try using:

[-- IF PRODUCT.NumSubproducts 0 --]

to determine if there are no subproducts.

-Loren



Gavin Guest wrote:
Hello,

I am using ShopSite Pro 7.1.4, and I am having a problem when trying to
determine if a product has subproducts in my custom template. I have been
successfully using IF ELSE statements to test for all sorts of other items
for quite some time, but now that we're adding subproducts for a client,
this issue has gotten the better of me. I have scoured all documentation I
can find regarding IF tests, subproducts and custom templates to no avail.

Currently, when subproducts exist, the following shopsite code works like a
dream:
--- Begin ---
[-- IF PRODUCT.SUBPRODUCTS --]
div class="right"
h4>Related Products</h4
[-- LOOP SUBPRODUCTS --]
[-- SUBPRODUCTS --]
[-- END_LOOP SUBPRODUCTS --]
/div
[-- ELSE --]
[-- END_IF --]

[-- IF PRODUCT.Field2 --]
div class="item_attribute">Dimensions as Shown:<p
class="attribute_value">[-- PRODUCT.Field2 --]</p></div
[--Else--]
[--End_If--]

--- End ---

Again, the above works fine when subproducts exist. When the do not exist
the div class right and the h4 are in the source and displaying on my page.

Using [-- IF SUBPRODUCTS --] simply doesn't work at all.

It's entirely possible that I'm missing something minute and silly, but I'm
too close to it now. Any insight is appreciated.

Warmest Regards,

Gavin Guest
Graphic Designer
Ebeacon

loren_d_c
 
Posts: 2569
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere

Re: Testing for Subproducts (IF...ELSE)

Postby Gavin Guest » Tue May 17, 2005 8:44 am

Someone else in my office stumbled upon an existing loop for an old client
and it solved my problem. I knew posting here would help. :)

The difference:

Does not work:
[-- IF PRODUCT.SUBPRODUCTS --]

Does work:
[-- IF PRODUCT.SUBPRODUCT --]

Yet the loop and the template call must be subproducts with an "s". Stuff
like this within ShopSite kills me. The custom template abilities of 6 and 7
are really great, but many field names still do not seem to be consistent
from back office to the tags.

Warmest Regards,

Gavin Guest
Designer
Ebeacon
Gavin Guest
 


Return to User Forum

Who is online

Users browsing this forum: No registered users and 34 guests

cron