I have OpenCart 1.5.1.3 installed. I want to show the Manufacturer Logo on the product.tpl product page. How do I replace the Manufacturer Name link that is on the product.tpl page with the actual Manufacturer Logo of the Product?
Does anyone know what code I need to add to the product.tpl file?
Thank you for your help.
Does anyone know what code I need to add to the product.tpl file?
Thank you for your help.
open file :
find code (line 194)
add after with code
open file :
find code (line 27)
replace with code
Regards
Jimmy
Code: Select all
catalog\controller\product\product.php
Code: Select all
if ($product_info['image']) {
$this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
} else {
$this->data['popup'] = '';
}
Code: Select all
$manufacturer_image = $this->model_catalog_manufacturer->getManufacturer($product_info['manufacturer_id']);
if($manufacturer_image){
$this->data['manufacturers_img'] = $this->model_tool_image->resize($manufacturer_image['image'], 50, 50);
}else{
$this->data['manufacturers_img'] = false;
}
Code: Select all
catalog\view\theme\default\template\product\product.tpl
Code: Select all
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo $manufacturer; ?></a><br />
Code: Select all
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo ($manufacturers_img) ? '<img src="'.$manufacturers_img.'" title="'.$manufacturers.'" />' : $manufacturers ;?></a><br />
Jimmy
News CMS || Plus SEO || Live Price change with Option Select
Sorry but Jimmy is incorrect with his TPL replace code.
I cannot stress enough that... THERE IS NO TITLE ATTRIBUTE FOR IMG
ITS AN ALT!!!! TITLE IS ONLY ON LINKS!!!!
Anyway
More Search Engine Friendly and User Friendly.
But Kudos for the PHP Side, I've totally lost all my PHP Snippets when I wiped my phone :*(
I cannot stress enough that... THERE IS NO TITLE ATTRIBUTE FOR IMG
ITS AN ALT!!!! TITLE IS ONLY ON LINKS!!!!
Anyway
Code: Select all
<a href="<?php echo $manufacturers; ?>" title="<?php echo $manufacturer; ?>"><?php echo ($manufacturers_img) ? '<img src="'.$manufacturers_img.'" alt="'.$manufacturer.'" />' : $manufacturers ;?></a>
But Kudos for the PHP Side, I've totally lost all my PHP Snippets when I wiped my phone :*(
Wanted to do the same thing. Thanks for the code. It worked great.
A good site for e-commerce advice.
dijitul wrote:Sorry but Jimmy is incorrect with his TPL replace code.
I cannot stress enough that... THERE IS NO TITLE ATTRIBUTE FOR IMG
ITS AN ALT!!!! TITLE IS ONLY ON LINKS!!!!
Anyway
More Search Engine Friendly and User Friendly.Code: Select all
<a href="<?php echo $manufacturers; ?>" title="<?php echo $manufacturer; ?>"><?php echo ($manufacturers_img) ? '<img src="'.$manufacturers_img.'" alt="'.$manufacturer.'" />' : $manufacturers ;?></a>
But Kudos for the PHP Side, I've totally lost all my PHP Snippets when I wiped my phone :*(
Actually you are not correct. Title attribute applies to both Images and A HREF

