Venky967 1 Posted February 18, 2017 (edited) I want to add a text or button in orders page through my custom module without changing any core files? Edited February 18, 2017 by Venky967 (see edit history) 1 Quote Share this post Link to post Share on other sites
BalzoT 17 Posted February 18, 2017 Yes you have to override adminOrdersController in order to do that. Quote Share this post Link to post Share on other sites
Venky967 1 Posted February 18, 2017 Thank you I have extended my class .Now what must be included inside this in order to display a text or button. class TuconfigureController extends AdminOrdersController { public function __construct() { $this->bootstrap = true; $this->lang = (!isset($this->context->cookie) || !is_object($this->context->cookie)) ? intval(Configuration::get('PS_LANG_DEFAULT')) : intval($this->context->cookie->id_lang); parent::__construct(); } public function initContent() { parent::initContent(); } } Quote Share this post Link to post Share on other sites
BalzoT 17 Posted February 18, 2017 Can you be a little more spesific on what you would like to add and where? Also please tell on what prestashop edition you are making the changes! Quote Share this post Link to post Share on other sites
Venky967 1 Posted February 18, 2017 (edited) I am using prestashop 1.7.0.4 when we view any one of the orders I want to add a button in shipping address block. I am specifying sample url where you can have an idea regarding page that i need to override controller=AdminOrders&id_order=5&vieworder&token=4e10ca68658d3e87902e5faaf8b4ef5c Edited February 18, 2017 by Venky967 (see edit history) Quote Share this post Link to post Share on other sites
BalzoT 17 Posted February 18, 2017 At first, I thought you wanted to change the order list that's why I said you needed to change the orders controller. The file you are searching to alter is the ADMIN_DIRECTORY/themes/default/template/controllers/orders/helpers/view/view.tpl There you can add your button and then if you want to bind it with an ajax call you should create in your override a function like the following public function ajaxProcessMyFunction(){ ... } Quote Share this post Link to post Share on other sites
Venky967 1 Posted February 18, 2017 Thanks for your immediate replies. Sorry that was not my question's intension.Let me clear it from beginning. I have created a module named "Mymodule".Inside the module i have folders like Mymodule controller(folder) admin samplefile.php front override(folder) views(folder) mymodule.php file. Above is my modules hierarchy My intension was to add a button below the shipping address through my own module without disturbing prestashop core files. Is it possible ? If yes,please provide indetail regarding which files must be created inside the folders. Hope you understood.Thanks Quote Share this post Link to post Share on other sites
BalzoT 17 Posted February 18, 2017 In your modules override folder add \controllers\admin\templates\orders\helpers\view\view.tpl in that tpl copy the code from ADMIN_DIRECTORY/themes/default/template/controllers/orders/helpers/view/view.tpl and make the changes you wish. Re-install your module or just add manually the tpl file in the override folder of the PrestaShop installation and you are good to go! Quote Share this post Link to post Share on other sites
Venky967 1 Posted February 18, 2017 Thank you Did the same thing you asked but didn't see any changes in the orders page. Things I have done: 1. Copied the file from ADMIN_DIRECTORY/themes/default/template/controllers/orders/helpers/view/ and pasted in my module .../view/ (folder). 2. Created anchor tag next to edit in shipping address block. 3. Reinstalled my module and clicked on orders tab. But found no change. Do we need to call this view.tpl from any function? Quote Share this post Link to post Share on other sites
BalzoT 17 Posted February 18, 2017 normally no! do you have any cache enabled? Quote Share this post Link to post Share on other sites
Venky967 1 Posted February 18, 2017 Cache is in disabled mode only. Any modifications to be done in main file or controller file? Thanks. Quote Share this post Link to post Share on other sites
BalzoT 17 Posted February 18, 2017 there is no modification to the controller needed at this point. Please check if the file ROOT_DIRECTORY/override\controllers\admin\templates\orders\helpers\view/view.tpl has been created. If not do it manually! Quote Share this post Link to post Share on other sites
Venky967 1 Posted February 18, 2017 (edited) Thanks Balzo you are right.. But I don't want to alter any files in prestashop root directory. Everthing must be affected dynamically from my custom module. Edited February 18, 2017 by Venky967 (see edit history) Quote Share this post Link to post Share on other sites
BalzoT 17 Posted February 18, 2017 well, that is the point of the override folder!Let me explain it to you. Everything you have in the override folder of your modules on the installation should be copied inside the override folder of Prestashop. Prestashop does this automatically when you install the module but in this case, I don't know why it didn't. So feel free to add anything to the override folder! Quote Share this post Link to post Share on other sites
Venky967 1 Posted February 18, 2017 Thank you very much for your patience. Can you please help me how to add dynamically the files in ROOT_DIRECTORY/override/ folder by installing my custom module. So what changes should i do in my custom module to get this. Quote Share this post Link to post Share on other sites
BalzoT 17 Posted February 18, 2017 Normally PrestaShop does this automatically when you install the module. There is a case though that it doesn't. This happens when another module has already created the same override so we have a conflict. My advice is to uninstall and delete the module from PrestaShop and then try reinstalling it if you have the correct file structure the override will be made! Quote Share this post Link to post Share on other sites
Nishanthan94 0 Posted August 22 I am searching two days for this solution.thank you bro @BalzoT and @Venky967 Quote Share this post Link to post Share on other sites