Jump to content

Manufacturer Logo on Product List


chops07876

Recommended Posts

Hi Everyone,

 

I've added the line of code below to "product-list.tpl" which when viewed under "Manufacturer", displays the appropriate logo along with the product.

 

<img src="{$img_manu_dir}{$manufacturer->id}.jpg" alt="{$manufacturer->name|escape:'htmlall':'UTF-8'}" title="{$manufacturer->name|escape:'htmlall':'UTF-8'}" />

 

The problem is, when products are viewed under "Categories", the image does not display.

 

The image source writes the correct URL, except the actual image name is missing form the end.

 

For example, a working link woud be: http://localhost:888...hop/img/m/4.jpg

 

Whereas a failed link would be: http://localhost:888...shop/img/m/.jpg

 

I'm sure this is a simple fix, but I'm very new to SQL/Prestashop and would really appreciate it if someone could assist with this.

 

I'm running Prestashop v1.5.4.1

 

Thanks in advance.

 

Rob.

Edited by chops07876 (see edit history)
Link to comment
Share on other sites

I believe you're calling the wrong variable there. Unless you specified it, there is no $manufacturer set for each product in the list (in categories) as far as I know. Try with product.id_manufacturer instead

  • Like 2
Link to comment
Share on other sites

Nicholas,

 

Certainly. Simply add this line of code wherever you want the logo to appear:

 

<img src="{$img_manu_dir}{$product.id_manufacturer}.jpg" alt="{$product.manufacturer_name|escape:'htmlall':'UTF-8'}" title="{$product.manufacturer_name|escape:'htmlall':'UTF-8'}" />

 

You will need to apply styles to the image for formatting.

 

Hope that helps.

 

Rob.

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

Nicholas,

 

Certainly. Simply add this line of code wherever you want the logo to appear:

 

<img src="{$img_manu_dir}{$product.id_manufacturer}.jpg" alt="{$product.manufacturer_name|escape:'htmlall':'UTF-8'}" title="{$product.manufacturer_name|escape:'htmlall':'UTF-8'}" />
You will need to apply styles to the image for formatting.

 

Hope that helps.

 

Rob.

 

 

I tried to use the code above but it doesn't work properly on my prestashop website (1.5.6.1).

 

There is only shown one logo while there are several manufacturers on one page. See goo.gl/VlFiPP for an example. I hope someone could help me out.

Link to comment
Share on other sites

  • 3 weeks later...

Nicholas,

 

Certainly. Simply add this line of code wherever you want the logo to appear:

 

<img src="{$img_manu_dir}{$product.id_manufacturer}.jpg" alt="{$product.manufacturer_name|escape:'htmlall':'UTF-8'}" title="{$product.manufacturer_name|escape:'htmlall':'UTF-8'}" />
You will need to apply styles to the image for formatting.

 

Hope that helps.

 

Rob.

 

Thank you so much :)

Link to comment
Share on other sites

  • 1 month later...

In case someone needs it, this worked for me on 1.5.6.2, i also added an if statement to check if the manufacturer has an image 

{assign var="manpic" value="img/m/{$product_manufacturer->id_manufacturer}.jpg"}
			{if file_exists($manpic)}
			<div class="product_manufacturer" style="margin-bottom:15px;">
				<a style="float:left; display:block;margin-right:40px;" href="{$content_dir}manufacturer.php?id_manufacturer={$product_manufacturer->id_manufacturer}" title="{l s='View all products'}">
				<img src="{$content_dir}img/m/{$product_manufacturer->id_manufacturer}-small_default.jpg" /></a>
				<div style="float:left; display:block;"><strong>View all products from</strong><h3><a href="{$content_dir}manufacturer.php?id_manufacturer={$product_manufacturer->id_manufacturer}">{$product_manufacturer->name}</a></h3></div>
			</div>
			{/if}
Edited by kmichalaros (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 year later...

What should be checked if manufacturer logo's are not being rendered from /img/tmp to /img/su/ ? I see the images in /img/tmp

 

We run PHP_DSO and /img folder is group owned to apache with group write access.

 

All sub-directories within /img are also group owned to apache with group write access.

Edited by Denver Prophit Jr. (see edit history)
Link to comment
Share on other sites

  • 2 months later...

Nevermind I fixed it. The theme developer used the wrong smarty variable for manufacturer folder. Baffles me why PrestaShop allows templates to be sold that are so problematic.

Can you shed light on this? I am using the default template but receiving an error. . Undefined index: product_manufacturer in bla/bla/tools/smarty/sysplugins/smarty_internal_templatebase.php : eval()'d code on line 63. 

HELP ?  :blink:

Link to comment
Share on other sites

Got it to work. Puting it on line 65 right after the quick view section finally showed an image from manufacturer. Thanks!

On another manufacturer note, I've seen some people on here get manufacturers from a category and display them on category pages. example, CD Players category clicked shows Sony, Emerson, GE, Pioneer on the Category page. All of the info out there is for 1.4 versions and does not work for 1.6... I've posted replies on those forum threads, but no response , probably because theyre marked solved' from 2012, ha. If you have any light to shed on this task, I'm eager to hear. Thanks.

Link to comment
Share on other sites

  • 2 months later...

Hi I am using third party module to display products on the homepage.And I am suppose to display supplier logo on the product list and i used the code
 
<img src="{$img_sup_dir}{$product.id_supplier}-medium.jpg" alt="{$product.supplier_name|escape:'htmlall':'UTF-8'}" title="{$product.supplier_name|escape:'htmlall':'UTF-8'}" />

 

but it display only question mark above the product image.Kindly please tell me the php code to acquire the suppliers from the database to that module.

 

Module  that I used enclosed below with screenshot

 

post-938278-0-62289800-1441306020_thumb.png
Link to comment
Share on other sites

  • 7 months later...
  • 7 months later...
  • 2 months later...
  • 3 months later...

Thanks 

 

 

In case someone needs it, this worked for me on 1.5.6.2, i also added an if statement to check if the manufacturer has an image 

{assign var="manpic" value="img/m/{$product_manufacturer->id_manufacturer}.jpg"}
			{if file_exists($manpic)}
			<div class="product_manufacturer" style="margin-bottom:15px;">
				<a style="float:left; display:block;margin-right:40px;" href="{$content_dir}manufacturer.php?id_manufacturer={$product_manufacturer->id_manufacturer}" title="{l s='View all products'}">
				<img src="{$content_dir}img/m/{$product_manufacturer->id_manufacturer}-small_default.jpg" /></a>
				<div style="float:left; display:block;"><strong>View all products from</strong><h3><a href="{$content_dir}manufacturer.php?id_manufacturer={$product_manufacturer->id_manufacturer}">{$product_manufacturer->name}</a></h3></div>
			</div>
			{/if}

Thanks! I use a part for place logo in product.tpl

 

{assign var="manpic" value="img/m/{$product_manufacturer->id_manufacturer}.jpg"}
{if file_exists($manpic)}
<img src="{$content_dir}img/m/{$product_manufacturer->id_manufacturer}-large_default.jpg" alt="{$product_manufacturer->name|escape:'htmlall':'UTF-8'}"/>
{/if}
Link to comment
Share on other sites

  • 1 year later...
On 9/9/2015 at 9:27 AM, kalaiarasan said:

Thank you Nemo for your reply ,I achieved myself what I have expected and you can see the result from my website vanakkamshoppers.com.  And of-course medium size works great 

 

 

Best Regards

VanakkamShoppers.com

Hi,

I am with prestashop 1.6.1.17, and i have used another code, but my "Best Sellers" shows like yours before you get it to work.

 

Can you tell me what code you have used to put it working?

 

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...