ava8c Posted March 30, 2016 Share Posted March 30, 2016 Hi, I would like to edit the orders page template, adding a column, but I can't find the tpl file. Could someone help me? thanks Link to comment Share on other sites More sharing options...
timoraes Posted April 7, 2016 Share Posted April 7, 2016 Me too..someone? Link to comment Share on other sites More sharing options...
sting5 Posted October 4, 2016 Share Posted October 4, 2016 Same here - anyone able to help...? Link to comment Share on other sites More sharing options...
rocky Posted October 5, 2016 Share Posted October 5, 2016 You can create override/controllers/admin/AdminOrdersController.php and add columns to $this->fields_list. For example, if you wanted to add a "Newsletter" column, use the following code: <?php class AdminOrdersController extends AdminOrdersControllerCore { public function __construct() { parent::__construct(); $this->fields_list['newsletter'] = array( 'title' => $this->l('Newsletter'), 'filter_key' => 'c!newsletter', 'callback' => 'displayNewsletter' ); } public function displayNewsletter($value) { return $value ? $this->l('Yes') : $this->l('No'); } } This gets the newsletter column from the customer table, displays the translatable title "Newsletter" and then calls the displayNewsletter function to format the value to make it more readable. 1 Link to comment Share on other sites More sharing options...
sting5 Posted October 6, 2016 Share Posted October 6, 2016 (edited) Hi Rocky, thanks for good editing tip. I hope I can throw another question same way - is there a way to change the color of the orer list rows according to the order status - like in older version of Prestashop? For example, if the status of the order has green color, the whole order row would be green instead of just the bubble around the status word? I've found that {main_dir}\themes\default\template\helpers\list\list_content.tpl has something to do with it: {foreach $list AS $index => $tr} <tr{if $position_identifier} id="tr_{$position_group_identifier}_{$tr.$identifier}_{if isset($tr.position['position'])}{$tr.position['position']}{else}0{/if}"{/if} class="{if isset($tr.class)}{$tr.class}{/if} {if $tr@iteration is odd by 1}odd{/if}"{if isset($tr.color) && $color_on_bg} style="background-color: {$tr.color}"{/if} > I've changed it to: {foreach $list AS $index => $tr} <tr{if $position_identifier} id="tr_{$position_group_identifier}_{$tr.$identifier}_{if isset($tr.position['position'])}{$tr.position['position']}{else}0{/if}"{/if} class="{if isset($tr.class)}{$tr.class}{/if} {if $tr@iteration is odd by 1}odd{/if}"{if isset($params.color) && isset($tr[$params.color])} style="background-color:{$tr[$params.color]};color:{if Tools::getBrightness($tr[$params.color]) < 128}white{else}#383838{/if}"{/if} But the output of the change in this file gives empty "background-color:" property, seems that the coding does not know what $tr[$params.color] is, but it's strange because the code is used few rows after to color the status cell. I would really appreciate the help, because this would greatly help my employees not to mix up or miss orders. EDIT: I've managed to find the solution here! https://www.prestashop.com/forums/topic/214749-solved-changing-order-color-in-prestashop-15-back-office/ Edited October 6, 2016 by sting5 (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted October 6, 2016 Share Posted October 6, 2016 Sure, you can add the following to the bottom of admin/themes/default/template/helpers/list/list_content.tpl: <script type="text/javascript"> $('.color_field').each(function() { $(this).parent().parent().children('td').css('background-color', $(this).css('background-color')); $(this).parent().parent().children('td').css('color', getBrightness($(this).css('background-color')) < 128 ? 'white' : '#383838'); }); function getBrightness(color) { var rgb = color.substring(4, color.length-1).replace(/ /g, '').split(','); return ((rgb[0] * 299) + (rgb[1] * 587) + (rgb[2] * 114)) / 1000; } </script> Link to comment Share on other sites More sharing options...
LauraPresta Posted July 12, 2018 Share Posted July 12, 2018 hello guys, im a bit stuck.. i would to add a prefix on order reference through this file only : admin/themes/default/template/helpers/list/list_content.tpl But damn, i cant figure out how to do because it seems very generic file pour a lot of purpose 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