From 23fd56583eb70d901fb49d967eb8245ffdb51481 Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Thu, 3 Nov 2011 17:49:30 +0000 Subject: [PATCH] // change to price parameter in list --- .../template/helper/list/list_header.tpl | 6 +-- classes/HelperList.php | 37 ++++++++++--------- .../admin/AdminCustomersController.php | 10 ++--- controllers/admin/AdminOrdersController.php | 8 ++-- controllers/admin/AdminProductsController.php | 4 +- .../admin/AdminRangePriceController.php | 4 +- controllers/admin/AdminSearchController.php | 2 +- controllers/admin/AdminStockMvtController.php | 2 +- 8 files changed, 38 insertions(+), 35 deletions(-) diff --git a/admin-dev/themes/template/helper/list/list_header.tpl b/admin-dev/themes/template/helper/list/list_header.tpl index aa8c1a876..ea168410d 100644 --- a/admin-dev/themes/template/helper/list/list_header.tpl +++ b/admin-dev/themes/template/helper/list/list_header.tpl @@ -174,8 +174,8 @@ {elseif $params.type == 'date' || $params.type == 'datetime'} - {l s='From'}
- {l s='To'} + {l s='From'}
+ {l s='To'} {elseif $params.type == 'select'} {if isset($params.filter_key)} {/if} {else} - + {/if} {/if} diff --git a/classes/HelperList.php b/classes/HelperList.php index ffc50a811..8400e7f92 100644 --- a/classes/HelperList.php +++ b/classes/HelperList.php @@ -229,7 +229,7 @@ class HelperListCore extends Helper if (method_exists($this->context->controller, $method_name)) $this->_list[$index][$action] = $this->context->controller->$method_name($token, $id); - else if (method_exists($this, $method_name)) + elseif (method_exists($this, $method_name)) $this->_list[$index][$action] = $this->$method_name($token, $id); } @@ -259,9 +259,9 @@ class HelperListCore extends Helper Tools::getValue('id_product') ); } - else if (isset($params['activeVisu'])) + elseif (isset($params['activeVisu'])) $this->_list[$index][$key] = (bool)$tr[$key]; - else if (isset($params['position'])) + elseif (isset($params['position'])) { $this->_list[$index][$key] = array( 'position' => $tr[$key], @@ -273,7 +273,7 @@ class HelperListCore extends Helper '&way=0&position='.((int)$tr['position'] - 1).'&token='.$this->token ); } - else if (isset($params['image'])) + elseif (isset($params['image'])) { // item_id is the product id in a product image context, else it is the image id. $item_id = isset($params['image_id']) ? $tr[$params['image_id']] : $id; @@ -287,24 +287,27 @@ class HelperListCore extends Helper $this->_list[$index][$key] = cacheImage($path_to_image, $this->table.'_mini_'.$item_id.'.'.$this->imageType, 45, $this->imageType); } - else if (isset($params['icon']) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default']))) + elseif (isset($params['icon']) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default']))) $this->_list[$index][$key] = isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default']; - else if (isset($params['price'])) - { - $currency = isset($params['currency']) ? Currency::getCurrencyInstance($tr['id_currency']) : $this->context->currency; - $this->_list[$index][$key] = Tools::displayPrice($tr[$key], ($currency), false); - } - else if (isset($params['float'])) + elseif (isset($params['float'])) $this->_list[$index][$key] = rtrim(rtrim($tr[$key], '0'), '.'); - else if (isset($params['type']) && $params['type'] == 'date') - $this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id); - else if (isset($params['type']) && $params['type'] == 'datetime') - $this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id, true); - else if (isset($tr[$key])) + elseif (isset($params['type'])) + { + if ($params['type'] == 'price') + { + $currency = isset($params['currency']) ? Currency::getCurrencyInstance($tr['id_currency']) : $this->context->currency; + $this->_list[$index][$key] = Tools::displayPrice($tr[$key], $currency, false); + } + elseif ($params['type'] == 'date') + $this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id); + elseif ($params['type'] == 'datetime') + $this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id, true); + } + elseif (isset($tr[$key])) { if ($key == 'price') $echo = round($tr[$key], 2); - else if (isset($params['maxlength']) && Tools::strlen($tr[$key]) > $params['maxlength']) + elseif (isset($params['maxlength']) && Tools::strlen($tr[$key]) > $params['maxlength']) $echo = ''.Tools::substr($tr[$key], 0, $params['maxlength']).'...'; else $echo = $tr[$key]; diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 5e0ca17bc..5a6d6d258 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -58,11 +58,11 @@ class AdminCustomersControllerCore extends AdminController 'id_customer' => array( 'title' => $this->l('ID'), 'align' => 'center', - 'width' => 25 + 'width' => 20 ), 'id_gender' => array( 'title' => $this->l('Gender'), - 'width' => 50, + 'width' => 70, 'align' => 'center', 'icon' => $genders_icon, 'orderby' => false, @@ -84,7 +84,7 @@ class AdminCustomersControllerCore extends AdminController ), 'age' => array( 'title' => $this->l('Age'), - 'width' => 50, + 'width' => 20, 'search' => false, 'align' => 'center' ), @@ -114,13 +114,13 @@ class AdminCustomersControllerCore extends AdminController ), 'date_add' => array( 'title' => $this->l('Registration'), - 'width' => 70, + 'width' => 150, 'type' => 'date', 'align' => 'right' ), 'connect' => array( 'title' => $this->l('Connection'), - 'width' => 60, + 'width' => 100, 'type' => 'datetime', 'search' => false ) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 0ea95440d..a2a842990 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -63,12 +63,12 @@ class AdminOrdersControllerCore extends AdminController $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), + 'customer' => array('title' => $this->l('Customer'), 'filter_key' => 'customer', 'tmpTableFilter' => true), + 'total_paid' => array('title' => $this->l('Total'), 'width' => 70, 'align' => 'right', 'prefix' => '', 'suffix' => '', 'type' => 'price', 'currency' => true), 'payment' => array('title' => $this->l('Payment'), 'width' => 100), - 'osname' => array('title' => $this->l('Status'), 'widthColumn' => 230, 'type' => 'select', 'list' => $statesArray, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'width' => 200), + 'osname' => array('title' => $this->l('Status'), 'width' => 230, 'type' => 'select', 'list' => $statesArray, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'width' => 200), 'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'), - 'id_pdf' => array('title' => $this->l('PDF'), 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false)); + 'id_pdf' => array('title' => $this->l('PDF'), 'width' => 35, 'align' => 'center', 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false)); $this->shopLinkType = 'shop'; $this->shopShareDatas = Shop::SHARE_ORDER; diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 1b68f0e5d..c1a1085c3 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -55,8 +55,8 @@ class AdminProductsController extends AdminController 'name' => array('title' => $this->l('Name'), 'filter_key' => 'b!name'), 'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 80), 'name_category' => array('title' => $this->l('Category'), 'width' => 100, 'filter_key' => 'cl!name'), - 'price' => array('title' => $this->l('Base price'), 'width' => 70, 'price' => true, 'align' => 'right', 'filter_key' => 'a!price'), - 'price_final' => array('title' => $this->l('Final price'), 'width' => 70, 'price' => true, 'align' => 'right', 'havingFilter' => true, 'orderby' => false), + 'price' => array('title' => $this->l('Base price'), 'width' => 70, 'type' => 'price', 'align' => 'right', 'filter_key' => 'a!price'), + 'price_final' => array('title' => $this->l('Final price'), 'width' => 70, 'type' => 'price', 'align' => 'right', 'havingFilter' => true, 'orderby' => false), 'active' => array('title' => $this->l('Displayed'), 'width' => 70, 'active' => 'status', 'filter_key' => 'a!active', 'align' => 'center', 'type' => 'bool', 'orderby' => false), 'position' => array('title' => $this->l('Position'), 'width' => 70,'filter_key' => 'cp!position', 'align' => 'center', 'position' => 'position'), ); diff --git a/controllers/admin/AdminRangePriceController.php b/controllers/admin/AdminRangePriceController.php index 141f6b833..147663250 100644 --- a/controllers/admin/AdminRangePriceController.php +++ b/controllers/admin/AdminRangePriceController.php @@ -40,8 +40,8 @@ class AdminRangePriceControllerCore extends AdminController $this->fieldsDisplay = array( 'id_range_price' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'carrier_name' => array('title' => $this->l('Carrier'), 'align' => 'center', 'width' => 25, 'filter_key' => 'ca!name'), - 'delimiter1' => array('title' => $this->l('From'), 'width' => 86, 'price' => true, 'align' => 'right'), - 'delimiter2' => array('title' => $this->l('To'), 'width' => 86, 'price' => true, 'align' => 'right')); + 'delimiter1' => array('title' => $this->l('From'), 'width' => 86, 'type' => 'price', 'align' => 'right'), + 'delimiter2' => array('title' => $this->l('To'), 'width' => 86, 'type' => 'price', 'align' => 'right')); $this->_join = 'LEFT JOIN '._DB_PREFIX_.'carrier ca ON (ca.`id_carrier` = a.`id_carrier`)'; $this->_select = 'ca.`name` AS carrier_name'; diff --git a/controllers/admin/AdminSearchController.php b/controllers/admin/AdminSearchController.php index 3485e9ee9..73a08de21 100644 --- a/controllers/admin/AdminSearchController.php +++ b/controllers/admin/AdminSearchController.php @@ -206,7 +206,7 @@ class AdminSearchControllerCore extends AdminController 'manufacturer_name' => array('title' => $this->l('Manufacturer'), 'align' => 'center'), 'reference' => array('title' => $this->l('Reference'), 'align' => 'center'), 'name' => array('title' => $this->l('Name')), - 'price' => array('title' => $this->l('Price'), 'align' => 'right', 'price' => true), + 'price' => array('title' => $this->l('Price'), 'align' => 'right', 'type' => 'price'), 'status' => array('title' => $this->l('Status'), 'align' => 'center'), )); } diff --git a/controllers/admin/AdminStockMvtController.php b/controllers/admin/AdminStockMvtController.php index a4ac96164..a9d848c83 100644 --- a/controllers/admin/AdminStockMvtController.php +++ b/controllers/admin/AdminStockMvtController.php @@ -229,7 +229,7 @@ class AdminStockMvtControllerCore extends AdminController 'title' => $this->l('Price (TE)'), 'width' => 70, 'align' => 'right', - 'price' => true, + 'type' => 'price', 'currency' => true, 'filter_key' => 'a!price_te' ),