Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Splitting product_listing array and wrapping containers around

Splitting product_listing array and wrapping containers around

Locked

Views: 676

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
12 Mar 2009, 12:54 PM
#1
karl19 avatar

karl19

New Zenner

Join Date:
Jun 2007
Posts:
62
Plugin Contributions:
0

Splitting product_listing array and wrapping containers around

Hello,

We're working on a small shop, where on the category page we'd like output the products in blocks of nine, with the possibility to click through to the next nine. I've got the script for doing that, but I'm not sure how I'd split the array in the product_listing module apart.

We'd like to wrap a DIV around every nine products. Say we've got 20 products on a page, we'd like to end up with a structure like this:

<div class="ourblock">
  Products 1-9
</div>

<div class="ourblock">
  Products 10-18
</div>

<div class="ourblock">
  Products 19-20
</div>
```I can see in the file where it loops through the products, but I'm not sure how I'd check for nine products and wrap a DIV around them, then move on to the next lot.. would be great if someone could offer some coding insight on this!

Thanks, Karl
12 Mar 2009, 1:32 PM
#3
karl19 avatar

karl19

New Zenner

Join Date:
Jun 2007
Posts:
62
Plugin Contributions:
0

Re: Splitting product_listing array and wrapping containers around

tony_sar,

many thanks! I'd actually used this contributions before and even looked at it again when I was trying to solve this problem, though I wasn't sure how I'd do the wrapping. But your prod got me going again..

I set the contribution to list columns, 9 per row and then used an override for tpl_columnar_display.php where I added the DIVs at the beginning and end of each loop of nine.

Works great now, thanks for you help!

12 Mar 2009, 1:47 PM
#4
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Re: Splitting product_listing array and wrapping containers around

glad that mod helped out :smile: