Jump to content

Linking manufacturer image to manufacturer website

Recommended Posts

I'm new to prestashop and smarty, so there's a good chance this problem has a really obvious answer. In products.tpl I'm trying to make a picture of the manufacturer link to the manufacturers description, which is the url of their website. I have some code that I wrote knowing it wouldn't work, but just as an outline. What I don't know how to do is get the array of manufacturers into $manufacturers. Is there a way to do that, and if not could you offer any suggestions on other methods? Thanks in advance

{if isset($products)}
<!-- Products list -->
<ul id="product_list" class="clear">
   {$mfg1 = ""}
   {$mfg2 = ""}
{* List of manufacturers *}
{* $manufacturers = *}
{foreach from=$products item=product name=products}
 {* Search list of manufacturers and set the current one *}
 { foreach from=$manufacturers item=$manufacturer }
  { if $product.manufacturer_name|escape:'htmlall':'UTF-8' == $manufacturer.name|escape:'htmlall':'UTF-8'}
{ $product_manufacturer = $manufacturer }
			 {if $smarty.foreach.products.first}<div class = "mfgGroup">{/if}
						   {if $mfg1 == ""}  {* if blank, set and print mfg *}	  {* ben code *}
								 {$mfg1 = $product.manufacturer_name|escape:'htmlall':'UTF-8'}
								 {$mfg2 = $mfg1}{* remember mfg for next loop *}{* ben code *}
								 <div class = "mfgLogo">{* <h2>{$mfg1}</h2> *}<br /><br /><br />{* debug *}<br /><br /><br /><a href="{$product_manufacturer->description}"><img src="{$img_manu_dir}{$product.id_manufacturer}-large.jpg" alt="{$product.manufacturer_name}" title="{$product.manufacturer_name}" /></a></div>
								 {$mfg2 = $product.manufacturer_name|escape:'htmlall':'UTF-8'}{* reset to current prod *}{* ben code *}
								 {if $mfg2 != $mfg1}
									{$mfg1 = $mfg2}
									</div><div class = "mfgGroup">
									<div class = "mfgLogo"><a href="{$product_manufacturer->description}">{* <h2>{$mfg1}</h2> *} <img src="{$img_manu_dir}{$product.id_manufacturer}-large.jpg" alt="{$product.manufacturer_name}" title="{$product.manufacturer_name}" /></a></div>{* print mfg *}

 <li class="ajax_block_product mfgGroup {if $smarty.foreach.products.first}first_item{elseif $smarty.foreach.products.last}last_item{/if} {if $smarty.foreach.products.index % 2}alternate_item{else}item{/if} ">
  <div class="center_block">

Share this post

Link to post
Share on other sites
  • 1 month later...

I'm looking for the same answer, AndyH13. If you get any new details, that would be perfect.


So far, in my theme it's done with text rather than with the manufacturer image. The code is:



{if !$product->manufacturer_name}style="display: none;"{/if} >

<a href="{$link->getmanufacturerLink($product->id_manufacturer, $product->link_rewrite)}" title="{l s='More products from the manufacturer'}">{$product->manufacturer_name|escape:'htmlall':'UTF-8'}</a>

Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More