Post by Brook » Wed Dec 21, 2011 11:43 pm

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.

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by jimmyphong » Thu Dec 22, 2011 2:01 am

open file :

Code: Select all

catalog\controller\product\product.php
find code (line 194)

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'] = '';
			}
add after with code

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;
			}
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 />
Regards
Jimmy

News CMS || Plus SEO || Live Price change with Option Select


Active Member

Posts

Joined
Sat Aug 13, 2011 2:48 am


Post by Brook » Mon Dec 26, 2011 7:41 am

Jimmy,

Your solution worked great! Thank you.

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by dijitul » Tue Feb 07, 2012 12:52 am

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

Code: Select all

<a href="<?php echo $manufacturers; ?>" title="<?php echo $manufacturer; ?>"><?php echo ($manufacturers_img) ? '<img src="'.$manufacturers_img.'" alt="'.$manufacturer.'" />' : $manufacturers ;?></a>
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 :*(

New member

Posts

Joined
Mon Jun 13, 2011 9:21 pm

Post by H2O » Fri Mar 16, 2012 4:38 am

Wanted to do the same thing. Thanks for the code. It worked great.

A good site for e-commerce advice.


H2O
New member

Posts

Joined
Wed Feb 29, 2012 7:36 am

Post by platinum » Wed Apr 04, 2012 4:24 am

Is there a way to make it so the logo doesn't resize. I need it to put the actual size of the logo in that section.

Newbie

Posts

Joined
Thu Nov 03, 2011 9:15 am

Post by Avvici » Wed Apr 04, 2012 4:32 am

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

Code: Select all

<a href="<?php echo $manufacturers; ?>" title="<?php echo $manufacturer; ?>"><?php echo ($manufacturers_img) ? '<img src="'.$manufacturers_img.'" alt="'.$manufacturer.'" />' : $manufacturers ;?></a>
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 :*(


Actually you are not correct. Title attribute applies to both Images and A HREF :o One cancels out the other in the order of things. It's always safer to use title in A HREF because it ensures that it shows up in all browsers.

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by Solan » Mon Apr 09, 2012 7:09 pm

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
Last edited by Solan on Thu Apr 26, 2012 4:42 pm, edited 1 time in total.

Active Member

Posts

Joined
Sat Feb 19, 2011 7:34 pm

Post by Solan » Mon Apr 09, 2012 7:56 pm

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?

Active Member

Posts

Joined
Sat Feb 19, 2011 7:34 pm

Post by Avvici » Mon Apr 09, 2012 10:56 pm

No, you need to assign an SEO keyword to each that is different in alias. There is no code that inserts a default random string as the SEO keyword.

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by Solan » Wed Apr 11, 2012 5:15 am

avvici wrote:No, you need to assign an SEO keyword to each that is different in alias. There is no code that inserts a default random string as the SEO keyword.
Who were you answering? :)

Active Member

Posts

Joined
Sat Feb 19, 2011 7:34 pm

Post by Avvici » Wed Apr 11, 2012 8:07 am

I thought I was answering you, after looking at your ugly link:)

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by Solan » Thu Apr 19, 2012 3:30 am

*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?

Active Member

Posts

Joined
Sat Feb 19, 2011 7:34 pm

Post by Solan » Sun Apr 29, 2012 8:39 am

I bet there must be a way of having a logo show IF there is a image to this brand and the name If there is no image to the brand??

Active Member

Posts

Joined
Sat Feb 19, 2011 7:34 pm

Post by az-vm » Wed May 23, 2012 8:37 am

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

New member

Posts

Joined
Sat Jul 30, 2011 7:53 am
Location - Men at Work @ It´s a Mistake

Post by Solan » Thu May 24, 2012 3:30 pm

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 ;-)

Active Member

Posts

Joined
Sat Feb 19, 2011 7:34 pm

Post by celestial » Fri May 25, 2012 1:21 am

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 ;-)
<br />

Celestial - Martín Abel Rosales
WhatsApp: 50671482211
Email: martinrosales2012@hotmail.com
Skype: martin.abel.rosales
San José , Costa Rica


User avatar
Expert Member

Posts

Joined
Sat Mar 20, 2010 4:19 am
Location - Costa Rica

Post by trinkaljuneja » Sat Jun 23, 2012 4:09 pm

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

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


New member

Posts

Joined
Tue Aug 23, 2011 9:08 pm

Post by cozzienz » Thu Nov 22, 2012 6:35 am

jimmyphong wrote:open file :

Code: Select all

catalog\controller\product\product.php
find code (line 194)

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'] = '';
			}
add after with code

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;
			}
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 />
Regards
Jimmy

TRIED THIS AND IT DID NOT WORK FOR MY O/C 1.5.1.3
www.cozziemo.co.nz

User avatar
Active Member

Posts

Joined
Sun May 15, 2011 11:13 am

Post by cozzienz » Thu Nov 22, 2012 8:44 am

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 />

User avatar
Active Member

Posts

Joined
Sun May 15, 2011 11:13 am
Who is online

Users browsing this forum: Baidu [Spider] and 210 guests