From 333dbe4646be4df9d837d9ac0533f8d4249abce8 Mon Sep 17 00:00:00 2001 From: Matt B Date: Tue, 17 Jun 2014 17:01:37 +1000 Subject: [PATCH 1/3] Customer Group ID - Product Price Changed to an !is_null as it would not enter the IF statement when the Customer Group ID === 0 --- app/code/Mage/Catalog/Model/Product/Type/Price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Mage/Catalog/Model/Product/Type/Price.php b/app/code/Mage/Catalog/Model/Product/Type/Price.php index 9139ddb1026c3..d71cabc832661 100644 --- a/app/code/Mage/Catalog/Model/Product/Type/Price.php +++ b/app/code/Mage/Catalog/Model/Product/Type/Price.php @@ -254,7 +254,7 @@ public function getTierPrice($qty = null, $product) protected function _getCustomerGroupId($product) { - if ($product->getCustomerGroupId()) { + if (!is_null($product->getCustomerGroupId())) { return $product->getCustomerGroupId(); } return Mage::getSingleton('Mage_Customer_Model_Session')->getCustomerGroupId(); From 42f6feb4208313e308727ffc01ced0b5cdd66799 Mon Sep 17 00:00:00 2001 From: Matt B Date: Sat, 21 Jun 2014 10:58:45 +1000 Subject: [PATCH 2/3] Add Sort Order to Rules Sub product discounts use this function separately from the main product. In some cases Sub Products would run a different rule to the main product. --- app/code/Mage/CatalogRule/Model/Resource/Rule.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Mage/CatalogRule/Model/Resource/Rule.php b/app/code/Mage/CatalogRule/Model/Resource/Rule.php index 47ab182309a53..c1b5d73d9bc4f 100644 --- a/app/code/Mage/CatalogRule/Model/Resource/Rule.php +++ b/app/code/Mage/CatalogRule/Model/Resource/Rule.php @@ -670,7 +670,8 @@ public function getRulesFromProduct($date, $websiteId, $customerGroupId, $produc ->where('customer_group_id = ?', $customerGroupId) ->where('product_id = ?', $productId) ->where('from_time = 0 or from_time < ?', $date) - ->where('to_time = 0 or to_time > ?', $date); + ->where('to_time = 0 or to_time > ?', $date) + ->order('sort_order asc'); return $adapter->fetchAll($select); } From b2bde40b6f59aeb080806eeef4777c85d34a2878 Mon Sep 17 00:00:00 2001 From: Matt B Date: Sat, 21 Jun 2014 11:06:09 +1000 Subject: [PATCH 3/3] Revert --- app/code/Mage/CatalogRule/Model/Resource/Rule.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Mage/CatalogRule/Model/Resource/Rule.php b/app/code/Mage/CatalogRule/Model/Resource/Rule.php index c1b5d73d9bc4f..47ab182309a53 100644 --- a/app/code/Mage/CatalogRule/Model/Resource/Rule.php +++ b/app/code/Mage/CatalogRule/Model/Resource/Rule.php @@ -670,8 +670,7 @@ public function getRulesFromProduct($date, $websiteId, $customerGroupId, $produc ->where('customer_group_id = ?', $customerGroupId) ->where('product_id = ?', $productId) ->where('from_time = 0 or from_time < ?', $date) - ->where('to_time = 0 or to_time > ?', $date) - ->order('sort_order asc'); + ->where('to_time = 0 or to_time > ?', $date); return $adapter->fetchAll($select); }