From b9c6b0e8af7cefa210a8ed916994e2212771c90a Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Mon, 14 Oct 2013 14:55:56 +0200 Subject: [PATCH 1/5] //dateofdelivery now use bootstrap design --- modules/dateofdelivery/dateofdelivery.php | 451 +++++++++++------- modules/dateofdelivery/views/index.php | 35 ++ .../views/templates/hook/button.tpl | 31 ++ .../views/templates/hook/index.php | 35 ++ .../dateofdelivery/views/templates/index.php | 35 ++ 5 files changed, 417 insertions(+), 170 deletions(-) create mode 100644 modules/dateofdelivery/views/index.php create mode 100644 modules/dateofdelivery/views/templates/hook/button.tpl create mode 100644 modules/dateofdelivery/views/templates/hook/index.php create mode 100644 modules/dateofdelivery/views/templates/index.php diff --git a/modules/dateofdelivery/dateofdelivery.php b/modules/dateofdelivery/dateofdelivery.php index 2268976d3..34fd0f1b2 100644 --- a/modules/dateofdelivery/dateofdelivery.php +++ b/modules/dateofdelivery/dateofdelivery.php @@ -88,13 +88,17 @@ class DateOfDelivery extends Module public function getContent() { - $this->_html .= '

'.$this->l('Date of delivery configuration').'

