Forums / Templates, Stylesheets, Page Layout / Product listing, group products.

Product listing, group products.

Started by kylef on 27 May 2016, 1:34 PM · Views: 467

Results 1 to 2 of 2
27 May 2016, 1:34 PM
#1
kylef avatar

kylef

New Zenner

Join Date:
Jan 2009
Posts:
2
Plugin Contributions:
0

Product listing, group products.

Hi,

I've been trying to make my product listing something like this:

Group 1

Product 1
Product 2

Group 2

Product 3
Product 4

I added a new field in the products table and named that 'products_group'. In modules/product_listing.php I made this change to test that I could get the value of my new field.

case 'PRODUCT_LIST_PRICE':
        $lc_price = '<div class="list-price">' . zen_get_products_display_price($listing->fields['products_id']) . $listing->fields['products_group']. '</div>';
        $lc_align = 'right';
        $lc_text =  $lc_price;

It works, I get the value next to the product price. I've been trying to customize tabular_display.php, but I get nowhere.

If $listing->fields['products_group'] = 0
Show default product listing

If $listing->fields['products_group'] = 1
echo a new header row with a custom name
list products belonging to this group

If $listing->fields['products_group'] = 2
echo a new header row with a custom name2
list products belonging to this group

27 May 2016, 3:14 PM
#2
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Product listing, group products.

i'm guessing that you are looking at the script tpl_tabular_display.php as that is the only file i found close to what you mentioned.

$listing is not available in that script from what i can tell. you need to add your new field into $list_box_contents in product_listing.php; else you can strip it out of $lc_price field that you already have.

as $list_box_contents is a multi-dimensional array, it gets a little confusing as to where to add it.

good luck!

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.