prestsahop: edit variables

I wanted to change the Manufacturer Name variable, to eliminate the spaces and replace it with a dash.

I tried doing this with PHP, but it was terrible to do it, as there were multiple places to change it, and it some places impossible.

To do it via PHP Variable I had to change it in


  • Product Page
  • Manufacturer Page
  • Viewed Product Sidebar
  • Front Page New Arrivals

On each place it needs to be changed, with a different code and a in a different place.


Product Page

Needs to be changed onĀ -> ProductController.php


$manuf_name_nospace = str_replace(" ","-",$manufacturer->name);
$this->context->smarty->assign('manuf_name_nospace', $manuf_name_nospace);



Manufacturer Page

Needs to be changed on -> ManufacturerController.php

Code: Add in line 89

$this->context->smarty->assign('manuf_name_nospace', str_replace(" ","-",$this->manufacturer->name));



Viewed Product Sidebar

Needs to be changed on -> blockviewed.php

Code: Add in line 124

$obj->manuf_name_nospace = str_replace(" ","-",$productsImagesArray[$productViewed]['ManufacturerName']);

Replace on tpl.






Front Page New Arrivals

Apparently needs to be changed on -> blocknewproducts.php


$this->context->smarty->assign('manuf_name_nospace', str_replace(" ","-",'aaaaa-bbbbb'));

I was able to pass a Dummy Smarty variable, but was not able to pass the Manufacturer Name variable.

This did not work to me.


At the end, I decided to just do the replacement using Smarty Language instead of PHP, so the calculation is done directly on the .tpl file and not on the PHP.


Leave a Reply

Your email address will not be published. Required fields are marked *