product pages, how to add a rule after every row of 3 produc

Questions and answers about ShopSite Custom Templates

product pages, how to add a rule after every row of 3 produc

Postby Vernontnh » Mon Apr 12, 2010 7:51 pm

Hi:

I want to set up my product page so it looks a bit like a tic-tac-toe board, where there are three products across a row with a vertical rule between each product. I'm using a combination of a table with css boxes in the cells that have side boarders to create the vertical rules between the columns.

But how do I tell shopsite to load three products and threreafter if there is at least one additional product, a horizontal rule should be drawn across the product area (under the previous row of three products) and a new row of products should be started below that.

Any ideas?
Thanks,

Vernon
Vernontnh
 
Posts: 59
Joined: Wed Nov 05, 2008 6:50 am
Location: USA

Postby BFChris » Tue Apr 13, 2010 6:38 am

You would need to set a counter .VAR in your template to increment each time through the Product loop and output the line and reset the count after every 3rd one.

I just did something similar last night to get a search template to look right.
~~Barefoot Chris
--------------------------------
Barefoot Chris Web Design
www.barefootchris.net
--------------------------------
BFChris
 
Posts: 322
Joined: Mon Oct 09, 2006 3:28 pm
Location: PA

thank you -- can you show me the code you developed

Postby Vernontnh » Tue Apr 13, 2010 6:44 am

Hi Chris:

Thanks for your response. Could you show me what the code should look like using your site as an example. I know very little about using VAR's.

Thanks,

Vernontnh
Vernontnh
 
Posts: 59
Joined: Wed Nov 05, 2008 6:50 am
Location: USA

Postby Jim » Tue Apr 13, 2010 7:56 am

In the page template before the Loop Products section set a counter
[-- VAR.counter 0 --]
----
in the product template
increment the counter
[-- VAR.counter inc --]
check if the counter is 4 If it is you need to put out your rule
and start a new row and reset the counter

[-- if VAR.counter 4 --]
reset the counter to 0
[-- VAR.counter 0 --]
<hr>
[-- end_if --]
output your product info.


Note that I have not included the setting up of the table, tr or td or div tags which would also need to be done. Where that is done depends on how you have the page template setup.

Note something similar to what you want except for the horizontal rule being a vertical line between products was discussed in
http://support.shopsite.com/forums/viewtopic.php?t=3298
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 23 guests

cron