Jump to content

Recommended Posts

Hi Guys!

 

I'm working on a prestashop 1.6 site using a personalized version of the default bootstrap template.

 

I have a question:

how can I transform the default "show al manufacturers" menu text-list in a menu logo-list?

 

Modify the "blocktopmenu.php" file you'd probably answer. And I'd say "hell yeah, pretty much intuitive!" 

 

Then why on earth do I modify that file and nothing changes on the godforsaken site? :D

 

I found this code, in "/www.mysite.net/themes/default-bootstrap/modules/blocktopmenu/blocktopmenu.php":

// Case to handle the option to show all Manufacturers
case 'ALLMAN':
$link = new Link;
$this->_menu .= '<li><a href="'.$link->getPageLink('manufacturer').'" title="'.$this->l('All manufacturers').'">'.$this->l('All manufacturers').'</a><ul>'.PHP_EOL;
$manufacturers = Manufacturer::getManufacturers();
foreach ($manufacturers as $key => $manufacturer)
$this->_menu .= '<li><a href="'.$link->getManufacturerLink((int)$manufacturer['id_manufacturer'], $manufacturer['link_rewrite']).'" title="'.Tools::safeOutput($manufacturer['name']).'">'.Tools::safeOutput($manufacturer['name']).'</a></li>'.PHP_EOL;
$this->_menu .= '</ul>';
break;

and I assume all I have to to is change this one right?

 

I mean, I've tested this code by adding a simple class or text, like

$this->_menu .= '<li class="yay"><a href...

or

$this->_menu .= '<li>asdasdasd<a href...

but nothing happens when I upload.

 

I tried emptying browser cache, smarty cache, and all that stuff, but nothing.

 

So either I'm an idiot and I got the wrong file since the beginning, or I have no idea why this site is misbehaving.

I mean, if I doodle with the brother ".tpl" file, changes are seen immediately.

Then why is this .php file such a bastard? XD

 

Thanks in advance for reading!

- Joe

 

 

 

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

[RESOLVED]
 
My problem was that I was working on an override file located in the theme directory, and I just found out that you CANNOT override the module php files in prestashop 1.6. This is pretty unfriendly, I'd say, and for this reason I wasted around 16 working hours, stressed fellow coders, and learned something new.
 
Sometimes it's the simplest thing possible, and you don't notice it. Better laugh and not cry! lol
 
Therefore, modifying the ORGINAL PHP FILE in the ORIGINAL MODULES DIRECTORY, you can use image files instead of text.
 
So, recap:
in Prestashop 1.6 search this code in the /modules/blocktopmenu/blocktopmenu.php file:
 

$this->_menu .= '<li><a href="'.$link->getManufacturerLink((int)$manufacturer['id_manufacturer'], $manufacturer['link_rewrite']).'" title="'.Tools::safeOutput($manufacturer['name']).'">'.Tools::safeOutput($manufacturer['name']).'</a></li>'.PHP_EOL;

 
and change it as the_raven kindly suggested as so:

$this->_menu .= '<li><a href="'.$link->getManufacturerLink((int)$manufacturer['id_manufacturer'], $manufacturer['link_rewrite']).'" title="'.Tools::safeOutput($manufacturer['name']).'"><img src="' . __PS_BASE_URI__ . 'img/m/' . (int) $manufacturer['id_manufacturer'] . '.jpg"></a></li>'.PHP_EOL;

 
No overrides, you have to modify the original module. And if you update it, you'll lose your modifications! :D
Thanks for the patience, finally I can continue with my site!

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