From 56099fa735c62f9252c3ef335959b6b658ae6d0b Mon Sep 17 00:00:00 2001 From: fBrignoli Date: Fri, 29 Apr 2011 09:09:38 +0000 Subject: [PATCH] // merge 1.4 => 6117 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@6118 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/tabs/AdminAttributes.php | 2 +- admin-dev/tabs/AdminOrders.php | 87 ++++++++++++++--------- admin-dev/tabs/AdminOrdersStates.php | 2 +- admin-dev/tabs/AdminTranslations.php | 5 ++ classes/Address.php | 91 ------------------------- classes/AddressFormat.php | 31 +++++++-- classes/AdminTab.php | 4 +- classes/Customer.php | 2 +- classes/FeatureValue.php | 1 + classes/FrontController.php | 6 +- classes/PDF.php | 7 +- classes/PaymentModule.php | 1 - classes/Product.php | 37 +++++----- classes/WebserviceRequest.php | 2 +- config/modules_list.xml | 8 +-- controllers/AddressController.php | 11 +++ controllers/OrderOpcController.php | 17 ++--- install-dev/sql/db_settings_extends.sql | 4 +- install-dev/sql/db_settings_lite.sql | 11 ++- install-dev/sql/upgrade/1.4.1.0.sql | 9 +-- modules/blocklayered/blocklayered.php | 8 +-- modules/blocksearch/blocksearch.php | 2 +- modules/blockwishlist/cart.php | 4 +- modules/blockwishlist/fr.php | 1 + modules/treepodia/treepodia.php | 2 +- themes/prestashop/address.tpl | 23 +++++-- themes/prestashop/js/order-address.js | 17 ++++- themes/prestashop/order-address.tpl | 15 ++-- themes/prestashop/store_infos.tpl | 6 +- 29 files changed, 199 insertions(+), 217 deletions(-) diff --git a/admin-dev/tabs/AdminAttributes.php b/admin-dev/tabs/AdminAttributes.php index f3077eb42..f1ce9c2ec 100644 --- a/admin-dev/tabs/AdminAttributes.php +++ b/admin-dev/tabs/AdminAttributes.php @@ -92,7 +92,7 @@ class AdminAttributes extends AdminTab
- * + *

'.$this->l('HTML colors only (e.g.,').' "lightblue", "#CC6600")

