Using Variable Tag with Define Product

General ShopSite user discussion

Using Variable Tag with Define Product

Postby rasbro » Tue Mar 06, 2007 11:24 am

I need the Define Product code in the Product Template to be different for the home page list of products (Loop Products) than for the list of products on other pages. For example, the Define Product code for the home page will display the list of products with the graphic above the product name and is in a 3 column format, but for the other pages the code displays the list of products with the graphic to the left of the product name and is in a 1 column format.

When I use a Variable tag like [-- VAR.HomePage "yes" --] at the top of the Home Page Template, and then use the tag [-- IF VAR.HomePage "yes" --] in the Define Product code so it will display the code specific for the home page list of products, all I get is the first product displayed correctly for the home page and then all the rest of the products are displayed with the code for other pages.

So it appears that the Variable tag worked but only for the first <td> in the loop. I am baffled by this since I thought it would run for all the <td>'s in the Loop of Products. Any suggestions?

Thanks for any help you can give.
Brian

Saturn Coast Technologies
www.saturncoast.com
rasbro
 
Posts: 12
Joined: Tue Jan 23, 2007 11:57 am

Postby loren_d_c » Tue Mar 06, 2007 11:35 am

A VAR should last throughout the Publish. Are you sure that you aren't resetting that same VAR to some other value somewhere else in your page or product template?

-Loren
loren_d_c
 
Posts: 2572
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere

Postby rasbro » Tue Mar 06, 2007 11:54 am

That makes sense to me Loren, but I don't have any other Variable. I am using the IF ELSE tags like this in the Product Define code: [-- IF VAR.HomePage "yes" --] then code for home page products [-- ELSE --] then code for any other pages [-- END_IF --]. Should I spell out a Variable for the other pages and then use an IF tag for both instead of using ELSE?
Brian

Saturn Coast Technologies
www.saturncoast.com
rasbro
 
Posts: 12
Joined: Tue Jan 23, 2007 11:57 am

Postby loren_d_c » Tue Mar 06, 2007 12:13 pm

Are you certain that the other products are showing up because they are assigned to the page as products, rather than subproducts of some other product on the page?

What version of ShopSite are you using?

-Loren
loren_d_c
 
Posts: 2572
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere

Postby rasbro » Tue Mar 06, 2007 12:16 pm

Interesting enough, I did find I was using another variable in the template but I thought it was unique. I found that the value of the variable, such as "yes" vs. "no" or something else, doesn't make it unique. I had to rename the variable to something unique and then it worked fine. So yes Loren, you were right; I did have another variable that was resetting the value.

Thanks for asking the question so I could think about it and then discover it. Great help!
Brian

Saturn Coast Technologies
www.saturncoast.com
rasbro
 
Posts: 12
Joined: Tue Jan 23, 2007 11:57 am


Return to User Forum

Who is online

Users browsing this forum: Bing [Bot] and 42 guests