ru5hm3 Posted May 6, 2021 Share Posted May 6, 2021 Hello, i am using prestashop 1.6.1.23 and i am a newbie and i need some help. I want to add a new field in bo at orders where it should be show who of the employees modifies the status of the order. or if it possible to asign at status messages the employee who modifies the status of the order. "delivery" by "employee name" is someone who have try this? and solve it? Link to comment Share on other sites More sharing options...
Janett Posted May 6, 2021 Share Posted May 6, 2021 (edited) Hello, It's easy to add a column with a little module. Inside your modules folder, create a folder named "displayorderemployee" and a file named displayorderemployee.php and copy this inside. After go to back office and install the module. <?php if (!defined('_PS_VERSION_')) { exit; } class DisplayOrderEmployee extends Module { public function __construct() { $this->name = 'displayorderemployee'; $this->tab = 'administration'; $this->version = '1.0.0'; $this->author = 'Janett'; $this->need_instance = 0; $this->ps_versions_compliancy = [ 'min' => '1.6.1.0', 'max' => '1.7.6.99', ]; parent::__construct(); $this->displayName = $this->l('Display employee on Orders list'); $this->description = $this->l('Adds employee on Order list'); } public function install() { return parent::install() && $this->registerHook('actionAdminOrdersListingFieldsModifier'); } public function hookActionAdminOrdersListingFieldsModifier($params) { if (isset($params['select'])) { $params['select'] .= ', e.id_employee, CONCAT(LEFT(e.firstname, 1), \'. \', e.lastname) AS employee'; } if (isset($params['join'])) { $params['join'] .= 'LEFT JOIN ' . _DB_PREFIX_ . 'order_history AS oh ON (a.id_order = oh.id_order AND a.current_state = oh.id_order_state)'; $params['join'] .= 'LEFT JOIN ' . _DB_PREFIX_ . 'employee AS e ON (e.id_employee = oh.id_employee)'; } $list = []; $employees = Employee::getEmployees(); if (!empty($employees)) { foreach ($employees as $employee) { $list[(int) $employee['id_employee']] = substr($employee['firstname'], 0, 1) . ' ' . $employee['lastname']; } } $params['fields']['employee'] = [ 'title' => $this->l('Employee'), 'filter_key' => 'e!id_employee', 'order_key' => 'e!id_employee', 'type' => 'select', 'list' => $list, ]; } } Edited May 6, 2021 by Janett (see edit history) 1 1 Link to comment Share on other sites More sharing options...
ru5hm3 Posted May 7, 2021 Author Share Posted May 7, 2021 10 hours ago, Janett said: Hello, It's easy to add a column with a little module. Inside your modules folder, create a folder named "displayo thank you for help, i ll make a backup of the site and install it on a machine then i'll add the module, not going live directly, i ve tryed to modify AdminOrdersController.php" inside override/controllers/admin and my website go down. from this post Link to comment Share on other sites More sharing options...
KamikStudio Posted May 7, 2021 Share Posted May 7, 2021 (edited) @Janett On 1.7.6.4 it doesn't work; / Edited May 7, 2021 by KamikStudio (see edit history) Link to comment Share on other sites More sharing options...
Janett Posted May 7, 2021 Share Posted May 7, 2021 7 minutes ago, KamikStudio said: On 1.7.6.4 it doesn't work; / Do you have more info ? What's doesn't work ? I tested on 1.7.6.4 and it works well : a new column Employee is displayed on Order list Link to comment Share on other sites More sharing options...
KamikStudio Posted May 7, 2021 Share Posted May 7, 2021 However, everything is fine It works, thanks! 1 Link to comment Share on other sites More sharing options...
ru5hm3 Posted May 10, 2021 Author Share Posted May 10, 2021 i test it live. it works! thank you! 1 Link to comment Share on other sites More sharing options...
ru5hm3 Posted May 12, 2021 Author Share Posted May 12, 2021 i ve added the module but my orders are duplicated. is because is used order_history DB?! Link to comment Share on other sites More sharing options...
Janett Posted May 12, 2021 Share Posted May 12, 2021 Yes, it's because you have some orders with the same order state multiple time. For example : I forget this case, sorry Link to comment Share on other sites More sharing options...
ru5hm3 Posted May 13, 2021 Author Share Posted May 13, 2021 is there any chance to eliminate this error :D? atm i disable the module. Link to comment Share on other sites More sharing options...
myhappyidea Posted August 7, 2023 Share Posted August 7, 2023 I tried to installed this on 1.7.7.5 and it says its not compatible with this version of presta. 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