Jump to content

[solved] How to get manufacturer link in php modul


xezus

Recommended Posts

Hi

 

I need to add to my modul link to manufacturer page

I have part of html which I am sending to html output like this

 

<span>$manufacturer</span>

 

but I need to make it click able. Like this

 

<span><a href="How can i get path of manufacturer in php modul">$manufacturer</a></span>

How could I do this?

I will be glad for any answers.

  • Like 2
Link to comment
Share on other sites

whast PS version?

 

 

public function getManufacturerLink($manufacturer, $alias = null, $id_lang = null)

@param mixed $manufacturer Manufacturer object (can be an ID supplier, but deprecated)
 * @param string $alias
 * @param int $id_lang
 * @return string

 

which mean that you can use {$link->getManufacturerLink()} function

 

regards

Link to comment
Share on other sites

I don't use tpl file. I send this code directly from the php module

 

this is maybe better

 

$this->_menu .= '<span class="manufacturer"><a href="{$link->getManufacturerLink('.$manufacturer_id.')} ">'.$manufacturer_name.'</a></span>';

 

 

and than in hook fucntion

 

$this->smarty->assign('MENU', $this->_menu);

  • Like 1
Link to comment
Share on other sites

so that is the main problem ;)

if you use it in php use this:

$this->_menu .= '<span class="manufacturer"><a href="'.$link->getManufacturerLink('.$manufacturer_id.').'">'.$manufacturer_name.'</a></span>';

Link to comment
Share on other sites

I tried this before but I got

 

 

Notice: Undefined variable: link in C:\xampp\htdocs\prestashop\modules\blocktopmenu\blocktopmenu.php on line 720

 

Fatal error: Call to a member function getManufacturerLink() on a non-object in C:\xampp\htdocs\prestashop\modules\blocktopmenu\blocktopmenu.php on line 720

 

 

I want to call it insite private function getCategory

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

so you haven't got defined $link variable there. try with

$link = new Link();

before you use $link.

 

or instead

$link->getManufacturerLink('.$manufacturer_id.')

 

use the:

$this->context->link->getManufacturerLink('.$manufacturer_id.')

Link to comment
Share on other sites

  • 3 years later...

how i can show manufacturers random ?
 

<li class="{if $smarty.foreach.manufacturer_list.last}last_item{elseif $smarty.foreach.manufacturer_list.first}first_item{else}item{/if}" 
style="padding:6px 0 ;border-bottom: 2px solid #888;">
<a href="{$link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)|escape:'html'}" 
title="{l s='More about %s' sprintf=[$manufacturer.name] mod='mib'}">
<img src="{$content_dir}img/m/{$manufacturer.image_url}" alt="{$manufacturer.name|escape:'html':'UTF-8'}"/>
</a>
</li>
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...