cyberespia Posted August 6, 2016 Share Posted August 6, 2016 (edited) I need to get the SUPPLIER ID, for this I add the following to: In /controllers/front/ProductController.php 'product_supplier' => new Supplier((int)$this->product->id_supplier, $this->context->language->id), just after: 'product_manufacturer' => new Manufacturer((int)$this->product->id_manufacturer, $this->context->language->id), With this I can already use {$product_supplier->id} in product.tpl What I need is this change but in /override/ folder. I've tried the following code in /override/controllers/front/ProductController.php but it did not work <?php class ProductControllerCore extends FrontController { public function initContent() { $this->context->smarty->assign(array( 'product_supplier' => new Supplier((int)$this->product->id_supplier, $this->context->language->id), )); $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); } } I would appreciate any help in this regard. Edited August 6, 2016 by cyberespia (see edit history) Link to comment Share on other sites More sharing options...
ventura Posted August 6, 2016 Share Posted August 6, 2016 You must add the complete function´s content in the override file Link to comment Share on other sites More sharing options...
cyberespia Posted August 6, 2016 Author Share Posted August 6, 2016 You must add the complete function´s content in the override file if possible with an example from already thank you for your attention, Ventura Link to comment Share on other sites More sharing options...
ventura Posted August 6, 2016 Share Posted August 6, 2016 Sorry I didn't understand well. Something like that should work <?php class ProductController extends ProductControllerCore { public function initContent() { parent::initContent(); if (!$this->errors) { $product_supplier = new Supplier((int)$this->product->id_supplier, $this->context->lang->id); $this->context->smarty->assign('product_supplier', $product_supplier); } } } and delete the file cache/class_index.php Link to comment Share on other sites More sharing options...
cyberespia Posted August 8, 2016 Author Share Posted August 8, 2016 Sorry I didn't understand well. Something like that should work <?php class ProductController extends ProductControllerCore { public function initContent() { parent::initContent(); if (!$this->errors) { $product_supplier = new Supplier((int)$this->product->id_supplier, $this->context->language->id); $this->context->smarty->assign('product_supplier', $product_supplier); } } } and delete the file cache/class_index.php Thank you very much, it has worked properly, only a small correction: lang->id must be language->id Link to comment Share on other sites More sharing options...
ventura Posted August 8, 2016 Share Posted August 8, 2016 Yo are welcome. Thank you very much, it has worked properly, only a small correction: lang->id must be language->id Indeed. I will edit it now with the correct value. thank you for warning 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