pixeliza Posted June 3, 2012 Share Posted June 3, 2012 (edited) Hi there, I'm trying to create a new tab in the Adminproducts page, the one your have information, price, SEO, etc. I got to create the extra tab 'PaymentLimit' with the class override in /override/controllers/admin/AdminProductsController.php class AdminProductsController extends AdminProductsControllerCore { protected $available_tabs = array( 'Informations' => 0, 'Pack' => 7, 'VirtualProduct' => 8, 'Prices' => 1, 'Seo' => 2, 'Associations' => 3, 'Images' => 9, 'Shipping' => 4, 'Combinations' => 5, 'Features' => 10, 'Customization' => 11, 'Attachments' => 12, 'Quantities' => 6, 'Suppliers' => 13, 'Warehouses' => 14, 'PaymentLimit' => 15 ); public function __construct() { ... // @since 1.5 : translations for tabs $this->available_tabs_lang = array ( 'Informations' => $this->l('Information'), 'Pack' => $this->l('Pack'), 'VirtualProduct' => $this->l('Virtual Product'), 'Prices' => $this->l('Prices'), 'Seo' => $this->l('SEO'), 'Images' => $this->l('Images'), 'Associations' => $this->l('Associations'), 'Shipping' => $this->l('Shipping'), 'Combinations' => $this->l('Combinations'), 'Features' => $this->l('Features'), 'Customization' => $this->l('Customization'), 'Attachments' => $this->l('Attachments'), 'Quantities' => $this->l('Quantities'), 'Suppliers' => $this->l('Suppliers'), 'Warehouses' => $this->l('Warehouses'), 'PaymentLimit' => $this->l('PaymentLimit'), ); ... } With this I create the PaymentLimit tab, but I can't get it to load the paymentlimit.tpl I have created in admin/themes/default/template/controllers/products. Ok, I forgot to create the function in the override file to indicate the tpl , now the .tpl is showing. public function initFormPaymentLimit($product) { …. } I hope this helps somebody. Edited June 3, 2012 by pixeliza (see edit history) 3 Link to comment Share on other sites More sharing options...
El Patron Posted June 3, 2012 Share Posted June 3, 2012 If you are writing a module you can use this code: //to install if( !$this->adminInstall()) return FALSE; //to uninstall $tab = new Tab(Tab::getIdFromClassName('AdminContactMultiShop')); if (!$tab->delete()) return false; private function adminInstall() { if (!$idTab = Tab::getIdFromClassName('yourClassNameInModuleFolder')) { $tab = new Tab(); $tab->class_name = 'yourClassNameInModuleFolder'; $tab->module = 'yourmodulename'; $tab->id_parent = 9; //ID OF THE PARENT TAB, WE USE HARD CODED AS getIdFromClass parent did not work $languages = Language::getLanguages(false); foreach ($languages as $lang) $tab->name[$lang['id_lang']] = 'YourTabName'; $res &= $tab->save(); $tab->name[(int)(Configuration::get('PS_LANG_DEFAULT'))] = $this->l('yourClassNameInModuleFolder'); } return TRUE; } 1 Link to comment Share on other sites More sharing options...
rytiz2873 Posted November 6, 2012 Share Posted November 6, 2012 (edited) Hi, I'm creating module to add additional tab into edit product page called "Instructiuons". I have overrided AdminProductsController, but i have problems with tab tpl file, i dont know how to install it by module. It must be like "SEO" tab and ect. Can you help? Edited November 6, 2012 by rytiz2873 (see edit history) Link to comment Share on other sites More sharing options...
akshik Posted December 1, 2012 Share Posted December 1, 2012 Hello, The post is really helpful and I was able to add a tab with ease. I'm doing this through module and currently I'm facing a problem here in placing the tpl file(like paymentlimit.tpl). Actually I don't know where to place that file in my module and now when I'm clicking on my custom tab it is giving me following error Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'C:\xampp\htdocs\prestashop\admin1/themes/default\template\PaymentLimit.tpl'' in C:\xampp\htdocs\prestashop\tools\smarty\sysplugins\smarty_internal_templatebase.php So please suggest me where and in which folders(in my module) I should place that tpl file. Link to comment Share on other sites More sharing options...
El Patron Posted December 1, 2012 Share Posted December 1, 2012 (edited) Hi akshik, this document explains how to use and where to place .tpl files. I don't write any modules at that level so not much help. http://doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module Edited December 1, 2012 by elpatron (see edit history) Link to comment Share on other sites More sharing options...
akshik Posted December 3, 2012 Share Posted December 3, 2012 Hello Elpatron, Thanks for the reply, I was able to add and show the .tpl file by placing it in admin1/themes/default/template/controllers/products folder where rest of the tpl files for products tab page are placed. But thats not the standard place I think and I want to place that file in my module folder. I tried the link, you have suggested but still no progress. In your first reply you have given some code, it will be very helpful if you shed some light on that, FYI : I'm developing the module for 1.5 Link to comment Share on other sites More sharing options...
El Patron Posted December 3, 2012 Share Posted December 3, 2012 Hello Elpatron, Thanks for the reply, I was able to add and show the .tpl file by placing it in admin1/themes/default/template/controllers/products folder where rest of the tpl files for products tab page are placed. But thats not the standard place I think and I want to place that file in my module folder. I tried the link, you have suggested but still no progress. In your first reply you have given some code, it will be very helpful if you shed some light on that, FYI : I'm developing the module for 1.5 Honestly I don't know if it would work the same for .tpl's as it did for a php form. In my module I used a php form. My tab for (PHP) resided in my module directory....Sorry I am not much more help.... Link to comment Share on other sites More sharing options...
akshik Posted December 3, 2012 Share Posted December 3, 2012 Thanks for the comment anyway. I'm still working on it and if I come up with a solution I'll post that here. 1 Link to comment Share on other sites More sharing options...
akshik Posted December 11, 2012 Share Posted December 11, 2012 I got it to work by moving the tpl file from my module folder to admin1/themes/default/template/controllers/products folder I placed the code of moving file in module's installation function Link to comment Share on other sites More sharing options...
velizar Posted March 5, 2013 Share Posted March 5, 2013 I got it to work by moving the tpl file from my module folder to admin1/themes/default/template/controllers/products folder I placed the code of moving file in module's installation function hi , can you please explain how you did it step by step ? Link to comment Share on other sites More sharing options...
Indiesservice Posted March 29, 2013 Share Posted March 29, 2013 hi, please explain the step by step solve the that problems Link to comment Share on other sites More sharing options...
Recommended Posts