Forums / Templates, Stylesheets, Page Layout / HOW TO: Combine Manufacturer and Model field info in product listings

HOW TO: Combine Manufacturer and Model field info in product listings

Locked

Started by ryk on 15 Feb 2007, 12:43 AM · Views: 1,954

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
15 Feb 2007, 12:43 AM
#1
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

HOW TO: Combine Manufacturer and Model field info in product listings

With a fixed width site, there can be a shortage of space in the product listings. One thing you can do, if relevant to you and assuming you need to display the information, is to combine the Manufacturer and Model info so that you can hide one column from the table. The way I've done this doesn't entirely remove the column, but at least sets it to a minimum width, thereby giving more space for the description. I guess the column could be removed, but that requires programming outside my skill level.

Before going any further, take a look at http://www.fastlec.co.uk/index.php?main_page=index&cPath=22_24_83 to see if that layout suits your needs.

I take no responsibility if this wrecks your cart, but you are working with an override so you should be safe.

Edit includes/modules/product_listing.php. Find at around line 24

case 'PRODUCT_LIST_MODEL':
    $lc_text = TABLE_HEADING_MODEL;
    $lc_align = '';
    $zc_col_count_description++;

and, to hide the column heading for Model, change to

case 'PRODUCT_LIST_MODEL':
    $lc_text = '';//TABLE_HEADING_MODEL;
    //$lc_align = '';
    //$zc_col_count_description++;

Then at around line 104 find

case 'PRODUCT_LIST_MANUFACTURER':
        $lc_align = '';
        $lc_text = '<a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a>';
        break;

and change to

case 'PRODUCT_LIST_MANUFACTURER':
        $lc_align = '';
        $lc_text = '<a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a><br />'.$listing->fields['products_model'];
        break;

I appreciate that this may not be the best way to do it, but it works for me - although it would be nice to remove the column completely AND get rid of the sort sign as well.

Save the file as includes/modules/YOUR_TEMPLATE/product_listing.php

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

15 Feb 2007, 6:49 AM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: HOW TO: Combine Manufacturer and Model field info in product listings

Good idea, Ryk! Looks like you have the simplest way of doing this - I tested the concept putting mfr name under model #, and it doesn't work when mfr is turned off in admin, but works fine when it is turned on. I don't need the feature myself, as we make everything we sell, but it could save valuable space.

For the sake of completeness, the heading text can be changed (to Mfr/Model) in /includes/languages/english/your_template/index.php. I haven't tested it and don't know if this version of the constant is used anywhere else.

You can set the ascending and descending sort order markers to blank in Configuration > Product Listing.

15 Feb 2007, 9:24 AM
#3
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: HOW TO: Combine Manufacturer and Model field info in product listings

Thanks - it was past my bedtime when I posted that which is why I forgot to include those details. :wink2: (And I'd completely forgotten about the sort marker switch..although that is universal)

Now this is probably heresy, but I sometimes wonder when one is using an override file and it's a one-off situation what the point is of making more work by editing the language file as well.

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

16 Feb 2007, 1:24 AM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: HOW TO: Combine Manufacturer and Model field info in product listings

I suppose the case where it would really matter is a multi-language installation. The "right" way would allow for different text to drop in seamlessly.
On a one-language site that nobody else is ever going to take over and update, I have no problem with slipping some things in the easy way.

16 Feb 2007, 9:46 AM
#5
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: HOW TO: Combine Manufacturer and Model field info in product listings

gjh42:

nobody else is ever going to take over and update

My clients have to die or go out of business before they leave me! :laugh:

Seriously though, that's a valid point - it's so easy to get tunnel vision on the job in hand.

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

10 Oct 2007, 2:05 PM
#6
glv avatar

glv

New Zenner

Join Date:
Oct 2007
Posts:
29
Plugin Contributions:
0

Re: HOW TO: Combine Manufacturer and Model field info in product listings

Can one of you guys help me separate the Price out of the column with the Quantity box and the Add to cart button?

I am trying to do it on my own and this is the closest thing I can find to anyone wanting something similar to what I need to do.

Thanks...