'; + $this->_html .= ''; $this->_postProcess(); - if (Tools::isSubmit('addCarrierRule') OR (Tools::isSubmit('editCarrierRule') AND Tools::isSubmit('id_carrier_rule'))) - $this->_setCarrierRuleForm(); + if (Tools::isSubmit('addCarrierRule') OR (Tools::isSubmit('updatedateofdelivery') AND Tools::isSubmit('id_carrier_rule'))) + $this->_html .= $this->renderAddForm(); else - $this->_setConfigurationForm(); + { + $this->_html .= $this->renderList(); + $this->_html .= $this->renderForm(); + } + return $this->_html; } @@ -212,10 +216,10 @@ class DateOfDelivery extends Module if (!sizeof($errors)) { - Configuration::updateValue('DOD_EXTRA_TIME_PRODUCT_OOS', (int)(Tools::getValue('extra_time_product_oos'))); - Configuration::updateValue('DOD_EXTRA_TIME_PREPARATION', (int)(Tools::getValue('extra_time_preparation'))); - Configuration::updateValue('DOD_PREPARATION_SATURDAY', (int)(Tools::isSubmit('preparation_saturday'))); - Configuration::updateValue('DOD_PREPARATION_SUNDAY', (int)(Tools::isSubmit('preparation_sunday'))); + Configuration::updateValue('DOD_EXTRA_TIME_PRODUCT_OOS', (int)Tools::getValue('extra_time_product_oos')); + Configuration::updateValue('DOD_EXTRA_TIME_PREPARATION', (int)Tools::getValue('extra_time_preparation')); + Configuration::updateValue('DOD_PREPARATION_SATURDAY', (int)Tools::getValue('preparation_day_preparation_saturday')); + Configuration::updateValue('DOD_PREPARATION_SUNDAY', (int)Tools::getValue('preparation_day_preparation_sunday')); Configuration::updateValue('DOD_DATE_FORMAT', Tools::getValue('date_format')); $this->_html .= $this->displayConfirmation($this->l('Settings are updated')); } @@ -229,7 +233,7 @@ class DateOfDelivery extends Module $errors[] = $this->l('Minimum time is invalid'); if (!Validate::isUnsignedInt(Tools::getValue('maximal_time'))) $errors[] = $this->l('Maximum time is invalid'); - if (($carrier = new Carrier((int)(Tools::getValue('id_carrier')))) AND !Validate::isLoadedObject($carrier)) + if (($carrier = new Carrier((int)Tools::getValue('id_carrier'))) AND !Validate::isLoadedObject($carrier)) $errors[] = $this->l('Carrier is invalid'); if ($this->_isAlreadyDefinedForCarrier((int)($carrier->id), (int)(Tools::getValue('id_carrier_rule', 0)))) $errors[] = $this->l('You cannot use this carrier, a rule has already been saved.'); @@ -240,7 +244,7 @@ class DateOfDelivery extends Module { if (Db::getInstance()->execute(' INSERT INTO `'._DB_PREFIX_.'dateofdelivery_carrier_rule`(`id_carrier`, `minimal_time`, `maximal_time`, `delivery_saturday`, `delivery_sunday`) - VALUES ('.(int)($carrier->id).', '.(int)(Tools::getValue('minimal_time')).', '.(int)(Tools::getValue('maximal_time')).', '.(int)(Tools::isSubmit('delivery_saturday')).', '.(int)(Tools::isSubmit('delivery_sunday')).') + VALUES ('.(int)($carrier->id).', '.(int)Tools::getValue('minimal_time').', '.(int)Tools::getValue('maximal_time').', '.(int)Tools::isSubmit('preparation_day_delivery_saturday').', '.(int)Tools::isSubmit('preparation_day_delivery_sunday').') ')) Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&confirmAddCarrierRule'); else @@ -250,10 +254,10 @@ class DateOfDelivery extends Module { if (Db::getInstance()->execute(' UPDATE `'._DB_PREFIX_.'dateofdelivery_carrier_rule` - SET `id_carrier` = '.(int)($carrier->id).', `minimal_time` = '.(int)(Tools::getValue('minimal_time')).', `maximal_time` = '.(int)(Tools::getValue('maximal_time')).', `delivery_saturday` = '.(int)(Tools::isSubmit('delivery_saturday')).', `delivery_sunday` = '.(int)(Tools::isSubmit('delivery_sunday')).' - WHERE `id_carrier_rule` = '.(int)(Tools::getValue('id_carrier_rule')) + SET `id_carrier` = '.(int)($carrier->id).', `minimal_time` = '.(int)Tools::getValue('minimal_time').', `maximal_time` = '.(int)Tools::getValue('maximal_time').', `delivery_saturday` = '.(int)Tools::isSubmit('preparation_day_delivery_saturday').', `delivery_sunday` = '.(int)Tools::isSubmit('preparation_day_delivery_sunday').' + WHERE `id_carrier_rule` = '.(int)Tools::getValue('id_carrier_rule') )) - Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&confirmEditCarrierRule'); + Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&confirmupdatedateofdelivery'); else $this->_html .= $this->displayError($this->l('An error occurred on updating of carrier rule.')); } @@ -263,173 +267,19 @@ class DateOfDelivery extends Module $this->_html .= $this->displayError(implode('
', $errors)); } - if (Tools::isSubmit('deleteCarrierRule') AND Tools::isSubmit('id_carrier_rule') AND (int)(Tools::getValue('id_carrier_rule')) AND $this->_isCarrierRuleExists((int)(Tools::getValue('id_carrier_rule')))) + if (Tools::isSubmit('deletedateofdelivery') AND Tools::isSubmit('id_carrier_rule') AND (int)Tools::getValue('id_carrier_rule') AND $this->_isCarrierRuleExists((int)Tools::getValue('id_carrier_rule'))) { - $this->_deleteByIdCarrierRule((int)(Tools::getValue('id_carrier_rule'))); + $this->_deleteByIdCarrierRule((int)Tools::getValue('id_carrier_rule')); $this->_html .= $this->displayConfirmation($this->l('Carrier rule deleted successfully')); } if (Tools::isSubmit('confirmAddCarrierRule')) $this->_html = $this->displayConfirmation($this->l('Carrier rule added successfully')); - if (Tools::isSubmit('confirmEditCarrierRule')) + if (Tools::isSubmit('confirmupdatedateofdelivery')) $this->_html = $this->displayConfirmation($this->l('Carrier rule updated successfully')); } - private function _setConfigurationForm() - { - $this->_html .= ' -
- '.$this->l('Carrier configuration').' - -

'.$this->l('Add a new carrier rule').'

- -

'.$this->l('List of carrier rules').'

'; - - $carrier_rules = $this->_getCarrierRulesWithCarrierName(); - if (sizeof($carrier_rules)) - { - $this->_html .= ' - - - - - - - - - - - '; - - foreach ($carrier_rules as $rule) - { - $this->_html .= ' - - - - - - - '; - } - - $this->_html .= ' - -
'.$this->l('Name of carrier').''.$this->l('Delivery between').''.$this->l('Saturday delivery').''.$this->l('Sunday delivery').''.$this->l('Actions').'
'.(!preg_match('/^0$/Ui', $rule['name']) ? htmlentities($rule['name'], ENT_QUOTES, 'UTF-8') : Configuration::get('PS_SHOP_NAME')).''.' '.sprintf($this->l('%1$d day(s) and %2$d day(s)'), $rule['minimal_time'], $rule['maximal_time']).''; - - if ($rule['delivery_saturday']) - $this->_html .= ''.$this->l('Yes').''; - else - $this->_html .= ''.$this->l('No').''; - $this->_html .=' - '; - - if ($rule['delivery_sunday']) - $this->_html .= ''.$this->l('Yes').''; - else - $this->_html .= ''.$this->l('No').''; - $this->_html .= ' - - - -
'; - } - else - $this->_html .= '

'.$this->l('No carrier rule').'

'; - - $this->_html .= ' -
-
-
-
- '.$this->l('More options').' - - -
- '.$this->l('day(s)').' -
-
- -
- '.$this->l('day(s)').' -
-
- -
-
    -
  • -
  • -
-
- -
- -

'.$this->l('You can see all parameters available at:').' http://www.php.net/manual/en/function.date.php

-
-

-
-
- '; - } - - private function _setCarrierRuleForm() - { - $carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::ALL_CARRIERS); - if (Tools::isSubmit('editCarrierRule') AND $this->_isCarrierRuleExists(Tools::getValue('id_carrier_rule'))) - $carrier_rule = $this->_getCarrierRule(Tools::getValue('id_carrier_rule')); - - $this->_html .= ' -
- '; - - if (isset($carrier_rule) AND $carrier_rule['id_carrier_rule']) - $this->_html .= ''; - $this->_html .= ' -
- '; - - if (Tools::isSubmit('addCarrierRule')) - $this->_html .= ' '.$this->l('New carrier rule').''; - elseif (Tools::isSubmit('editCarrierRule')) - $this->_html .= ' '.$this->l('Edit carrier rule').''; - - $this->_html .= ' - -
- -
- - -
- '.$this->l('day(s) and').' - '.$this->l('day(s)').' -
- - -
-
    -
  • -
  • -
-
- -

-

'.$this->l('Cancel').'

- '; - - $this->_html .= ' -
-
- '; - } - private function _getCarrierRulesWithCarrierName() { return Db::getInstance()->executeS(' @@ -596,4 +446,265 @@ class DateOfDelivery extends Module ) ); } + + public function renderForm() + { + $fields_form = array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Settings'), + 'icon' => 'icon-cogs' + ), + 'input' => array( + array( + 'type' => 'text', + 'label' => $this->l('Extra time when a product is out of stock'), + 'name' => 'extra_time_product_oos', + 'suffix' => $this->l('day(s)'), + ), + array( + 'type' => 'text', + 'label' => $this->l('Extra time for preparation of the order'), + 'name' => 'extra_time_preparation', + 'suffix' => $this->l('day(s)'), + ), + array( + 'type' => 'checkbox', + 'label' => $this->l('Preparation option'), + 'name' => 'preparation_day', + 'values' => array( + 'id' => 'id', + 'name' => 'name', + 'query' => array( + array( + 'id' => 'preparation_saturday', + 'name' => $this->l('Saturday preparation'), + 'val' => 1 + ), + array( + 'id' => 'preparation_sunday', + 'name' => $this->l('Sunday preparation'), + 'val' => 1 + ), + ), + ) + ), + array( + 'type' => 'text', + 'label' => $this->l('Date format:'), + 'name' => 'date_format', + 'desc' => $this->l('You can see all parameters available at:').' http://www.php.net/manual/en/function.date.php', + ), + ), + 'submit' => array( + 'title' => $this->l('Save'), + 'class' => 'btn btn-primary') + ), + ); + + $helper = new HelperForm(); + $helper->show_toolbar = false; + $helper->table = $this->table; + $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); + $helper->default_form_language = $lang->id; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; + $this->fields_form = array(); + + $helper->identifier = $this->identifier; + $helper->submit_action = 'submitMoreOptions'; + $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->tpl_vars = array( + 'fields_value' => $this->getConfigFieldsValues(), + 'languages' => $this->context->controller->getLanguages(), + 'id_language' => $this->context->language->id + ); + + return $helper->generateForm(array($fields_form)); + } + + public function renderAddForm() + { + $carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::ALL_CARRIERS); + + foreach ($carriers as $key => $val) + $carriers[$key]['name'] = (!$val['name'] ? Configuration::get('PS_SHOP_NAME') : $val['name']); + + $fields_form = array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Settings'), + 'icon' => 'icon-cogs' + ), + 'input' => array( + array( + 'type' => 'select', + 'label' => $this->l('Carrier :'), + 'name' => 'id_carrier', + 'options' => array( + 'query' => $carriers, + 'id' => 'id_carrier', + 'name' => 'name' + ) + ), + array( + 'type' => 'text', + 'label' => $this->l('Delivery between'), + 'name' => 'minimal_time', + 'suffix' => $this->l('day(s)'), + ), + array( + 'type' => 'text', + 'label' => $this->l(''), + 'name' => 'maximal_time', + 'suffix' => $this->l('day(s)'), + ), + array( + 'type' => 'checkbox', + 'label' => $this->l('Preparation option'), + 'name' => 'preparation_day', + 'values' => array( + 'id' => 'id', + 'name' => 'name', + 'query' => array( + array( + 'id' => 'delivery_saturday', + 'name' => $this->l('Saturday preparation'), + 'val' => 1 + ), + array( + 'id' => 'delivery_sunday', + 'name' => $this->l('Sunday preparation'), + 'val' => 1 + ), + ), + ) + ) + ), + 'submit' => array( + 'title' => $this->l('Save'), + 'class' => 'btn btn-primary', + 'name' => 'submitCarrierRule', + ) + ), + ); + + if (Tools::getValue('id_carrier_rule') && $this->_isCarrierRuleExists(Tools::getValue('id_carrier_rule'))) + $fields_form['form']['input'][] = array('type' => 'hidden', 'name' => 'id_carrier_rule'); + + $helper = new HelperForm(); + $helper->show_toolbar = false; + $helper->table = $this->table; + $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); + $helper->default_form_language = $lang->id; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; + $this->fields_form = array(); + + $helper->identifier = $this->identifier; + + if (Tools::getValue('id_carrier_rule')) + $helper->submit_action = 'updatedateofdelivery'; + else + $helper->submit_action = 'addCarrierRule'; + $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->tpl_vars = array( + 'fields_value' => $this->getCarrierRuleFieldsValues(), + 'languages' => $this->context->controller->getLanguages(), + 'id_language' => $this->context->language->id + ); + + return $helper->generateForm(array($fields_form)); + } + + public function getConfigFieldsValues() + { + return array( + 'extra_time_product_oos' => Tools::getValue('extra_time_product_oos', Configuration::get('DOD_EXTRA_TIME_PRODUCT_OOS')), + 'extra_time_preparation' => Tools::getValue('extra_time_preparation', Configuration::get('DOD_EXTRA_TIME_PREPARATION')), + 'preparation_day_preparation_saturday' => Tools::getValue('preparation_day_preparation_saturday', Configuration::get('DOD_PREPARATION_SATURDAY')), + 'preparation_day_preparation_sunday' => Tools::getValue('preparation_day_preparation_sunday', Configuration::get('DOD_PREPARATION_SUNDAY')), + 'date_format' => Tools::getValue('date_format', Configuration::get('DOD_DATE_FORMAT')), + 'id_carrier' => Tools::getValue('id_carrier'), + ); + } + + public function getCarrierRuleFieldsValues() + { + $fields = array( + 'id_carrier_rule' => Tools::getValue('id_carrier_rule'), + 'id_carrier' => Tools::getValue('id_carrier'), + 'minimal_time' => Tools::getValue('minimal_time'), + 'maximal_time' => Tools::getValue('maximal_time'), + 'delivery_saturday' => Tools::getValue('delivery_saturday'), + 'delivery_sunday' => Tools::getValue('delivery_sunday'), + ); + + if (Tools::isSubmit('updatedateofdelivery') AND $this->_isCarrierRuleExists(Tools::getValue('id_carrier_rule'))) + { + $carrier_rule = $this->_getCarrierRule(Tools::getValue('id_carrier_rule')); + + $fields['id_carrier_rule'] = Tools::getValue('id_carrier_rule', $carrier_rule['id_carrier_rule']); + $fields['id_carrier'] = Tools::getValue('id_carrier', $carrier_rule['id_carrier']); + $fields['minimal_time'] = Tools::getValue('minimal_time', $carrier_rule['minimal_time']); + $fields['maximal_time'] = Tools::getValue('maximal_time', $carrier_rule['maximal_time']); + $fields['preparation_day_delivery_saturday'] = Tools::getValue('preparation_day_delivery_saturday', $carrier_rule['delivery_saturday']); + $fields['preparation_day_delivery_sunday'] = Tools::getValue('preparation_day_delivery_sunday', $carrier_rule['delivery_sunday']); + } + + return $fields; + } + + public function renderList() + { + + $add_url = $this->context->link->getAdminLink('AdminModules').'&configure='.$this->name.'&addCarrierRule=1'; + + $fields_list = array( + 'name' => array( + 'title' => $this->l('Name of carrier'), + 'type' => 'text', + ), + 'delivery_between' => array( + 'title' => $this->l('Delivery between'), + 'type' => 'text', + ), + 'delivery_saturday' => array( + 'title' => $this->l('Saturday delivery'), + 'type' => 'bool', + 'align' => 'center', + 'active' => 'status', + ), + 'delivery_sunday' => array( + 'title' => $this->l('Sunday delivery'), + 'type' => 'bool', + 'align' => 'center', + 'active' => 'status', + ), + ); + $list = $this->_getCarrierRulesWithCarrierName(); + + foreach ($list as $key => $val) + { + if (!$val['name']) + $list[$key]['name'] = Configuration::get('PS_SHOP_NAME'); + $list[$key]['delivery_between'] = sprintf($this->l('%1$d day(s) and %2$d day(s)'), $val['minimal_time'], $val['maximal_time']); + } + + $helper = new HelperList(); + $helper->shopLinkType = ''; + $helper->simple_header = true; + $helper->identifier = 'id_carrier_rule'; + $helper->actions = array('edit', 'delete'); + $helper->show_toolbar = false; + + $helper->title = $this->l('Link list'); + $helper->table = $this->name; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; + + $this->context->smarty->assign(array('add_url' => $add_url)); + + return $this->display(__FILE__, 'button.tpl').$helper->generateList($list, $fields_list).$this->display(__FILE__, 'button.tpl'); + } } diff --git a/modules/dateofdelivery/views/index.php b/modules/dateofdelivery/views/index.php new file mode 100644 index 000000000..fd6bae0d3 --- /dev/null +++ b/modules/dateofdelivery/views/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../'); +exit; \ No newline at end of file diff --git a/modules/dateofdelivery/views/templates/hook/button.tpl b/modules/dateofdelivery/views/templates/hook/button.tpl new file mode 100644 index 000000000..b001326e0 --- /dev/null +++ b/modules/dateofdelivery/views/templates/hook/button.tpl @@ -0,0 +1,31 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + +
\ No newline at end of file diff --git a/modules/dateofdelivery/views/templates/hook/index.php b/modules/dateofdelivery/views/templates/hook/index.php new file mode 100644 index 000000000..c7a193905 --- /dev/null +++ b/modules/dateofdelivery/views/templates/hook/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../'); +exit; \ No newline at end of file diff --git a/modules/dateofdelivery/views/templates/index.php b/modules/dateofdelivery/views/templates/index.php new file mode 100644 index 000000000..3f4b16e7e --- /dev/null +++ b/modules/dateofdelivery/views/templates/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../'); +exit; \ No newline at end of file From 4da04275fe8cbb7e2e98bf0ceb2a6384d52c4c40 Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Mon, 14 Oct 2013 15:07:50 +0200 Subject: [PATCH 2/5] //small fix related to 1316bd7e1fd94fa753ed961d48a95762989e1534 --- classes/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Product.php b/classes/Product.php index 3dcddd45e..a5bbbb667 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -3062,7 +3062,7 @@ class ProductCore extends ObjectModel $check_stock = !Configuration::get('PS_DISP_UNAVAILABLE_ATTR'); if (!$res = Db::getInstance()->executeS(' - SELECT pa.id_product, a.color, pac.id_product_attribute,'.($check_stock ? 'SUM(IF(stock.quantity > 0, 1, 0)' : '').') qty + SELECT pa.id_product, a.color, pac.id_product_attribute, ('.($check_stock ? 'SUM(IF(stock.quantity > 0, 1, 0)' : '0').') qty FROM '._DB_PREFIX_.'product_attribute pa '.Shop::addSqlAssociation('product_attribute', 'pa'). ($check_stock ? Product::sqlStock('pa', 'pa') : '').' From 8f10e42b60a235b9c6b9cfeffa4884647db3ab4b Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Fri, 11 Oct 2013 16:47:32 +0200 Subject: [PATCH 3/5] // Small fixes --- .../customers/helpers/view/view.tpl | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/customers/helpers/view/view.tpl index 6a7793938..73a3f68d4 100644 --- a/admin-dev/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -112,11 +112,11 @@
  • {l s='Newsletter:'} {if $customer->newsletter} - {l s='Yes'} + {l s='Registered'} {else} - {l s='No'} + {l s='Unregistered'} {/if}
  • @@ -125,19 +125,23 @@ {if $customer->optin} - {l s='Yes'} + {l s='Registered'} {else} - {l s='No'} + {l s='Unregistered'} {/if}
  • {l s='Age:'} - {$customer_stats['age']} - {if isset($customer->birthday['age'])}({$customer_birthday}){else}{l s='Unknown'}{/if}
  • + {if isset($customer->birthday)} + {$customer_stats['age']} {l s='years old'} ({l s='Birth date:'} {$customer_birthday}) + {else} + {l s='Unknown'} + {/if} +
  • {l s='Last update:'} {$last_update} @@ -147,12 +151,12 @@ {if $customer->active} - {l s='Yes'} + {l s='Active'} {else} - {l s='No'} + {l s='Inactive'} {/if}
  • @@ -193,11 +197,11 @@
    - {l s='Valid orders:'} {$count_ok} {l s='for'} {$total_ok} + {l s='Valid orders:'} {$count_ok} {l s='for'} {$total_ok}
    - {l s='Invalid orders:'} {$count_ko} + {l s='Invalid orders:'} {$count_ko}
    From fa6d09a756d30cc305705772c039c029b3e61386 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 14 Oct 2013 15:56:53 +0200 Subject: [PATCH 4/5] // Fixed warning --- classes/controller/FrontController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index 5b8def5f0..b319af9ba 100644 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -1157,7 +1157,7 @@ class FrontControllerCore extends Controller protected function addColorsToProductList(&$products) { - if (!count($products)) + if (!is_array($products) || !count($products)) return; $products_need_cache = array(); From 7742020606937b5f17eed86a16b58479c1131cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Mon, 14 Oct 2013 15:59:48 +0200 Subject: [PATCH 5/5] // small fix --- classes/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Product.php b/classes/Product.php index a5bbbb667..74b4f5372 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -3062,7 +3062,7 @@ class ProductCore extends ObjectModel $check_stock = !Configuration::get('PS_DISP_UNAVAILABLE_ATTR'); if (!$res = Db::getInstance()->executeS(' - SELECT pa.id_product, a.color, pac.id_product_attribute, ('.($check_stock ? 'SUM(IF(stock.quantity > 0, 1, 0)' : '0').') qty + SELECT pa.id_product, a.color, pac.id_product_attribute, '.($check_stock ? 'SUM(IF(stock.quantity > 0, 1, 0))' : '0').' qty FROM '._DB_PREFIX_.'product_attribute pa '.Shop::addSqlAssociation('product_attribute', 'pa'). ($check_stock ? Product::sqlStock('pa', 'pa') : '').'