diff --git a/admin-dev/tabs/AdminOrders.php b/admin-dev/tabs/AdminOrders.php index 3d9a3f881..e1eb2074c 100644 --- a/admin-dev/tabs/AdminOrders.php +++ b/admin-dev/tabs/AdminOrders.php @@ -692,7 +692,7 @@ class AdminOrders extends AdminTab // '.$addressDelivery->country.($addressDelivery->id_state ? ' - '.$deliveryState->name : '').'
// '.(!empty($addressDelivery->phone) ? $addressDelivery->phone.'
' : '').' // '.(!empty($addressDelivery->phone_mobile) ? $addressDelivery->phone_mobile.'
' : '').' -// '.(!empty($addressDelivery->other) ? '
'.$addressDelivery->other.'
' : '').' + .(!empty($addressDelivery->other) ? '
'.$addressDelivery->other.'
' : '') .'
@@ -700,6 +700,8 @@ class AdminOrders extends AdminTab '.$this->l('Invoice address').''.$this->l('Invoice address').'
'.$this->displayAddressDetail($addressInvoice) + .(!empty($addressInvoice->other) ? '
'.$addressInvoice->other.'
' : '') + .'
 
'; @@ -930,7 +932,7 @@ class AdminOrders extends AdminTab echo '

'.$this->l('Back to list').'
'; } - public function displayAddressDetail($address) + public function displayAddressDetail($addressDelivery) { $optional_fields = array( 'company' => 1 @@ -938,49 +940,66 @@ class AdminOrders extends AdminTab , 'phone_mobile' => 1 , 'address2' => 1 ); + + $out_field_sep = ' '; + $out_line_sep = '
'; $out = ''; - $address_datas = AddressFormat::getAddressCountryFormat($address->id_country); + $lines_out = array(); - $field_other = $address->other; - $lines_out = $address->getOrderedValues(array( - 'spacer' => ' ' - , 'optional' => $optional_fields - ) - , $address_datas); + $address_datas = explode("\n", AddressFormat::getAddressCountryFormat($addressDelivery->id_country)); - $out = implode("
", $lines_out) .((!(is_null($field_other) || $field_other == '') )? '
'.$field_other: ''); + foreach ($address_datas as $fields_line) + { + $fields_arr = array(); + $is_empty = true; + foreach(explode(' ',$fields_line) as $field_item) + { + $field_item = trim($field_item); + if (!empty($addressDelivery->$field_item)) + { + $fields_arr[] = $this->_getAddressFieldValue($addressDelivery, $field_item); + $is_empty = false; + } + else + { + if (!isset($optional_fields[$field_item])) + { + $fields_arr[] = $this->_getAddressFieldValue($addressDelivery, $field_item); + $is_empty = false; + } + } + } + if (!$is_empty) + { + $tmp_line = implode($out_field_sep, $fields_arr); + $line_out[] = $tmp_line; + } + } + + $out = implode($out_line_sep, $line_out); return $out; } - /** - * returns String array values according to the given string pattern - * - */ - - public function getOrderedValues($address, $pattern, array $given_values = null) + private function _getAddressFieldValue(Address $address, $field_name) { - $out = array(); - if (!empty($fields) && $fields != '' && !is_null($address)) - { - $sep = "\n"; - $line_sep = ' '; - $lines = explode($sep, $pattern); - foreach ($lines as $one_line) + $out = ''; + if(!empty($field_name) && $field_name!= '' && !is_null($address)) + switch($field_name) { - if(!empty($one_line) && $one_line!= '') - { - $tmp_values = array(); - $words = explode($line_sep, trim($one_line)); - $tmp_words = array(); + // Note: add other cases as needed + case 'state': + $deliveryState = new State((int)($address->id_state)); + $out = (isset($deliveryState->name)) ? ' - '.$deliveryState->name : ''; + break; + case 'state_iso': + $deliveryState = new State((int)($address->id_state)); + $out = (isset($deliveryState->iso_code)) ? ' - '.$deliveryState->iso_code : ''; + break; - // String append instead of Array append - foreach ($words as $one_word) - $tmp_values[$one_word] = (is_null($given_values)) ? $address->{$one_word} : $given_values[$one_word]; + default: + $out = $address->$field_name; - $out[] = array($tmp_values, implode(' ', $tmp_values)); - } } - } return $out; } diff --git a/admin-dev/tabs/AdminOrdersStates.php b/admin-dev/tabs/AdminOrdersStates.php index fb3202dc0..03e590356 100644 --- a/admin-dev/tabs/AdminOrdersStates.php +++ b/admin-dev/tabs/AdminOrdersStates.php @@ -139,7 +139,7 @@ class AdminOrdersStates extends AdminTab
- +

'.$this->l('Status will be highlighted in this color. HTML colors only (e.g.,').' "lightblue", "#CC6600")

diff --git a/admin-dev/tabs/AdminTranslations.php b/admin-dev/tabs/AdminTranslations.php index 2144b77b6..7bf43a7fd 100644 --- a/admin-dev/tabs/AdminTranslations.php +++ b/admin-dev/tabs/AdminTranslations.php @@ -748,9 +748,14 @@ class AdminTranslations extends AdminTab if ($lang_packs!== false && $lang_packs != '' && $lang_packs = Tools::jsonDecode($lang_packs)) { echo ''; } echo '
diff --git a/classes/Address.php b/classes/Address.php index 9542356c2..dde19d839 100644 --- a/classes/Address.php +++ b/classes/Address.php @@ -216,97 +216,6 @@ class AddressCore extends ObjectModel return $out; } - - /** - * Returns values ordered in an array according to given fields - * @param array $config set options for the method formated as - $config = array( - 'spacer' => ' ' - , 'optional' => array( - 'company' => 1 - ,'phone' => 1 - ) - , 'ignore' => array( - 'phone_mobile' => 1 - ) - , 'return_set' => true (true: hash return, false: String array) - ) - * @param String $pattern lines of each needed fields \n splitted - * @param array $values optionnal given values - * @return array field values or hash values - */ - public static function getOrderedValuesFromArray($config, $pattern, array $values = null) - { - $tmp_address = new Address(); - $out = $tmp_address->getOrderedValues($config, $pattern, $values); - unset($tmp_address); - return $out; - } - - - /** - * Returns values ordered in an array according to given fields - * @param array $config set options for the method formated as - $config = array( - 'spacer' => ' ' - , 'optional' => array( - 'company' => 1 - ,'phone' => 1 - ,'phone_mobile' => 1 - ) - , 'return_set' => true - ) - * @param String $address_datas lines of each needed fields \n splitted - * @param array $given_values optionnal given values - * @return array field values or values in a hash - */ - - public function getOrderedValues(array $config, $address_datas, array $given_values = null) - { - - $spacer = $config["spacer"]; // String used for joining lines_out - $optional_fields = (isset($config["optional"]))? $config["optional"] : array(); // array hash tells which fields are optional - - $ignore = (isset($config["ignore"]))? $config["ignore"] : array(); // array hash tells which fields are ignored - - - $return_set = (!empty($config["return_set"])) ? $config["return_set"] : false; - - $line_breaker = "\n"; // used in address_datas format - - - $lines_out = array(); - $fields_lines = explode($line_breaker, $address_datas); - - foreach ($fields_lines as $one_line) - if(!empty($one_line) && $one_line!= '') - { - $tmp_values = array(); - $val_added = false; - - $words = explode(' ', trim($one_line)); - $tmp_words = array(); - - foreach ($words as $one_word) - { - if (!isset($ignore[$one_word])) - { - $one_word = trim($one_word); - $val = (is_null($given_values)) ? $this->{$one_word} : $given_values[$one_word]; - if ((!empty($val) && $val != '') || ((empty($val) || $val == '') && (isset($optional_fields[$one_word]) != 1))) - { - $tmp_values[$one_word] = $val; - $val_added = true; - } - } - } - if ($val_added) - $lines_out[] = ($return_set) ? $tmp_values : implode($spacer, $tmp_values); - } - return $lines_out; - } - - public function getFields() { parent::validateFields(); diff --git a/classes/AddressFormat.php b/classes/AddressFormat.php index c52094984..9820dc586 100644 --- a/classes/AddressFormat.php +++ b/classes/AddressFormat.php @@ -60,6 +60,8 @@ class AddressFormatCore extends ObjectModel $out = true; $addr_f_validate = Address::getFieldsValidate(); + $addr_f_validate['state_iso'] = 1; // adding state iso code into allowed fields + $fields_format = explode("\n", $this->format); foreach($fields_format as $field_line) { @@ -73,20 +75,30 @@ class AddressFormatCore extends ObjectModel } return $out; } + + /** * Returns address format fields in array by country * - * @param Integer PS_COUNTRY.id + * @param Integer PS_COUNTRY.id if null using default country * @return Array String field address format */ - public static function getOrderedAddressFields($id_country) + public static function getOrderedAddressFields($id_country = 0, $split_all = false) { $out = array(); $field_set = explode("\n", self::getAddressCountryFormat($id_country)); foreach ($field_set as $field_item) { - $out[] = trim($field_item); + // $field_item = trim($field_item); + + if ($split_all) + { + foreach(explode(' ',$field_item) as $word_item) + $out[] = trim($word_item); + } + else + $out[] = trim($field_item); } return $out; } @@ -97,9 +109,16 @@ class AddressFormatCore extends ObjectModel * @param Integer PS_COUNTRY.id * @return String field address format */ - public static function getAddressCountryFormat($id_country) + public static function getAddressCountryFormat($id_country = 0) { - $out = ''; + $out = ''; + $id_country = (int) $id_country; + + if ($id_country <= 0) + { + $selectedCountry = (int)(Configuration::get('PS_COUNTRY_DEFAULT')); + } + $tmp_obj = new AddressFormat(); $tmp_obj->id_country = $id_country; $out = $tmp_obj->getFormat($tmp_obj->id_country); @@ -131,7 +150,7 @@ class AddressFormatCore extends ObjectModel FROM `'._DB_PREFIX_.$this->table.'` WHERE `id_country` = '.(int)($id_country)); - return isset($result['format']) ? $result['format'] : false; + return isset($result['format']) ? trim($result['format']) : ''; } } diff --git a/classes/AdminTab.php b/classes/AdminTab.php index 1693f7675..c6ddc5792 100644 --- a/classes/AdminTab.php +++ b/classes/AdminTab.php @@ -319,7 +319,7 @@ abstract class AdminTabCore public function includeSubTab($methodname, $actions = array()) { if (!isset($this->_includeTab) OR !is_array($this->_includeTab)) - return ; + return false; $key = 0; $inc = false; foreach ($this->_includeTab as $subtab => $extraVars) @@ -1553,7 +1553,7 @@ abstract class AdminTabCore global $currentIndex, $cookie, $tab; if (!isset($this->_fieldsOptions) OR !sizeof($this->_fieldsOptions)) - return ; + return false; $defaultLanguage = (int)Configuration::get('PS_LANG_DEFAULT'); $this->_languages = Language::getLanguages(false); diff --git a/classes/Customer.php b/classes/Customer.php index a656daead..5912eda63 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -305,7 +305,7 @@ class CustomerCore extends ObjectModel public function getAddresses($id_lang) { return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' - SELECT a.*, cl.`name` AS country, s.name AS state + SELECT a.*, cl.`name` AS country, s.name AS state, s.iso_code AS state_iso FROM `'._DB_PREFIX_.'address` a LEFT JOIN `'._DB_PREFIX_.'country` c ON (a.`id_country` = c.`id_country`) LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country`) diff --git a/classes/FeatureValue.php b/classes/FeatureValue.php index 8ecc1e7c7..131e5c8e9 100644 --- a/classes/FeatureValue.php +++ b/classes/FeatureValue.php @@ -146,6 +146,7 @@ class FeatureValueCore extends ObjectModel LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value`) WHERE `value` = \''.pSQL($name).'\' AND fv.`id_feature` = '.(int)$id_feature.' + AND fv.`custom` = 0 GROUP BY fv.`id_feature_value` LIMIT 1'); if (!isset($rq[0]['id_feature_value']) OR !$id_feature_value = (int)$rq[0]['id_feature_value']) diff --git a/classes/FrontController.php b/classes/FrontController.php index 638dc188f..af6a51d81 100755 --- a/classes/FrontController.php +++ b/classes/FrontController.php @@ -79,7 +79,7 @@ class FrontControllerCore return; self::$initialized = true; - if ($this->ssl AND !(empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) != 'off') AND Configuration::get('PS_SSL_ENABLED')) + if ($this->ssl AND (empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off') AND Configuration::get('PS_SSL_ENABLED')) { header('HTTP/1.1 301 Moved Permanently'); header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']); @@ -194,8 +194,8 @@ class FrontControllerCore $navigationPipe = (Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>'); $smarty->assign('navigationPipe', $navigationPipe); - $protocol_link = (Configuration::get('PS_SSL_ENABLED') OR (isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) == 'on')) ? 'https://' : 'http://'; - $protocol_content = ((isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) OR (isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) == 'on')) ? 'https://' : 'http://'; + $protocol_link = (Configuration::get('PS_SSL_ENABLED') OR (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://'; + $protocol_content = ((isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) OR (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://'; if (!defined('_PS_BASE_URL_')) define('_PS_BASE_URL_', Tools::getShopDomain(true)); if (!defined('_PS_BASE_URL_SSL_')) diff --git a/classes/PDF.php b/classes/PDF.php index 24dc60df8..c76b59f46 100644 --- a/classes/PDF.php +++ b/classes/PDF.php @@ -439,7 +439,8 @@ class PDFCore extends PDF_PageGroupCore ); $ignore_fields = array( 'phone' => 1 - , 'mobile_phone' =>1 + , 'mobile_phone' => 1 + , 'state_iso' => 1 ); $width = 100; @@ -469,12 +470,12 @@ class PDFCore extends PDF_PageGroupCore $tmp_dlv = $delivery_address->{$field_name}; if (!((empty($tmp_inv) || $tmp_inv == '') && isset($optional_fields[$field_name]))) { - $tmp_inv = ($field_name == "country") ? $tmp_inv.($deliveryState ? ' - '.$deliveryState->name : ''): $tmp_inv; + $tmp_inv = ($field_name == "country") ? $tmp_inv.($deliveryState ? ' - '.$deliveryState->iso_code : ''): $tmp_inv; $tmp_inv_vals[] = Tools::iconv('utf-8', self::encoding(), $tmp_inv); } if (!((empty($tmp_dlv) || $tmp_dlv == '') && isset($optional_fields[$field_name]))) { - $tmp_dlv = ($field_name == "country") ? $tmp_dlv.($deliveryState ? ' - '.$deliveryState->name : ''): $tmp_dlv; + $tmp_dlv = ($field_name == "country") ? $tmp_dlv.($deliveryState ? ' - '.$deliveryState->iso_code : ''): $tmp_dlv; $tmp_dlv_vals[] = Tools::iconv('utf-8', self::encoding(), $tmp_dlv); } } diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 725e4e0e7..ebaccd303 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -88,7 +88,6 @@ abstract class PaymentModuleCore extends Module * @param string $paymentMethod Payment method (eg. 'Credit card') * @param string $message Message to attach to order */ - public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false) { global $cart; diff --git a/classes/Product.php b/classes/Product.php index d72d4d0ab..3b47286c6 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -1594,35 +1594,34 @@ class ProductCore extends ObjectModel $quantity = ($id_cart AND $cart_quantity) ? $cart_quantity : $quantity; $id_currency = (int)(Validate::isLoadedObject($cur_cart) ? $cur_cart->id_currency : ((isset($cookie->id_currency) AND (int)($cookie->id_currency)) ? $cookie->id_currency : Configuration::get('PS_CURRENCY_DEFAULT'))); - // retrieve address informations - $id_country = (int)Country::getDefaultCountryId(); + $id_country = (int)Country::getDefaultCountryId(); $id_state = 0; $id_county = 0; - - + if (!$id_address) + $id_address = $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}; + + if ($id_address) { - if ($id_address = $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) + $address_infos = Address::getCountryAndState($id_address); + if ($address_infos['id_country']) { - $address_infos = Address::getCountryAndState($id_address); - if ($address_infos['id_country']) - { - $id_country = (int)($address_infos['id_country']); - $id_state = (int)($address_infos['id_state']); - $postcode = (int)$address_infos['postcode']; - - $id_county = (int)County::getIdCountyByZipCode($id_state, $postcode); - } - } else if (isset($cookie->id_country)) { - // fetch address from cookie - $id_country = (int)$cookie->id_country; - $id_state = (int)$cookie->id_state; - $postcode = (int)$cookie->postcode; + $id_country = (int)($address_infos['id_country']); + $id_state = (int)($address_infos['id_state']); + $postcode = (int)$address_infos['postcode']; $id_county = (int)County::getIdCountyByZipCode($id_state, $postcode); } + } + elseif (isset($cookie->id_country)) + { + // fetch address from cookie + $id_country = (int)$cookie->id_country; + $id_state = (int)$cookie->id_state; + $postcode = (int)$cookie->postcode; + $id_county = (int)County::getIdCountyByZipCode($id_state, $postcode); } if (Tax::excludeTaxeOption()) diff --git a/classes/WebserviceRequest.php b/classes/WebserviceRequest.php index 815e54165..468f6e8b3 100644 --- a/classes/WebserviceRequest.php +++ b/classes/WebserviceRequest.php @@ -219,7 +219,7 @@ class WebserviceRequestCore $display_errors = strtolower(ini_get('display_errors')) != 'off'; // Error handler - set_error_handler(array('WebserviceRequest', 'webserviceErrorHandler')); + set_error_handler(array($this, 'webserviceErrorHandler')); ini_set('html_errors', 'off'); $this->_wsUrl = Tools::getHttpHost(true).__PS_BASE_URI__.'api/'; diff --git a/config/modules_list.xml b/config/modules_list.xml index 75a0a6125..b959d5cb6 100755 --- a/config/modules_list.xml +++ b/config/modules_list.xml @@ -9,7 +9,6 @@ - @@ -26,11 +25,10 @@ - - + @@ -74,7 +72,6 @@ - @@ -110,7 +107,6 @@ - @@ -119,4 +115,4 @@ - \ No newline at end of file + diff --git a/controllers/AddressController.php b/controllers/AddressController.php index 4a6b17505..d697e368e 100644 --- a/controllers/AddressController.php +++ b/controllers/AddressController.php @@ -256,6 +256,15 @@ class AddressControllerCore extends FrontController 'select_address' => (int)(Tools::getValue('select_address')) )); } + + protected function _processAddressFormat() + { + + $id_country = is_null($this->_address)? 0 : (int)$this->_address->id_country; + + $dlv_adr_fields = AddressFormat::getOrderedAddressFields($id_country, $split_all = true); + self::$smarty->assign('ordered_adr_fields', $dlv_adr_fields); + } public function displayHeader() { @@ -266,6 +275,8 @@ class AddressControllerCore extends FrontController public function displayContent() { parent::displayContent(); + + $this->_processAddressFormat(); self::$smarty->display(_PS_THEME_DIR_.'address.tpl'); } diff --git a/controllers/OrderOpcController.php b/controllers/OrderOpcController.php index aebca1b51..a8e43a7fe 100644 --- a/controllers/OrderOpcController.php +++ b/controllers/OrderOpcController.php @@ -120,7 +120,7 @@ class OrderOpcControllerCore extends ParentOrderController $blockUserInfo = new BlockUserInfo(); } self::$smarty->assign('isVirtualCart', self::$cart->isVirtualCart()); - $this->processAddressFormat(); + $this->_processAddressFormat(); $this->_assignAddress(); // Wrapping fees $wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE')); @@ -267,7 +267,7 @@ class OrderOpcControllerCore extends ParentOrderController { parent::displayContent(); - $this->processAddressFormat(); + $this->_processAddressFormat(); self::$smarty->display(_PS_THEME_DIR_.'errors.tpl'); self::$smarty->display(_PS_THEME_DIR_.'order-opc.tpl'); @@ -450,11 +450,15 @@ class OrderOpcControllerCore extends ParentOrderController return 0; } - protected function processAddressFormat() + protected function _processAddressFormat() { $selectedCountry = (int)(Configuration::get('PS_COUNTRY_DEFAULT')); - $inv_adr_fields = AddressFormat::getOrderedAddressFields($selectedCountry); - $dlv_adr_fields = AddressFormat::getOrderedAddressFields($selectedCountry); + + $address_delivery = new Address((int)self::$cart->id_address_delivery); + $address_invoice = new Address((int)self::$cart->id_address_invoice); + + $inv_adr_fields = AddressFormat::getOrderedAddressFields((int)$address_delivery->id_country); + $dlv_adr_fields = AddressFormat::getOrderedAddressFields((int)$address_invoice->id_country); $inv_all_fields = array(); $dlv_all_fields = array(); @@ -465,9 +469,6 @@ class OrderOpcControllerCore extends ParentOrderController foreach(explode(' ',$fields_line) as $field_item) ${$adr_type.'_all_fields'}[] = trim($field_item); -// DEBUG echo('
processAddressFormat: inv_all_fields: ' . var_export($inv_all_fields, true) -// DEBUG .'
processAddressFormat: inv_all_fields: ' . var_export($dlv_all_fields, true)); - self::$smarty->assign($adr_type.'_adr_fields', ${$adr_type.'_adr_fields'}); self::$smarty->assign($adr_type.'_all_fields', ${$adr_type.'_all_fields'}); diff --git a/install-dev/sql/db_settings_extends.sql b/install-dev/sql/db_settings_extends.sql index 757c34a61..e54e9bccf 100644 --- a/install-dev/sql/db_settings_extends.sql +++ b/install-dev/sql/db_settings_extends.sql @@ -363,9 +363,7 @@ INSERT INTO `PREFIX_feature_product` (`id_feature`, `id_product`, `id_feature_va (1, 1, 11),(1, 2, 15),(2, 1, 12),(2, 2, 16),(3, 1, 14),(3, 2, 18),(4, 1, 13),(4, 2, 17),(5, 1, 10),(5, 2, 10),(3, 7, 26),(5, 7, 9),(4, 7, 25),(2, 7, 24),(1, 7, 23); INSERT INTO `PREFIX_feature_value` (`id_feature_value`, `id_feature`, `custom`) VALUES -(11, 1, 1),(15, 1, 1),(12, 2, 1),(16, 2, 1),(14, 3, 1),(18, 3, 1),(13, 4, 1),(17, 4, 1),(26, 3, 1),(25, 4, 1),(24, 2, 1),(23, 1, 1); - -INSERT INTO `PREFIX_feature_value` (`id_feature_value`, `id_feature`, `custom`) VALUES (9, 5, NULL), (10, 5, NULL); +(11, 1, 1),(15, 1, 1),(12, 2, 1),(16, 2, 1),(14, 3, 1),(18, 3, 1),(13, 4, 1),(17, 4, 1),(26, 3, 1),(25, 4, 1),(24, 2, 1),(23, 1, 1),(9, 5, 0),(10, 5, 0); INSERT INTO `PREFIX_feature_value_lang` (`id_feature_value`, `id_lang`, `value`) VALUES (13, 1, '49.2 g'),(13, 2, '49,2 g'),(13, 3, '49,2 g'),(13, 4, '49.2 g'),(13, 5, '49.2 g'),(12, 2, '52,3 mm'),(12, 1, '2.06 in'),(12, 3, '52.3 mm'),(12, 4, '52.3 mm'),(12, 5, '52.3 mm'),(11, 2, '69,8 mm'),(11, 1, '2.75 in'),(11, 3, '69.8 mm'),(11, 4, '69.8 mm'),(11, 5, '69.8 mm'), diff --git a/install-dev/sql/db_settings_lite.sql b/install-dev/sql/db_settings_lite.sql index c5a4dfe88..3ab20c5b9 100644 --- a/install-dev/sql/db_settings_lite.sql +++ b/install-dev/sql/db_settings_lite.sql @@ -332,7 +332,7 @@ INSERT INTO `PREFIX_country_lang` (`id_country`, `id_lang`, `name`) VALUES (14, 1, 'Poland'),(14, 2, 'Pologne'),(14, 3, 'Polonia'),(15, 1, 'Portugal'),(15, 2, 'Portugal'),(15, 3, 'Portugal'), (16, 1, 'Czech Republic'),(16, 2, 'République Tchèque'),(16, 3, 'República Checa'),(17, 1, 'United Kingdom'),(17, 2, 'Royaume-Uni'),(17, 3, 'Reino Unido'), (18, 1, 'Sweden'),(18, 2, 'Suède'),(18, 3, 'Suecia'),(19, 1, 'Switzerland'),(19, 2, 'Suisse'),(19, 3, 'Suiza'),(20, 1, 'Denmark'), -(20, 2, 'Danemark'),(20, 3, 'Dinamarca'),(21, 1, 'USA'),(21, 2, 'États-Unis'),(21, 3, 'EE.UU.'),(22, 1, 'HongKong'),(22, 2, 'Hong-Kong'), +(20, 2, 'Danemark'),(20, 3, 'Dinamarca'),(21, 1, 'United States'),(21, 2, 'États-Unis'),(21, 3, 'EE.UU.'),(22, 1, 'HongKong'),(22, 2, 'Hong-Kong'), (22, 3, 'Hong Kong'),(23, 1, 'Norway'),(23, 2, 'Norvège'),(23, 3, 'Noruega'),(24, 1, 'Australia'),(24, 2, 'Australie'),(24, 3, 'Australia'), (25, 1, 'Singapore'),(25, 2, 'Singapour'),(25, 3, 'Singapur'),(26, 1, 'Ireland'),(26, 2, 'Eire'),(26, 3, 'Irlanda'),(27, 1, 'New Zealand'), (27, 2, 'Nouvelle-Zélande'),(27, 3, 'Nueva Zelanda'),(28, 1, 'South Korea'),(28, 2, 'Corée du Sud'),(28, 3, 'Corea del Sur'),(29, 1, 'Israel'), @@ -1029,10 +1029,9 @@ INSERT INTO `PREFIX_stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `n INSERT INTO `PREFIX_address_format` (`id_country`, `format`) (SELECT `id_country` as id_country, 'firstname lastname\ncompany\nvat_number\naddress1\naddress2\npostcode city\ncountry\nphone' as format FROM `PREFIX_country`); -UPDATE `PREFIX_address_format` set `format`='firstname lastname -company -address1 -address2 -city state postcode +UPDATE `PREFIX_address_format` set `format`='company +firstname lastname +address1 address2 +city state_iso postcode country phone' where `id_country`=21; diff --git a/install-dev/sql/upgrade/1.4.1.0.sql b/install-dev/sql/upgrade/1.4.1.0.sql index 02f24d81e..a40fce6fc 100755 --- a/install-dev/sql/upgrade/1.4.1.0.sql +++ b/install-dev/sql/upgrade/1.4.1.0.sql @@ -2,13 +2,6 @@ SET NAMES 'utf8'; INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`, `live_edit`) VALUES ('afterSaveAdminMeta', 'After save configuration in AdminMeta', 'After save configuration in AdminMeta', 0, 0); -INSERT INTO `PREFIX_hook_module` (`id_module`, `id_hook`, `position`) VALUES -( -(SELECT `id_module` FROM `PREFIX_module` WHERE `name` = 'blockcategories'), -(SELECT `id_hook` FROM `PREFIX_hook` WHERE `name` = 'afterSaveAdminMeta'), 1 -); - - ALTER TABLE `PREFIX_webservice_account` ADD `is_module` TINYINT( 2 ) NOT NULL DEFAULT '0' AFTER `class_name` , ADD `module_name` VARCHAR( 50 ) NULL DEFAULT NULL AFTER `is_module`; @@ -47,4 +40,4 @@ country phone' where `id_country`=21; /* PHP:alter_cms_block(); */; - +/* PHP:add_module_to_hook(blockcategories, afterSaveAdminMeta); */; diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index 633a3b7a2..c77447c21 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -251,8 +251,8 @@ if (!$params['category']->active) break; case 'id_attribute_group': $queryFilters .= ' AND p.id_product IN ( SELECT pa.`id_product` - FROM `ps_product_attribute_combination` pac - LEFT JOIN `ps_product_attribute` pa + FROM `'._DB_PREFIX_.'product_attribute_combination` pac + LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product_attribute` = pac.`id_product_attribute`) WHERE '; foreach ($filterValues AS $filterValue) @@ -260,10 +260,10 @@ if (!$params['category']->active) $queryFilters = rtrim($queryFilters, 'OR ').')'; break; case 'category': - $parent = new category($id_parent); + $parent = new Category($id_parent); if (!sizeof($selectedFilters['category'])) $queryFilters .= ' AND p.id_product IN ( SELECT id_product FROM '._DB_PREFIX_.'category_product cp - LEFT JOIN ps_category c ON (c.id_category = cp.id_category) + LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category) WHERE 1 AND c.nleft >= parent->nleft AND c.nright <= parent->nright'; else { diff --git a/modules/blocksearch/blocksearch.php b/modules/blocksearch/blocksearch.php index d3084d26e..28c2c49d0 100644 --- a/modules/blocksearch/blocksearch.php +++ b/modules/blocksearch/blocksearch.php @@ -81,7 +81,7 @@ class BlockSearch extends Module { global $smarty; $smarty->assign('ENT_QUOTES', ENT_QUOTES); - $smarty->assign('search_ssl', (int)(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')); + $smarty->assign('search_ssl', (int)(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')); $ajaxSearch=(int)(Configuration::get('PS_SEARCH_AJAX')); $smarty->assign('ajaxsearch', $ajaxSearch); diff --git a/modules/blockwishlist/cart.php b/modules/blockwishlist/cart.php index d8965cd05..ed2605ed2 100644 --- a/modules/blockwishlist/cart.php +++ b/modules/blockwishlist/cart.php @@ -28,6 +28,7 @@ require_once(dirname(__FILE__).'/../../config/config.inc.php'); require_once(dirname(__FILE__).'/../../init.php'); require_once(dirname(__FILE__).'/WishList.php'); +require_once(dirname(__FILE__).'/blockwishlist.php'); $errors = array(); @@ -53,7 +54,8 @@ if ($cookie->isLogged()) if(!isset($cookie->id_wishlist) OR $cookie->id_wishlist == '') { $wishlist = new WishList(); - $wishlist->name = 'My WishList'; + $modWishlist = new BlockWishList(); + $wishlist->name = $modWishlist->l('My wishlist'); $wishlist->id_customer = (int)($cookie->id_customer); list($us, $s) = explode(' ', microtime()); srand($s * $us); diff --git a/modules/blockwishlist/fr.php b/modules/blockwishlist/fr.php index 5673c537c..c476b0cf5 100644 --- a/modules/blockwishlist/fr.php +++ b/modules/blockwishlist/fr.php @@ -10,6 +10,7 @@ $_MODULE['<{blockwishlist}prestashop>blockwishlist-ajax_09dc02ecbb078868a3a86dde $_MODULE['<{blockwishlist}prestashop>blockwishlist-extra_15b94c64c4d5a4f7172e5347a36b94fd'] = 'Ajouter à ma liste'; $_MODULE['<{blockwishlist}prestashop>blockwishlist_2715a65604e1af3d6933b61704865daf'] = 'Bloc liste de cadeaux'; $_MODULE['<{blockwishlist}prestashop>blockwishlist_7244141a5de030c4c882556f4fd70a8b'] = 'Ajoute un bloc gérant les listes de cadeaux'; +$_MODULE['<{blockwishlist}prestashop>blockwishlist_4840f4437f55e68a587d358090b948d1'] = 'Ma liste de cadeaux'; $_MODULE['<{blockwishlist}prestashop>blockwishlist_5ef2d617096ae7b47a83f3d4de9c84bd'] = 'Choix invalide pour l\'activation du module'; $_MODULE['<{blockwishlist}prestashop>blockwishlist_f4d1ea475eaa85102e2b4e6d95da84bd'] = 'Confirmation'; $_MODULE['<{blockwishlist}prestashop>blockwishlist_c888438d14855d7d96a2724ee9c306bd'] = 'Paramètres enregistrés'; diff --git a/modules/treepodia/treepodia.php b/modules/treepodia/treepodia.php index e7470113a..1862dfab5 100644 --- a/modules/treepodia/treepodia.php +++ b/modules/treepodia/treepodia.php @@ -80,7 +80,7 @@ class Treepodia extends Module private function _getShopURL() { - return ((Configuration::get('PS_SSL_ENABLED') OR (isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off')) ? Tools::getShopDomainSsl() : Tools::getShopDomain()).__PS_BASE_URI__; + return ((Configuration::get('PS_SSL_ENABLED') OR (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off')) ? Tools::getShopDomainSsl() : Tools::getShopDomain()).__PS_BASE_URI__; } public function generateXmlFlow() diff --git a/themes/prestashop/address.tpl b/themes/prestashop/address.tpl index 3f8780e5c..36c39d98c 100644 --- a/themes/prestashop/address.tpl +++ b/themes/prestashop/address.tpl @@ -90,6 +90,11 @@ $(function(){ldelim}

+

+ + + {l s='DNI / NIF / NIE'} +

{if $vat_display == 2}
{elseif $vat_display == 1} @@ -104,40 +109,43 @@ $(function(){ldelim}

+ {foreach from=$ordered_adr_fields item=field_name} + {if $field_name eq 'firstname'}

- + *

+ {elseif $field_name eq 'lastname'}

*

-

- - - {l s='DNI / NIF / NIE'} -

+ {elseif $field_name eq 'address1'}

*

+ {elseif $field_name eq 'address2'}

+ {elseif $field_name eq 'postcode'}

*

+ {elseif $field_name eq 'city'}

*

+ {elseif $field_name eq 'country'}

@@ -175,6 +183,9 @@ $(function(){ldelim} *

+ {/if} + {/foreach} +

diff --git a/themes/prestashop/js/order-address.js b/themes/prestashop/js/order-address.js index eb1923ff2..bd0a054ad 100644 --- a/themes/prestashop/js/order-address.js +++ b/themes/prestashop/js/order-address.js @@ -35,9 +35,20 @@ function updateAddressesDisplay(first_view) // update content of delivery address updateAddressDisplay('delivery'); + var txtInvoiceTitle = ""; + + try{ + var adrs_titles = getAddressesTitles(); + txtInvoiceTitle = adrs_titles.invoice; + } + catch (e) + { + + } + // update content of invoice address //if addresses have to be equals... - var txtInvoiceTitle = $('ul#address_invoice li.address_title').html(); + if ($('input[type=checkbox]#addressesAreEquals:checked').length == 1) { $('#address_invoice_form:visible').hide('fast'); @@ -55,13 +66,13 @@ function updateAddressesDisplay(first_view) $('ul#address_invoice li.address_title').html(txtInvoiceTitle); } } - + if(!first_view) { if (orderProcess == 'order') updateAddresses(); } - + return true; } diff --git a/themes/prestashop/order-address.tpl b/themes/prestashop/order-address.tpl index f67dced4a..f31094425 100644 --- a/themes/prestashop/order-address.tpl +++ b/themes/prestashop/order-address.tpl @@ -44,6 +44,8 @@ ,city: '{$address.city|addslashes}' ,country: '{$address.country|addslashes}' ,state: '{$address.state|default:''|addslashes}' + ,state_iso: '{$address.state_iso|default:''|addslashes}' + {rdelim}; {/foreach} @@ -66,14 +68,19 @@ ] {rdelim}; + function getAddressesTitles() + {ldelim} + return {ldelim} + 'invoice': "{l s='Your billing address'}" + , 'delivery': "{l s='Your delivery address'}" + {rdelim}; + + {rdelim} function buildAddressBlock(id_address, address_type, dest_comp) {ldelim} - var adr_titles_vals = {ldelim} - 'invoice': "{l s='Your billing address'}" - , 'delivery': "{l s='Your delivery address'}" - {rdelim}; + var adr_titles_vals = getAddressesTitles(); var li_content = addresses_values[id_address]; var fields_name = ["title"]; diff --git a/themes/prestashop/store_infos.tpl b/themes/prestashop/store_infos.tpl index 0072ee847..53e80dd88 100644 --- a/themes/prestashop/store_infos.tpl +++ b/themes/prestashop/store_infos.tpl @@ -36,10 +36,10 @@
{l s='Hours:'} - {foreach $days_datas as $one_day} + {foreach from=$days_datas item=one_day} - - + + {/foreach}
{$one_day['day']}{$one_day['hours']}{$one_day.day}{$one_day.hours}