smicikli Posted March 23, 2010 Share Posted March 23, 2010 Hi!How can I display addresses and product names columns in the Back Office/Orders Tab (AdminOrders)?Sorry my bad english!Thanks!Smicikli Link to comment Share on other sites More sharing options...
smicikli Posted March 24, 2010 Author Share Posted March 24, 2010 I added a row (city) to this code, and appeard a new "city" column. The code (AdminOrders.php): foreach ($states AS $state) $statesArray[$state['id_order_state']] = $state['name']; $this->fieldsDisplay = array( 'id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'new' => array('title' => $this->l('New'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'filter_key' => 'new', 'tmpTableFilter' => true, 'icon' => array(0 => 'blank.gif', 1 => 'news-new.gif'), 'orderby' => false), 'customer' => array('title' => $this->l('Customer'), 'widthColumn' => 160, 'width' => 140, 'filter_key' => 'customer', 'tmpTableFilter' => true), 'city' => array('title' => $this->l('city'), 'widthColumn' => 80, 'width' => 60, 'filter_key' => 'city', 'tmpTableFilter' => true), 'total_paid' => array('title' => $this->l('Total'), 'width' => 70, 'align' => 'right', 'prefix' => '', 'suffix' => '', 'price' => true, 'currency' => true), 'payment' => array('title' => $this->l('Payment'), 'width' => 100), 'osname' => array('title' => $this->l('Status'), 'widthColumn' => 250, 'type' => 'select', 'select' => $statesArray, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'width' => 200), 'date_add' => array('title' => $this->l('Date'), 'width' => 90, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'), 'id_pdf' => array('title' => $this->l('PDF'), 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false)); parent::__construct(); How can I display the customer's address (city) in this column?Thanks!Smicikli Link to comment Share on other sites More sharing options...
dreamworker Posted May 9, 2010 Share Posted May 9, 2010 you have to modify select in $this->_select variable to contain also new column or you could write a callback function to return the address.I used the latter approach when I needed to add carrier icon to orders list in AdminOrders screen. This is what I did(you can use it as inspiration):First I added the column carrier_pdf, that calls function PrintCarrierIcons foreach ($states AS $state) $statesArray[$state['id_order_state']] = $state['name']; $this->fieldsDisplay = array( 'id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'new' => array('title' => $this->l('New'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'filter_key' => 'new', 'tmpTableFilter' => true, 'icon' => array(0 => 'blank.gif', 1 => 'news-new.gif'), 'orderby' => false), 'customer' => array('title' => $this->l('Customer'), 'widthColumn' => 160, 'width' => 140, 'filter_key' => 'customer', 'tmpTableFilter' => true), 'total_paid' => array('title' => $this->l('Total'), 'width' => 70, 'align' => 'right', 'prefix' => '', 'suffix' => '', 'price' => true, 'currency' => true), 'payment' => array('title' => $this->l('Payment'), 'width' => 100), 'osname' => array('title' => $this->l('Status'), 'widthColumn' => 250, 'type' => 'select', 'select' => $statesArray, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'width' => 200), 'carrier_pdf' => array('title' => $this->l('Dop'), 'width' => 20, 'callback' => 'printCarrierIcons', 'orderby' => false, 'search' => false), 'date_add' => array('title' => $this->l('Date'), 'width' => 80, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'), 'id_pdf' => array('title' => $this->l('PDF'), 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false)); parent::__construct(); } Then I modified Orders class (Orders.php) - I added new PrintCarrierIcons function that display the image static public function printCarrierIcons($id_order, $tr) { $order = new Order($id_order); $orderState = OrderHistory::getLastOrderState($id_order); if (!Validate::isLoadedObject($orderState) OR !Validate::isLoadedObject($order)) die(Tools::displayError('Invalid objects!')); echo ''; if ($order->id_carrier==21) echo ''; else if ($order->id_carrier==24) echo ''; else if ($order->id_carrier==25) echo ''; else echo ' '; echo ''; echo ''; } Link to comment Share on other sites More sharing options...
chun Posted June 8, 2010 Share Posted June 8, 2010 i followed the steps.There is errors for "Order.php"However, is there a screenshot of the successful result? Link to comment Share on other sites More sharing options...
dreamworker Posted June 8, 2010 Share Posted June 8, 2010 sorry it doesnt work for you, it does for me, see screenshot Link to comment Share on other sites More sharing options...
Recommended Posts