Post by flightoffancy » Sun Feb 14, 2010 3:59 am

How would I go about getting the manufacturer image to display on the product/manufacturer page above the products? I did a search and found where someone had explained how to get them to appear for the sidebox module but not for the actual page itself.

Version 1.4

Any help greatly appreciated.

New member

Posts

Joined
Fri Jan 22, 2010 9:34 pm

Post by signsintime » Sun Feb 14, 2010 8:03 pm

If you are talking about the product list display, where, if you use the manufacturer's sort box to then display the list of products by that manufacturer, and have their image appear along with their name, then I am very interested in this as well.

Does anyone have an answer? This is the query I have and it's not working:

Code: Select all


getManufacturerImage($manufacturer_id) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "manufacturer_image WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");

		return $query->row;



Any help would be greatly appreciated!!! ;D <-- there's no "begging" smilie, so that's the best I can do. LOL

Jeri

If it makes a difference in whether or not anyone cares to tackle this, I am desperate and
$$$ WILLING TO PAY $$$
for the code. Cart version is 1.4

Newbie

Posts

Joined
Tue Jan 26, 2010 11:30 am

Post by pstreet » Sun Feb 14, 2010 11:07 pm

signsintime wrote:If you are talking about the product list display, where, if you use the manufacturer's sort box to then display the list of products by that manufacturer, and have their image appear along with their name, then I am very interested in this as well.

Does anyone have an answer? This is the query I have and it's not working:

Code: Select all


getManufacturerImage($manufacturer_id) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "manufacturer_image WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");

		return $query->row;
I didn't think there was a 'manufacturer_image' table? Correct me if I'm wrong, but I've just looked in my database schema and I see only a 'manufacturer' table, within it is an 'image' field.. so maybe this code might be better:

Code: Select all

getManufacturerImage($manufacturer_id){
	$query = $this->db->query("SELECT `image` FROM `" . DB_PREFIX . "manufacturer` WHERE `manufacturer_id` = " . (int)$manufacturer_id);
	return $query->row;
}
I haven't tested the code that I wrote above, but the code that you put together would be failing due to the table not existing (unless you're running a mod or something I'm not familiar with that has created that table).

Currently unavailable for freelance work and consulting.


User avatar
New member

Posts

Joined
Tue Nov 03, 2009 2:00 pm
Location - New South Wales, Australia

Post by flightoffancy » Mon Feb 15, 2010 4:24 am

pstreet,
Given that your code is correct for the model file then all that should need doing would be to add to the template file to pull in the image, correct? Or does something need added to the controller file as well?

I've added your code to the model file and inserted <?php echo $manufacturer['image']; ?> as the image source in the tpl but the image still isn't being pulled in.

I want so badly to learn how to do these (what should be) simple edits but I'm pulling my hair out over this one.

New member

Posts

Joined
Fri Jan 22, 2010 9:34 pm

Post by signsintime » Tue Feb 16, 2010 5:50 am

Thanks so much, pstreet, for your reply!

I'm about at the same place flightoffancy is, wanting to know how to do this stuff and having it drive me crazy.

I ran that query on the db from phpMyAdmin and it worked fine, giving me the manufacturer's image list.

Now, because I know so very little about this, which file does that query go in? The controller?

And then what, if anything, goes in the model? I have nothing in that file for the image, and I, too tried to use the echo image code in the tpl file but it doesn't show up and I know for certain an image exists and should show up.

I really want to learn this and am a very good student, willing to listen and follow instruction, but need it given to me at an elementary school level. :-)

TIA for your help
Jeri

Newbie

Posts

Joined
Tue Jan 26, 2010 11:30 am

Post by pstreet » Tue Feb 16, 2010 8:48 am

Sorry guys, I'm not writing a mod or anything for this, I was just providing a fix for the SQL query that was incorrect above.

To be honest after reviewing the model file in 'catalog/model/catalog/manufacturer.php' you don't even need to be creating a 'getManufacturerImage' function. The 'getManufacturer' call in that model file will already have made available the 'image' field containing the path to an image file (or an empty string if no image has been applied).

As an example, just to show how you can get an image onto the manufacturer page you can add the following code into your 'catalog/controller/product/manufacturer.php' file, beneath the code:

Code: Select all

     $this->data['heading_title'] = $manufacturer_info['name'];

      $this->data['text_sort'] = $this->language->get('text_sort');
Add this code:

Code: Select all

if(isset($manufacturer_info['image']) && $manufacturer_info['image'] != "") {
    $manufacturer_image = $manufacturer_info['info'];
} else {
    $manufacturer_image = 'no_image.jpg';
}
$this->data['manufacturer_image'] = image_resize($manufacturer_image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
Then in your 'catalog/view/theme/<your theme folder>/template/product/manufacturer.tpl' you can add:

Code: Select all

<img src="<?php echo $manufacturer_image; ?>"/>
This code is simply an example of how you can get the image into your template, I'll leave it up to you as an exercise to modify it how you like.

Please note this information applies only to v1.4.0 (it could apply to earlier versions, I haven't checked however).

Currently unavailable for freelance work and consulting.


User avatar
New member

Posts

Joined
Tue Nov 03, 2009 2:00 pm
Location - New South Wales, Australia

Post by fireatwire » Fri Dec 03, 2010 11:36 pm

Didn't work for me with 1.4.9.1 ... Can someone write what I need to alter to add it to the manufacturers page?
Thanks!

New member

Posts

Joined
Wed Feb 03, 2010 5:21 am

Post by mantisviii » Tue Dec 20, 2011 6:15 pm

i need this for 1.5.1.3. Doesn't work :(

Newbie

Posts

Joined
Tue Dec 13, 2011 9:13 am

Post by mazhar » Mon Mar 26, 2012 5:37 pm

Solution for version v1.5.2.1

You can show Manufacture image on the manufacturer page by adding 2 lines in 2 pages

1.
Open this file catalog/controller/product/manufacturer.php
go to line 50 and add this 'image' => $result['image'], after that you code will look like this

Code: Select all

			$this->data['categories'][$key]['manufacturer'][] = array(
				'name' => $result['name'],
				'image' => $result['image'],
				'href' => $this->url->link('product/manufacturer/product', 'manufacturer_id=' . $result['manufacturer_id'])
			);
Now you have get the image from database now you have to show this image in manufacture tpl file

open this catalog/view/theme/yourthemname/template/product/manufacturer_list.tpl and add this code

Code: Select all

<img src="<?php echo $category['manufacturer'][$i]['image']; ?>" />
where you want to show your image that's it

Newbie

Posts

Joined
Thu Apr 28, 2011 6:11 pm
Who is online

Users browsing this forum: pprmkr and 50 guests