Thanks for this solution.. i have just one problem and that is when using image size 50 50 its to small and when i make it eg. 100 100 i get the image to high up.
--------------------- LOGO IMAGE
Brand:
Product Code: 12345
Availability: In Stock
Is there a way to have the Brand beside the logo image?
[SOLVED] Just change the size of the image
--------------------- LOGO IMAGE
Brand:
Product Code: 12345
Availability: In Stock
Is there a way to have the Brand beside the logo image?
[SOLVED] Just change the size of the image
Last edited by Solan on Thu Apr 26, 2012 4:42 pm, edited 1 time in total.
And also.. if the brand doesnt have a logo the item gets an ugly link instead of a logo..
Brand: http://www.xxx.se/xxx/index.php?route=p ... urer_id=81
Is there a way of getting around this?
Brand: http://www.xxx.se/xxx/index.php?route=p ... urer_id=81
Is there a way of getting around this?
*lol*
Okay, i dont get it.. *feel ashamed*
I have brands with logos and i also have products with no brand logo.
If one product doesnt have a brand with a logo image, instead of not showing an image it shows a link instead (like the example above).
on products I would like to have the brandname instead of logo if there is no logo to show... instead of that ugly link ;-)
Is this possible?
Okay, i dont get it.. *feel ashamed*
I have brands with logos and i also have products with no brand logo.
If one product doesnt have a brand with a logo image, instead of not showing an image it shows a link instead (like the example above).
on products I would like to have the brandname instead of logo if there is no logo to show... instead of that ugly link ;-)
Is this possible?
Hello,
Is there a way to not show the link, when there is no brand image
Do this on the product.tpl file
<?php if ($manufacturers_img) { ?>
<a href="<?php echo $manufacturers; ?>" title="<?php echo $manufacturer; ?>"><?php echo ($manufacturers_img) ? '<img src="'.$manufacturers_img.'" alt="'.$manufacturer.'" />' : $manufacturers ;?></a>
<?php } ?>
Many Thank´s for this script!
Regard´s,
az-vm
Is there a way to not show the link, when there is no brand image
Do this on the product.tpl file
<?php if ($manufacturers_img) { ?>
<a href="<?php echo $manufacturers; ?>" title="<?php echo $manufacturer; ?>"><?php echo ($manufacturers_img) ? '<img src="'.$manufacturers_img.'" alt="'.$manufacturer.'" />' : $manufacturers ;?></a>
<?php } ?>
Many Thank´s for this script!

Regard´s,
az-vm
<br />Solan wrote:Thanks, but how do i get a new line after the logo and the modelnr?
Now i have the logo at the same line and its not nice ;-)
Celestial - Martín Abel Rosales
WhatsApp: 50671482211
Email: martinrosales2012@hotmail.com
Skype: martin.abel.rosales
San José , Costa Rica
module for manufacture image and description
free
http://www.opencart.com/index.php?route ... on_id=6943
paid
http://www.opencart.com/index.php?route ... on_id=6978
paid version also support description from admin and image hover effect
free
http://www.opencart.com/index.php?route ... on_id=6943
paid
http://www.opencart.com/index.php?route ... on_id=6978
paid version also support description from admin and image hover effect
A coder by Hobby and Developer by Profession
Images in Manufacture
http://www.opencart.com/index.php?route ... on_id=6943
Description and images in Manufacture
http://www.opencart.com/index.php?route ... on_id=6978
http://codertj.com
jimmyphong wrote:open file :find code (line 194)Code: Select all
catalog\controller\product\product.php
add after with codeCode: Select all
if ($product_info['image']) { $this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')); } else { $this->data['popup'] = ''; }
open file :Code: Select all
$manufacturer_image = $this->model_catalog_manufacturer->getManufacturer($product_info['manufacturer_id']); if($manufacturer_image){ $this->data['manufacturers_img'] = $this->model_tool_image->resize($manufacturer_image['image'], 50, 50); }else{ $this->data['manufacturers_img'] = false; }
find code (line 27)Code: Select all
catalog\view\theme\default\template\product\product.tpl
replace with codeCode: Select all
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo $manufacturer; ?></a><br />
RegardsCode: Select all
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo ($manufacturers_img) ? '<img src="'.$manufacturers_img.'" title="'.$manufacturers.'" />' : $manufacturers ;?></a><br />
Jimmy
TRIED THIS AND IT DID NOT WORK FOR MY O/C 1.5.1.3
www.cozziemo.co.nz
Can someone point out how to apply this part below to my custom theme as i have a feeling this is why it is not working
open file :
Code: Select all
catalog\view\theme\default\template\product\product.tpl
find code (line 27)
Code: Select all
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo $manufacturer; ?></a><br />
replace with code
Code: Select all
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo ($manufacturers_img) ? '<img src="'.$manufacturers_img.'" title="'.$manufacturers.'" />' : $manufacturers ;?></a><br />
open file :
Code: Select all
catalog\view\theme\default\template\product\product.tpl
find code (line 27)
Code: Select all
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo $manufacturer; ?></a><br />
replace with code
Code: Select all
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo ($manufacturers_img) ? '<img src="'.$manufacturers_img.'" title="'.$manufacturers.'" />' : $manufacturers ;?></a><br />
Who is online
Users browsing this forum: Bing [Bot] and 32 guests