diff --git a/app/code/core/Mage/SalesRule/Model/Quote/Discount.php b/app/code/core/Mage/SalesRule/Model/Quote/Discount.php index b4d2a963f96..c2e25dc5f10 100644 --- a/app/code/core/Mage/SalesRule/Model/Quote/Discount.php +++ b/app/code/core/Mage/SalesRule/Model/Quote/Discount.php @@ -64,7 +64,7 @@ public function collect(Mage_Sales_Model_Quote_Address $address) $this->_calculator->init($store->getWebsiteId(), $quote->getCustomerGroupId(), $quote->getCouponCode()); $this->_calculator->initTotals($items, $address); - $address->setDiscountDescription([]); + $address->setDiscountDescription(''); /** @var Mage_Sales_Model_Quote_Item[] $items */ $items = $this->_calculator->sortItemsByPriority($items); foreach ($items as $item) { @@ -79,9 +79,6 @@ public function collect(Mage_Sales_Model_Quote_Address $address) continue; } - $eventArgs['item'] = $item; - Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs); - if ($item->getHasChildren() && $item->isChildrenCalculated()) { foreach ($item->getChildren() as $child) { $this->_calculator->process($child); @@ -92,6 +89,8 @@ public function collect(Mage_Sales_Model_Quote_Address $address) } } else { $this->_calculator->process($item); + $eventArgs['item'] = $item; + Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs); $this->_aggregateItemDiscount($item); } } @@ -143,7 +142,7 @@ public function fetch(Mage_Sales_Model_Quote_Address $address) if ($amount != 0) { $description = $address->getDiscountDescription(); - if (strlen($description)) { + if (is_string($description) && strlen($description)) { $title = Mage::helper('sales')->__('Discount (%s)', $description); } else { $title = Mage::helper('sales')->__('Discount');