miguelangelss4 Posted February 21, 2018 Share Posted February 21, 2018 Hello, I'm trying to add some variable to the product-list.tpl but I'm not able to achieve this. I have tried some things... First in my tpl file I added: {$product.msolla|var_dump} {$msolla|var_dump} And I updated \controllers\front\ProductController.php, function initContent() by adding 'msolla' => 'asdf' in the $this->context->smarty->assign() array argument. Also I added $this->msolla = 'asdfa' in \classes\Product.php Other thing I tried is to adapt this http://nemops.com/lowest-price-prestashop-product-list/#.Wo2OWKiWbcs to my case, with this: class CategoryController extends CategoryControllerCore { public function initContent() { parent::initContent(); $this->context->smarty->assign('msolla', 555); } } Any of this worked. All of this (and combinations between all) are printing a null content for "msolla" variable... What I'm doing wrong? Thanks! Link to comment Share on other sites More sharing options...
Rhobur Posted February 24, 2018 Share Posted February 24, 2018 did you try adding it to CategoryController? Overriding it, recommended. Link to comment Share on other sites More sharing options...
miguelangelss4 Posted February 26, 2018 Author Share Posted February 26, 2018 Hi Rho_Bur, yes, I tried to do this... my CategoryController was my try to overriding this. I put this file \override\controllers\front\CategoryController.php with the code of my first post, but in product-list.tpl file I have {$product.msolla|var_dump} {$msolla|var_dump} And both have a null value... Link to comment Share on other sites More sharing options...
TiaNex Shopping Posted February 26, 2018 Share Posted February 26, 2018 9 hours ago, miguelangelss4 said: Hi Rho_Bur, yes, I tried to do this... my CategoryController was my try to overriding this. I put this file \override\controllers\front\CategoryController.php with the code of my first post, but in product-list.tpl file I have {$product.msolla|var_dump} {$msolla|var_dump} And both have a null value... then what's output of {var_dump($msolla)} Link to comment Share on other sites More sharing options...
miguelangelss4 Posted February 27, 2018 Author Share Posted February 27, 2018 Output is null. Link to comment Share on other sites More sharing options...
djnick Posted May 8, 2020 Share Posted May 8, 2020 try this one {$msolla|@var_dump} 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