desarrollosdanielec Posted January 3, 2014 Share Posted January 3, 2014 (edited) Hi, I want to use the product vars in a custom module. In my controller I have this: <?php class producttopdfdisplayModuleFrontController extends ModuleFrontController { public function initContent() { parent::initContent(); $this->context->smarty->assign( array( 'my_module_name' => Configuration::get('MYMODULE_NAME'), 'my_module_link' => $this->context->link->getModuleLink('producttopdf', 'display') ) ); $this->setTemplate('display.tpl'); } } but I can`t use $product->id for example. I need to use the product name, sku, images, description, etc.Thanks for you time. Edited January 16, 2014 by vekia (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 3, 2014 Share Posted January 3, 2014 you have to pass $product variable to smarty array, something like: $product = new Product(12); $this->context->smarty->assign(array( 'my_module_name' => Configuration::get('MYMODULE_NAME'), 'product' => $product, 'my_module_link' => $this->context->link->getModuleLink('producttopdf', 'display') )); where the 12 is a product ID number you want to display. 1 Link to comment Share on other sites More sharing options...
desarrollosdanielec Posted January 10, 2014 Author Share Posted January 10, 2014 Thank you vekia. If I show $product->id I get the product id but don`t happend the same with $product->name or $product->descripction, in this cases I get "Array". Link to comment Share on other sites More sharing options...
vekia Posted January 10, 2014 Share Posted January 10, 2014 it's because you have to define language code above was only a simple example, take a look: $product = new Product(12); use this: $product = new Product(12,full,$this->context->language>id); sorry for the confusion 1 Link to comment Share on other sites More sharing options...
desarrollosdanielec Posted January 16, 2014 Author Share Posted January 16, 2014 Thank you very much vekia, works perfect. Link to comment Share on other sites More sharing options...
vekia Posted January 16, 2014 Share Posted January 16, 2014 thank you for information i marked whole topic as [solved] with regards, Milos Link to comment Share on other sites More sharing options...
Recommended Posts