xezus Posted June 6, 2013 Share Posted June 6, 2013 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. 2 Link to comment Share on other sites More sharing options...
vekia Posted June 6, 2013 Share Posted June 6, 2013 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 More sharing options...
xezus Posted June 6, 2013 Author Share Posted June 6, 2013 (edited) I am using 1.5.4 Edited June 6, 2013 by xezus (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted June 6, 2013 Share Posted June 6, 2013 try with code that i pasted above, and below: {$link->getManufacturerLink($id_of_manufacturer)} Link to comment Share on other sites More sharing options...
xezus Posted June 6, 2013 Author Share Posted June 6, 2013 (edited) When I tried this. I got this path http://localhost/prestashop/%7B$link-%3EgetManufacturerLink(1)%7D and this message You do not have the right to access the requested object. Either it is protected against reading, or the server is not readable. Edited June 6, 2013 by xezus (see edit history) Link to comment Share on other sites More sharing options...
xezus Posted June 6, 2013 Author Share Posted June 6, 2013 the module is default blocktopmenu.php Link to comment Share on other sites More sharing options...
vekia Posted June 6, 2013 Share Posted June 6, 2013 can you paste code that you use in .tpl file to achieve what you want? i think that the problem is there Link to comment Share on other sites More sharing options...
xezus Posted June 6, 2013 Author Share Posted June 6, 2013 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); 1 Link to comment Share on other sites More sharing options...
vekia Posted June 6, 2013 Share Posted June 6, 2013 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 More sharing options...
xezus Posted June 6, 2013 Author Share Posted June 6, 2013 (edited) 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 June 6, 2013 by xezus (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted June 6, 2013 Share Posted June 6, 2013 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 More sharing options...
xezus Posted June 6, 2013 Author Share Posted June 6, 2013 Yes, it works. Thank you a lot! Link to comment Share on other sites More sharing options...
vekia Posted June 6, 2013 Share Posted June 6, 2013 you're welcome im going to mark this thread as [solved] regards Link to comment Share on other sites More sharing options...
mohamd.sobhy Posted September 9, 2016 Share Posted September 9, 2016 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now