From 9cfb411614cc83f80701224cda5bde6e0ca3b874 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 28 Mar 2013 12:06:11 +0100 Subject: [PATCH 1/4] [-] INSTALLER : Fix bug #PSCFV-8167 duplicates product_sqlstock INDEX --- install-dev/upgrade/php/p1540_add_missing_columns.php | 9 +++++++-- install-dev/upgrade/sql/1.5.4.0.sql | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/install-dev/upgrade/php/p1540_add_missing_columns.php b/install-dev/upgrade/php/p1540_add_missing_columns.php index 4d7775b0a..a86938056 100644 --- a/install-dev/upgrade/php/p1540_add_missing_columns.php +++ b/install-dev/upgrade/php/p1540_add_missing_columns.php @@ -47,10 +47,15 @@ function p1540_add_missing_columns() $list_fields[$k] = $field['Field']; if (!in_array('id_shop', $list_fields)) - if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'layered_product_attribute` ADD `id_shop` INT( 10 ) UNSIGNED NOT NULL DEFAULT "1" AFTER `id_attribute_group` ')) + if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'layered_product_attribute` ADD `id_shop` INT( 10 ) UNSIGNED NOT NULL DEFAULT "1" AFTER `id_attribute_group`')) $errors[] = Db::getInstance()->getMsgError(); } - + + $key_exists = Db::getInstance()->executeS('SHOW INDEX FROM `'._DB_PREFIX_.'stock_available` WHERE KEY_NAME = "product_sqlstock"');; + if (is_array($key_exists)) + if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'stock_available` DROP INDEX `product_sqlstock`')) + $errors[] = Db::getInstance()->getMsgError(); + if (count($errors)) return array('error' => 1, 'msg' => implode(',', $errors)) ; } \ No newline at end of file diff --git a/install-dev/upgrade/sql/1.5.4.0.sql b/install-dev/upgrade/sql/1.5.4.0.sql index 4e6e1cee2..4c291e693 100644 --- a/install-dev/upgrade/sql/1.5.4.0.sql +++ b/install-dev/upgrade/sql/1.5.4.0.sql @@ -33,7 +33,8 @@ CREATE TABLE `PREFIX_tab_module_preference` ( /* PHP:add_new_tab(AdminMarketing, es:Marketing|it:Marketing|en:Marketing|de:Marketing|fr:Marketing, 1); */; -ALTER TABLE `PREFIX_stock_available` DROP INDEX `product_sqlstock`; +/* PHP:p1540_add_missing_columns(); */; + ALTER TABLE `PREFIX_stock_available` ADD UNIQUE `product_sqlstock` (`id_product`, `id_product_attribute`, `id_shop`, `id_shop_group`); UPDATE PREFIX_configuration SET `value` = '8388608' WHERE `name` = 'PS_PRODUCT_PICTURE_MAX_SIZE' AND `value` <= '524288'; From 052d17c30d63ccfc2014c971e0b70e6a7f2952bc Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 28 Mar 2013 16:08:12 +0100 Subject: [PATCH 2/4] [-] MO : Fix bug #PSCFV-8399 dictinct categegories in module blockcategories --- modules/blockcategories/blockcategories.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/blockcategories/blockcategories.php b/modules/blockcategories/blockcategories.php index 8208037ed..60df5c858 100644 --- a/modules/blockcategories/blockcategories.php +++ b/modules/blockcategories/blockcategories.php @@ -163,7 +163,7 @@ class BlockCategories extends Module $groups = implode(', ', Customer::getGroupsStatic((int)$this->context->customer->id)); $maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH'); if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' - SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite + SELECT DISTINCT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite FROM `'._DB_PREFIX_.'category` c INNER JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('cl').') INNER JOIN `'._DB_PREFIX_.'category_shop` cs ON (cs.`id_category` = c.`id_category` AND cs.`id_shop` = '.(int)$this->context->shop->id.') @@ -238,7 +238,7 @@ class BlockCategories extends Module $maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH'); $groups = implode(', ', Customer::getGroupsStatic((int)$this->context->customer->id)); if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' - SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite + SELECT DISTINCT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite FROM `'._DB_PREFIX_.'category` c '.Shop::addSqlAssociation('category', 'c').' LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('cl').') From 93baeff66c444e98d2c518d34562292ce24dabc4 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 28 Mar 2013 19:50:14 +0100 Subject: [PATCH 3/4] [-] FO : Fix bug #PSCFV-8183 lost order message in OPC --- controllers/front/OrderOpcController.php | 5 +++++ themes/default/css/global.css | 5 +++-- themes/default/order-carrier.tpl | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index 9d8b593ad..fe2e5c6a2 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -405,9 +405,11 @@ class OrderOpcControllerCore extends ParentOrderController if (!$this->isLogged) { $carriers = $this->context->cart->simulateCarriersOutput(); + $oldMessage = Message::getMessageByCartId((int)($this->context->cart->id)); $this->context->smarty->assign(array( 'HOOK_EXTRACARRIER' => null, 'HOOK_EXTRACARRIER_ADDR' => null, + 'oldMessage' => isset($oldMessage['message'])? $oldMessage['message'] : '', 'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array( 'carriers' => $carriers, 'checked' => $this->context->cart->simulateCarrierSelectedOutput(), @@ -494,6 +496,7 @@ class OrderOpcControllerCore extends ParentOrderController $wrapping_fees = $this->context->cart->getGiftWrappingPrice(false); $wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice(); + $oldMessage = Message::getMessageByCartId((int)($this->context->cart->id)); $vars = array( 'free_shipping' => false, // Deprecated since a cart rule can be applied the specific carriers only @@ -513,6 +516,7 @@ class OrderOpcControllerCore extends ParentOrderController 'delivery_option' => $delivery_option, 'address_collection' => $this->context->cart->getAddressCollection(), 'opc' => true, + 'oldMessage' => isset($oldMessage['message'])? $oldMessage['message'] : '', 'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array( 'carriers' => $carriers, 'delivery_option_list' => $this->context->cart->getDeliveryOptionList(), @@ -538,6 +542,7 @@ class OrderOpcControllerCore extends ParentOrderController )), 'carrier_block' => $this->context->smarty->fetch(_PS_THEME_DIR_.'order-carrier.tpl') ); + Cart::addExtraCarriers($result); return $result; } diff --git a/themes/default/css/global.css b/themes/default/css/global.css index bf02f5f8b..110c7b506 100644 --- a/themes/default/css/global.css +++ b/themes/default/css/global.css @@ -1267,10 +1267,11 @@ a.iframe {font-weight:bold} width:723px; border:1px solid #ccc } - +#order-opc #opc_delivery_methods #message { + width: 757px; +} #order-opc #opc_payment_methods {margin-bottom:20px} #order-opc #opc_payment_methods #opc_payment_methods-content p{margin:0} - .delivery_option_carrier td {width:200px} .delivery_option_carrier td + td {width:280px;} .delivery_option_carrier td + td + td {width:200px} diff --git a/themes/default/order-carrier.tpl b/themes/default/order-carrier.tpl index c2c83f13d..25e164044 100644 --- a/themes/default/order-carrier.tpl +++ b/themes/default/order-carrier.tpl @@ -293,7 +293,7 @@

{l s='Leave a message'}

{l s='If you would like to add a comment about your order, please write it in the field below.'}

-

+

{/if} From 5fbe5b76873168841703030913fde1a89ebfca43 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Fri, 29 Mar 2013 09:34:48 +0100 Subject: [PATCH 4/4] // remove warnings --- controllers/front/AuthController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index d9d750c27..727945eb2 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -379,8 +379,8 @@ class AuthControllerCore extends FrontController $this->errors[] = Tools::displayError('An account using this email address has already been registered.', false); // Preparing customer $customer = new Customer(); - $lastnameAddress = $_POST['lastname']; - $firstnameAddress = $_POST['firstname']; + $lastnameAddress = Tools::getValue('lastname'); + $firstnameAddress = Tools::getValue('firstname'); $_POST['lastname'] = Tools::getValue('customer_lastname'); $_POST['firstname'] = Tools::getValue('customer_firstname');