Venky967 Posted February 18, 2017 Share 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 Link to comment Share on other sites More sharing options...
BalzoT Posted February 18, 2017 Share Posted February 18, 2017 Yes you have to override adminOrdersController in order to do that. Link to comment Share on other sites More sharing options...
Venky967 Posted February 18, 2017 Author Share 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(); } } Link to comment Share on other sites More sharing options...
BalzoT Posted February 18, 2017 Share 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! Link to comment Share on other sites More sharing options...
Venky967 Posted February 18, 2017 Author Share 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) Link to comment Share on other sites More sharing options...
BalzoT Posted February 18, 2017 Share 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(){ ... } Link to comment Share on other sites More sharing options...
Venky967 Posted February 18, 2017 Author Share 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 Link to comment Share on other sites More sharing options...
BalzoT Posted February 18, 2017 Share 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! Link to comment Share on other sites More sharing options...
Venky967 Posted February 18, 2017 Author Share 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? Link to comment Share on other sites More sharing options...
BalzoT Posted February 18, 2017 Share Posted February 18, 2017 normally no! do you have any cache enabled? Link to comment Share on other sites More sharing options...
Venky967 Posted February 18, 2017 Author Share Posted February 18, 2017 Cache is in disabled mode only. Any modifications to be done in main file or controller file? Thanks. Link to comment Share on other sites More sharing options...
BalzoT Posted February 18, 2017 Share 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! Link to comment Share on other sites More sharing options...
Venky967 Posted February 18, 2017 Author Share 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) Link to comment Share on other sites More sharing options...
BalzoT Posted February 18, 2017 Share 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! Link to comment Share on other sites More sharing options...
Venky967 Posted February 18, 2017 Author Share 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. Link to comment Share on other sites More sharing options...
BalzoT Posted February 18, 2017 Share 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! Link to comment Share on other sites More sharing options...
Nishanthan94 Posted August 22, 2019 Share Posted August 22, 2019 I am searching two days for this solution.thank you bro @BalzoT and @Venky967 Link to comment Share on other sites More sharing options...
Lucas Posted August 7, 2020 Share Posted August 7, 2020 FYI: at least at PS 1.7 you have generic hooks for grid modifiers that allows you to do it. You can reuse existing actions or create your own: https://devdocs.prestashop.com/1.7/development/components/grid/tutorials/work-with-row-actions/ in general you should avoid overrides when possible. Link to comment Share on other sites More sharing options...
Lucas Posted August 7, 2020 Share Posted August 7, 2020 8 hours ago, Lucas said: FYI: at least at PS 1.7 you have generic hooks for grid modifiers that allows you to do it. You can reuse existing actions or create your own: https://devdocs.prestashop.com/1.7/development/components/grid/tutorials/work-with-row-actions/ in general you should avoid overrides when possible. So that looks great but at this point the orders grid is not implemented using this methods yet.... As an alternative, I'd suscribed a custom js using the actionAdminControllerSetMedia hook. That js add the button with a controller link that receive the order id from the row as a parameter. 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