Forums / Templates, Stylesheets, Page Layout / Manufacturer image on product category page

Manufacturer image on product category page

Locked

Views: 3,484

Results 1 to 19 of 19
This thread is locked. New replies are disabled.
8 Jun 2008, 8:10 PM
#1
bobdog avatar

bobdog

Totally Zenned

Join Date:
Mar 2006
Location:
Fresno, California
Posts:
590
Plugin Contributions:
0

Manufacturer image on product category page

Hi,

I need to display the manufacturer image below the product category text.

Example here:

http://mtidbits.com/index.php?main_page=designers

Under text for the designer, I need to place the manufacturer logo. Could somebody point me in the right direction?

8 Jun 2008, 9:08 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Manufacturer image on product category page

One of the easier methods is to use the function in the functions_lookups table for the manufacturers_image:
zen_get_products_manufacturers_image($product_id)

A search in your Zen Cart Admin with the Developers Tool Kit on:
manufacturers_image

or on the forums, will help you locate examples of its use to display that information ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Jun 2008, 10:47 PM
#3
bobdog avatar

bobdog

Totally Zenned

Join Date:
Mar 2006
Location:
Fresno, California
Posts:
590
Plugin Contributions:
0

Re: Manufacturer image on product category page

Well I tried just about every solution when I searched as per Ajeh's suggestion...none of them worked. Perhaps a little more input?

9 Jun 2008, 3:40 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Manufacturer image on product category page

You need to have access to the manufactures_image from the manufacturers table ...

To get that you need to know the products_id which can then use the function to lookup the manufacturers_image ...

I am not sure what your display is of as that appears to be customized, but somewhere in there should be something that references the products_id of the Product being displayed ... that would be used in the function to get the name of the file for the manufacturers_image ...

What happends if you use:
echo zen_get_products_manufacturers_image($product_id);

where $products_id would be the variable used of the products_id of the Product being displayed on that page ...

I don't know how you have that written ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

19 Jun 2008, 3:19 AM
#5
bobdog avatar

bobdog

Totally Zenned

Join Date:
Mar 2006
Location:
Fresno, California
Posts:
590
Plugin Contributions:
0

Re: Manufacturer image on product category page

I'm still having trouble with this. Can't seem to find a solution.

Here is the code for the page in question, http://mtidbits.com/index.php?main_page=designers

<?php
/**
 * Page Template
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_designer_default.php 3464 2006-04-19 00:07:26Z ajeh $
 */
?>
<div class="centerColumn" id="designer">
<h1 id="designerDefaultHeading" class="replace"><?php echo HEADING_TITLE; ?></h1>

