From 108bd92c3b85197bb0af2e38527273a0c604cf84 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 18 Jul 2013 12:09:48 +0200 Subject: [PATCH 1/4] [-] FO : Fixed partial use of cart rules which does not offer free shipping #PSCFV-9216 --- classes/PaymentModule.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index acd3c1936..9b4994ee6 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -431,9 +431,9 @@ abstract class PaymentModuleCore extends Module // Set the new voucher value if ($voucher->reduction_tax) - $voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt - $order->total_shipping_tax_incl; + $voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_incl : 0); else - $voucher->reduction_amount = $values['tax_excl'] - $order->total_products - $order->total_shipping_tax_excl; + $voucher->reduction_amount = $values['tax_excl'] - $order->total_products - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_excl : 0); $voucher->id_customer = $order->id_customer; $voucher->quantity = 1; From 69066361a6aab400495e3e0ac2f329d2b14734e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Nadaud?= Date: Thu, 18 Jul 2013 12:15:42 +0200 Subject: [PATCH 2/4] [-] BO : FixBug #PSCFV-8234 Products tags not correctly indexed in search --- classes/Search.php | 8 ++++++++ controllers/admin/AdminTagsController.php | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/classes/Search.php b/classes/Search.php index 3241c3476..1ab992005 100644 --- a/classes/Search.php +++ b/classes/Search.php @@ -571,6 +571,14 @@ class SearchCore return true; } + public static function removeProductsSearchIndex($products) + { + if (count($products)) { + Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'search_index WHERE id_product IN ('.implode(',', $products).')'); + ObjectModel::updateMultishopTable('Product', array('indexed' => 0), 'a.id_product IN ('.implode(',', $products).')'); + } + } + protected static function setProductsAsIndexed(&$products) { if (count($products)) diff --git a/controllers/admin/AdminTagsController.php b/controllers/admin/AdminTagsController.php index 7e7ffcf41..57a158d37 100644 --- a/controllers/admin/AdminTagsController.php +++ b/controllers/admin/AdminTagsController.php @@ -77,8 +77,23 @@ class AdminTagsControllerCore extends AdminController public function postProcess() { if ($this->tabAccess['edit'] === '1' && Tools::getValue('submitAdd'.$this->table)) + { if (($id = (int)Tools::getValue($this->identifier)) && ($obj = new $this->className($id)) && Validate::isLoadedObject($obj)) + { + $previousProducts = $obj->getProducts(); + $removedProducts = array(); + + foreach ($previousProducts as $product) + if (!in_array($product['id_product'], $_POST['products'])) + $removedProducts[] = $product['id_product']; + + if (Configuration::get('PS_SEARCH_INDEXATION')) + Search::removeProductsSearchIndex($removedProducts); + $obj->setProducts($_POST['products']); + } + } + return parent::postProcess(); } From 6293631ac45d8682c5600568383bb3dddeca5dda Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 18 Jul 2013 13:47:23 +0200 Subject: [PATCH 3/4] [-] FO : fixed group query for cart rules #PSCFV-8992 --- classes/CartRule.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/classes/CartRule.php b/classes/CartRule.php index ab5cef179..001e8cd22 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -1104,29 +1104,30 @@ class CartRuleCore extends ObjectModel '.($context->customer->id ? 'OR cr.id_customer = '.(int)$context->cart->id_customer : '').' ) AND ( - cr.carrier_restriction = 0 + cr.`carrier_restriction` = 0 '.($context->cart->id_carrier ? 'OR c.id_carrier = '.(int)$context->cart->id_carrier : '').' ) AND ( - cr.shop_restriction = 0 + cr.`shop_restriction` = 0 '.((Shop::isFeatureActive() && $context->shop->id) ? 'OR crs.id_shop = '.(int)$context->shop->id : '').' ) AND ( - cr.group_restriction = 0 + cr.`group_restriction` = 0 '.($context->customer->id ? 'OR 0 < ( - SELECT cg.id_group - FROM '._DB_PREFIX_.'customer_group cg - LEFT JOIN '._DB_PREFIX_.'cart_rule_group crg ON (cg.id_group = crg.id_group AND cg.id_group = '.(int)$context->customer->id_default_group.') - WHERE cr.id_cart_rule = crg.id_cart_rule - AND cg.id_customer = '.(int)$context->customer->id.' LIMIT 1 + SELECT cg.`id_group` + FROM `'._DB_PREFIX_.'customer_group` cg + INNER JOIN `'._DB_PREFIX_.'cart_rule_group` crg ON cg.id_group = crg.id_group + WHERE cr.`id_cart_rule` = crg.`id_cart_rule` + AND cg.`id_customer` = '.(int)$context->customer->id.' + LIMIT 1 )' : '').' ) AND ( - cr.reduction_product <= 0 - OR cr.reduction_product IN ( - SELECT id_product - FROM '._DB_PREFIX_.'cart_product - WHERE id_cart = '.(int)$context->cart->id.' + cr.`reduction_product` <= 0 + OR cr.`reduction_product` IN ( + SELECT `id_product` + FROM `'._DB_PREFIX_.'cart_product` + WHERE `id_cart` = '.(int)$context->cart->id.' ) ) AND cr.id_cart_rule NOT IN (SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$context->cart->id.') From a6da3e94f0b3500bb0fd6dc8028710cf5ed37b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Nadaud?= Date: Thu, 18 Jul 2013 14:02:22 +0200 Subject: [PATCH 4/4] [-] BO : FixBug #PSCFV-9723 Exporting quantity in instant stock was not returning all rows --- controllers/admin/AdminStockInstantStateController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminStockInstantStateController.php b/controllers/admin/AdminStockInstantStateController.php index 04079c882..a3db14452 100644 --- a/controllers/admin/AdminStockInstantStateController.php +++ b/controllers/admin/AdminStockInstantStateController.php @@ -181,11 +181,13 @@ class AdminStockInstantStateControllerCore extends AdminController */ public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false) { - if (Tools::isSubmit('csv') && (int)Tools::getValue('id_warehouse') != -1) + if ((Tools::isSubmit('csv_quantities') || Tools::isSubmit('csv_prices')) && + (int)Tools::getValue('id_warehouse') != -1) $limit = false; $order_by_valuation = false; $order_by_real_quantity = false; + if ($this->context->cookie->{$this->table.'Orderby'} == 'valuation') { unset($this->context->cookie->{$this->table.'Orderby'}); @@ -200,6 +202,7 @@ class AdminStockInstantStateControllerCore extends AdminController parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop); $nb_items = count($this->_list); + for ($i = 0; $i < $nb_items; ++$i) { $item = &$this->_list[$i];