Page 1 of 1

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

PostPosted: Mon Apr 12, 2010 7:51 pm
by Vernontnh
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

PostPosted: Tue Apr 13, 2010 6:38 am
by BFChris
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.

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

PostPosted: Tue Apr 13, 2010 6:44 am
by Vernontnh
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

PostPosted: Tue Apr 13, 2010 7:56 am
by Jim
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