<div id="designerDefaultMainContent" class="content">
<table>
<tr><td class="desinfo"><?php echo zen_image(DIR_WS_IMAGES .$manufacturers->fields['manufacturers_image'], $manufacturers->fields['manufacturers_name'], 150, 300) ?></td><td class="desinfo"><?php echo $manufacturers->fields['manufacturers_description'] ?></td></tr>
</table>
<?php require($template->get_template_dir('tpl_modules_designer_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_designer_products.php'); ?>
</div>

<div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
</div>

Thanks

23 Jun 2008, 5:10 AM
#6
bobdog avatar

bobdog

Totally Zenned

Join Date:
Mar 2006
Location:
Fresno, California
Posts:
590
Plugin Contributions:
0

Re: Manufacturer image on product category page

Ajeh:

What happends if you use:
echo zen_get_products_manufacturers_image($product_id);

where $products_id would be the variable used of the products_id of the Product being displayed on that page ...

Well, I've experimented with this, but still no success. Did I post the correct file and code above? That's the file I keep trying to edit.

Perhaps you could throw me another clue to investigate?

23 Jun 2008, 2:21 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Manufacturer image on product category page

I am not following the bouncing ball here ...

When I go to that link to your designers, what is it that I am really seeing and how does it relate to the manufacturers_id ...

You want a manufacturers_image but I see no Products ... do you have some relationship here to the manufactueres table that you could explain on this page?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

30 Jun 2008, 2:32 AM
#8
bobdog avatar

bobdog

Totally Zenned

Join Date:
Mar 2006
Location:
Fresno, California
Posts:
590
Plugin Contributions:
0

Re: Manufacturer image on product category page

That would be part of the problem. It is not my template, I'm just the lucky guy that gets to fix it. And I need help.

So, I'm asking for clues or any kind of help.

30 Jun 2008, 2:25 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Manufacturer image on product category page

You want manufacturers_image ... can you tell me, looking at the link you posted, what a manufactuer is on that page and the manufactuers_id for what you thing are the manufacturers?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

10 Aug 2008, 5:34 AM
#10
bobdog avatar

bobdog

Totally Zenned

Join Date:
Mar 2006
Location:
Fresno, California
Posts:
590
Plugin Contributions:
0

Re: Manufacturer image on product category page

In this case, the manufacturer is called a designer.

http://mtidbits.com/index.php?main_page=designers&id=6

http://mtidbits.com/index.php?main_page=designers&id=1

http://mtidbits.com/index.php?main_page=designers&id=7

I can see some custom files, i.e in the folder MY_TEMPLATE/tpl_designers.php

and tpl_modules *.php

and etc. but the mystery continues to baffle me.

Perhaps this info is not enough for anyone to get a bite on the question? :cry:

11 Aug 2008, 3:46 AM
#11
bobdog avatar

bobdog

Totally Zenned

Join Date:
Mar 2006
Location:
Fresno, California
Posts:
590
Plugin Contributions:
0

Re: Manufacturer image on product category page

OK, still having problems, but I have found the file that creates this page where I want the manufacturers image...

The code that generates this is main_template_vars.php and here is the line that calls the manufacturer name but not the image:

$name='<a href="'.zen_href_link(FILENAME_DESIGNERS,'id='.$manufacturers->fields['manufacturers_id']).'" class="manname">'. $manufacturers->fields['manufacturers_name'] . '</a>';

When I just change ['manufacturers_name'] to ['manufacturers_image'] I get a text showing the path to the image, but no image and it is not linked.

So my attempts are closer, but something missing...

Making any sense now?

11 Aug 2008, 2:27 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Manufacturer image on product category page

You could add this function into your extras directory:

  function zen_get_manufacturers_image($manufacturers_id) {
    global $db;

    $check_manufacturers_query = "select m.manufacturers_image
                      from " . TABLE_MANUFACTURERS . " m
                      where m.manufacturers_id = '" . (int)$manufacturers_id . "'";

    $check_manufacturers =$db->Execute($check_manufacturers_query);

    return ($check_manufacturers->RecordCount() > 0) ? $check_manufacturers->fields['manufacturers_image'] : "";
  }

Then call it with the id as referenced as where you need it ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Aug 2008, 3:54 AM
#13
bobdog avatar

bobdog

Totally Zenned

Join Date:
Mar 2006
Location:
Fresno, California
Posts:
590
Plugin Contributions:
0

Re: Manufacturer image on product category page

Thanks for the post.

I added the code in a new file, gave it a name and saved it in the extras folder.

Now, where do I go from here? In main_template_vars.php, how do I edit to get the manufacturer image?

<?php
/**
 * Specials
 *
 * @package page
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: main_template_vars.php 4629 2006-09-28 15:29:18Z ajeh $
 */


 $manid=(int) $_GET['id'];
 
 if(!empty($manid)){
	 $manufacturers_query_raw = "select manufacturers_id, manufacturers_name, manufacturers_description, manufacturers_image, date_added, last_modified from " . TABLE_MANUFACTURERS . " where   manufacturers_id = ".$manid." order by manufacturers_name";
	 $manufacturers = $db->Execute($manufacturers_query_raw);
	 define('HEADING_TITLE', $manufacturers->fields['manufacturers_name']);
	 require($template->get_template_dir('tpl_designer.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_designer.php');
 } else {
	define('HEADING_TITLE', 'Designers');
	 $manufacturers_query_raw = "select manufacturers_id, manufacturers_name, manufacturers_description, manufacturers_image, date_added, last_modified from " . TABLE_MANUFACTURERS . " order by manufacturers_name";
	 $manufacturers = $db->Execute($manufacturers_query_raw);
	 $row = 0;
	  $col = 0;
	  $list_box_contents = array();
	  $title = '';

	$num_products_count = $manufacturers->RecordCount();


     $list_box_contents = array();
		while (!$manufacturers->EOF) {

	      $name='<a href="'.zen_href_link(FILENAME_DESIGNERS,'id='.$manufacturers->fields['manufacturers_id']).'" class="manname">'. $manufacturers->fields['manufacturers_name'] . '</a>';

	      $list_box_contents[$row][$col] = array('params' => 'class="specialsListBoxContents"' . ' ' . 'style="width: 25%;"',
	      'text' => ($name));
			
	       $col ++;
	      if ($col > 3) {
	        $col = 0;
	        $row ++;
	      }
	      $manufacturers->MoveNext();
    }
	 require($template->get_template_dir('tpl_modules_designers.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_designers.php');
  }
?>
12 Aug 2008, 5:04 AM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Manufacturer image on product category page

If $manid is suppose to be the manufacturers_id for the current manufacturer on the display ...

<?php echo 'I see the manufacturers image: ' . zen_image(DIR_WS_IMAGES .  zen_get_manufacturers_image($manid)); ?>

will display the image ...

You need to work into your code where you want to see that image ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Aug 2008, 5:05 AM
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Manufacturer image on product category page

Note: this can be called from the tpl_ file and not mess with the main_template_vars.php file at all ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

14 Aug 2008, 5:27 AM
#16
bobdog avatar

bobdog

Totally Zenned

Join Date:
Mar 2006
Location:
Fresno, California
Posts:
590
Plugin Contributions:
0

Re: Manufacturer image on product category page

I totally tried and tried...and tried to make this work.

Alas, I could not. SO I MADE A "GHETTO HACK."

Giggle. :eek:

Don't make me...don't make me...bust out a table and hard code it. Page source says it all.

http://mtidbits.com/index.php?main_page=designers

24 Jan 2010, 3:47 AM
#17
signs avatar

signs

Zen Follower

Join Date:
Jun 2006
Posts:
128
Plugin Contributions:
0

Re: Manufacturer image on product category page

Ok, I found this thread and this is just exactly, I think, what a customer of mine would like to accomplish.

She has a digital scrapbooking site that has amassed it's inventory from a bunch of contributing designers. A previous hired hand changed the english.php file to display the heading "Designers" in place of "Manufacturers". The products are all added to communal categories, but they keep track of whose is whose by using the Manufacturer function.

A customer can choose to sort the products by Designer (manufacturer).

What she is wanting to know is, the designers all have their own logo/banners and when creating their "Manufacturer" content, they want to upload their image/banner and if someone sorts by using the Manufacturer (Designer) dropdown, when that designer's name is chosen, they want their banner to display. This would be the one they uploaded as "Manufacturer's Image" in admin.

So, how do I call that on the product listing page (not product details, but the main page that lists all the designer's products)?

is this the code I would use?

function zen_get_manufacturers_image($manufacturers_id) {
    global $db;

    $check_manufacturers_query = "select m.manufacturers_image
                      from " . TABLE_MANUFACTURERS . " m
                      where m.manufacturers_id = '" . (int)$manufacturers_id . "'";

    $check_manufacturers =$db->Execute($check_manufacturers_query);

    return ($check_manufacturers->RecordCount() > 0) ? $check_manufacturers->fields['manufacturers_image'] : "";
  }  

and if so, will that fetch the image only if one exists? and if only sorting by manufacturer?

TIA

Jeri

24 Jan 2010, 4:10 AM
#18
signs avatar

signs

Zen Follower

Join Date:
Jun 2006
Posts:
128
Plugin Contributions:
0

Re: Manufacturer image on product category page

After re-reading this thread I think I understand you, Ajeh, when you say that needs to be added as a function file in extra functions, but on the tpl_modules_products_all_listing.php file? and if so, what is the proper code to fetch it?

TIA
Jeri

25 Jan 2010, 1:22 AM
#19
signs avatar

signs

Zen Follower

Join Date:
Jun 2006
Posts:
128
Plugin Contributions:
0

Re: Manufacturer image on product category page

I found this code in the

 if (zen_not_null($manufacturer_info_sidebox->fields['manufacturers_image'])) {
    $content .= zen_image(DIR_WS_IMAGES . $manufacturer_info_sidebox->fields['manufacturers_image'], $manufacturer_info_sidebox->fields['manufacturers_name']) . "\n";
  }

If I want to use that code to display the manufacturer's image on the tpl_module_products_all_listing.php page, how would I do that?

Everything else on that page has "$products_all" where this has "$manufacturer_info_sidebox". I'm guessing that just changing that to match isn't going to do the trick.

What do I need to do to get the page to fetch the image or tell it where the image is located?

I (obviously) know not even the simplest of php, but I am darn good at following instructions. Any help is greatly appreciated. :D