Jump to content

Override Back Office Order View


Recommended Posts

Hi,

 

I'm trying to implement some custom functions to streamline the management of orders in the prestashop back office.

 

The bit I am stuck on is figuring out how to add visual buttons into the back office order view page, the page that displays all the information and functionalities related to one specific order.

 

I have already overridden the tpl at: %web_root%\admin\themes\default\template\controllers\orders\helpers\view\view.tpl

to place some buttons near the top in the Order div section.

 

However based on what I've researched elsewhere and the way I had to override the AdminOrdersController's construct function and modify the sql _join and fields_list variables so as to show an additional field in the back office order list page that displays all the orders in a list. I can't help but feel overriding the helper tpl is the wrong way to go about modifying the page I need to.

 

Is there a helper function in some other file somewhere? I've checked the AdminController and couldn't find anything related to the vieworder page

 

Thanks in advance

Alex

Edited by a1eio (see edit history)
Link to comment
Share on other sites

If you don't need any new information from the database (or php processed) then the view override is enough.

Otherwise you need to override the RenderView() method of that controller, and actually copy the original in the override, instead of calling the parent. Otherwise the variables you assign will be overridden

Link to comment
Share on other sites

Thanks for the advice, I think to accomplish what I need to I'll have to modify the view tpl and the renderView method in the AdminOrdersController.

 

When you say copy the original do you mean to override a controller using the overrides folder so I can modify the renderView function, I'll need to copy the entire renderView function from the original controller into the override controller instead of calling the parent at the beginning and then adding my stuff after?

 

EDIT: Never mind I think I see why calling the parent::renderView in my override wouldn't work without including the original renderView

 

Thanks for the help

Alex

Edited by a1eio (see edit history)
Link to comment
Share on other sites

O.k thanks for the help so far

 

I've got something that seems to work in code but to test it visually I'm trying to figure out how to override the .tpl file I need to in my module or whether I should use php to include a view template that I want to use (copied from original source to module folder and modified) in my overridden renderView function?

 

These are the paths to try be a bit more clear as so far I'm a bit confused.

view that I need to override www/admin/themes/default/templates/controllers/orders/helpers/view/view.tpl

is already an override of: www/admin/themes/default/template/helpers/view/view.tpl

My module is located in the usual place, www/modules/mymodule

My current view.tpl override (before trying to move everything to mymodule): www/override/controllers/admin/templates/orders/helpers/view/view.tpl

 

Is it possible to place a modified view .tpl in the correct folders in mymodule/override/ just like the www/override/ folder?

 

Thanks again!

Alex

 

 

Note: I should probably add the reason I want to override the order view is to add some buttons that call my overridden functions

Edited by a1eio (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...