Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Customizing the Look of Your Shop / Templates, Stylesheets, Page Layout / Struggling to show manufacturer name on product listing

Struggling to show manufacturer name on product listing

Locked
This thread is locked. New replies are disabled.
23 Dec 2010, 5:20 AM
#1
524cw avatar

524cw

New Zenner

Join Date:
Sep 2008
Posts:
53
Plugin Contributions:
0

Post #1 by 524cw

I'm trying to show the manufacturers name on my product listing page but it's proving tougher than I thought!

In my admin > configuration > all listing I have Display Product Manufacturer Name set to 2150. So it should be "on". I think!

I'm using Zencart 1.3.9f along with the single listing template mod to show the products in a grid on the product listing page for each category. The relevant code I'm tinkering with is pretty similar to the regular old ZenCart template.

I guess my main questions is, on the product listing page, what is the correct way to call for the mfr name to display for each product? Is it:

<a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a>

When I put that statement into my template it spits out the correct link but no anchor text. The href is there but the manufacturers name doesn't show up.

<a href="http://www.mysite.com/index.php?main_page=index&manufacturers_id=10"></a>

I don't really care about the link, I just want to show the name :huh: Maybe there is some flag or setting in admin that I missed?

For the template, I'm editing the $lc_text part of modules/my_template/product_listing.php file. Here is where I am at the moment. You can probably see where I added the $listing->fields['manufacturers_name'] bits.

    for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
      $lc_align = '';
      switch ($column_list[$col]) {
        case 'PRODUCT_LIST_MODEL':
        $lc_align = '';
        $lc_text = '<div class="itemModel">'. $listing->fields['products_model'] . '</div>';
        break;
		case 'PRODUCT_LIST_NAME'://STEVE for boilerplate text Product Name as a link plus optional truncated description
        $lc_align = '';
        if (isset($_GET['manufacturers_id'])) {//true if its a manufacturer listing page STEVE bof Boilerplate text
			if (!$is_slt_listing) {//normal product listing
			$lc_text = '<div class="itemManufacturer"><a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a></div><div class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></div>';
			} else {//Single Listing Template
			$lc_text = '<div class="itemManufacturer"><a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a></div><div class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($listing->fields['master_categories_id']) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></div>';
			}
		} else {//not a manufacturer product listing, but the code loaded into $lc_text is the same in either case!! 
		if (!$is_slt_listing) {//normal product listing
			$lc_text = '<div class="itemManufacturer"><a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a></div><div class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></div>';
			} else {//Single Listing Template
			$lc_text = '<div class="itemManufacturer"><a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a></div><div class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($listing->fields['master_categories_id']) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></div>';
			}
			}
        break;
        case 'PRODUCT_LIST_MANUFACTURER':
        $lc_align = '';
        $lc_text = '<div class="itemManufacturer"><a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a></div>';
        break;
        case 'PRODUCT_LIST_PRICE':
        $lc_price = '<div class="itemPrice">'.zen_get_products_display_price($listing->fields['products_id']) . '</div>';
        $lc_align = 'right';
        $lc_text =  $lc_price;

Any ideas what I'm doing wrong?

23 Dec 2010, 6:14 AM
#2
gjh42 avatar

gjh42

Black Belt

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

Post #2 by gjh42

show the manufacturers name on my product listing page

admin > configuration > all listing I have Display Product Manufacturer Name set to 2150

What is your setting for Configuration > Product Listing > Display Product Manufacturer Name?

23 Dec 2010, 6:21 AM
#3
524cw avatar

524cw

New Zenner

Join Date:
Sep 2008
Posts:
53
Plugin Contributions:
0

Post #3 by 524cw

gjh42:

show the manufacturers name on my product listing page

admin > configuration > all listing I have Display Product Manufacturer Name set to 2150

What is your setting for Configuration > Product Listing > Display Product Manufacturer Name?

:blush: It was off. I turned it on. Mystery solved. :clap:

Thank you.