Jump to content
Venky967

How to display a button in Prestashop back office orders page?

Recommended Posts

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();

    }

 

 

}

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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

post-1368481-0-19846200-1487407594_thumb.jpg

Edited by Venky967 (see edit history)

Share this post


Link to post
Share on other sites

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(){ ... }

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Cache is in disabled mode only. :)

 

Any modifications to be done in main file or controller file?

 

Thanks.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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 by Venky967 (see edit history)

Share this post


Link to post
Share on other sites

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! 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More