Skip to content

Instantly share code, notes, and snippets.

/diff
Created Nov 15, 2016

Embed
What would you like to do?
diff between Magento v.1.9.3.0 & Magento v.1.9.3.1
diff -r /magento1930/RELEASE_NOTES.txt /magento1931/RELEASE_NOTES.txt
0a1,10
> ==== 1.9.3.1 ====
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ] NOTE: Current Release Notes are maintained at: [
> ] [
> ] http://merch.docs.magento.com/ce/user_guide/magento/release-notes-ce-1.9.3.1.html [
> ] [
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
diff -r /magento1930/app/Mage.php /magento1931/app/Mage.php
174c174
< 'patch' => '0',
---
> 'patch' => '1',
diff -r /magento1930/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php /magento1931/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
180a181,182
> $allowableTags = isset($data['is_html_allowed_on_front']) && $data['is_html_allowed_on_front']
> ? sprintf('<%s>', implode('><', $this->_getAllowedTags())) : null;
182,192c184,187
< $isHtmlAllowedOnFrontend = isset($data['is_html_allowed_on_front'])
< && $data['is_html_allowed_on_front'];
< $data['option']['value'][$key] = array_map(
< array($helperCatalog, 'stripTags'),
< $values,
< array_fill(
< 0,
< count($values),
< $isHtmlAllowedOnFrontend ? sprintf('<%s>', implode('><', $this->_getAllowedTags())): null
< )
< );
---
> foreach ($values as $storeId => $storeLabel) {
> $data['option']['value'][$key][$storeId]
> = $helperCatalog->stripTags($storeLabel, $allowableTags);
> }
diff -r /magento1930/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php /magento1931/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php
556c556
< * @param array $result
---
> * @param mixed $result
559c559
< public function processingMethodResult(array $result)
---
> public function processingMethodResult($result)
561,563c561,565
< foreach ($result as &$row) {
< if (!is_null($row) && !is_bool($row) && !is_numeric($row)) {
< $row = $this->processingRow($row);
---
> if (is_null($result) || is_bool($result) || is_numeric($result) || is_object($result)) {
> return $result;
> } elseif (is_array($result)) {
> foreach ($result as $key => $value) {
> $result[$key] = $this->processingMethodResult($value);
564a567,568
> } else {
> $result = $this->processingRow($result);
565a570
>
diff -r /magento1930/app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php /magento1931/app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php
130c130
< 'idSuffix' => '',
---
> 'idSuffix' => '_clone',
diff -r /magento1930/app/code/core/Mage/CatalogRule/Model/Resource/Rule.php /magento1931/app/code/core/Mage/CatalogRule/Model/Resource/Rule.php
736c736,737
< ->where('to_time = 0 or to_time > ?', $date);
---
> ->where('to_time = 0 or to_time > ?', $date)
> ->order('sort_order');
diff -r /magento1930/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext/Collection.php /magento1931/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext/Collection.php
130c130
< $this->getSelect()->orWhere('FALSE');
---
> $this->getSelect()->where('FALSE');
diff -r /magento1930/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php /magento1931/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php
352a353
> }
354,377c355,356
< $mainTableAlias = 's';
< $fields = array('product_id');
<
< $select = $adapter->select()
< ->from(array($mainTableAlias => $this->getMainTable()), $fields)
< ->joinInner(array('e' => $this->getTable('catalog/product')),
< 'e.entity_id = s.product_id',
< array())
< ->where($mainTableAlias . '.store_id = ?', (int)$query->getStoreId());
<
< $where = "";
< if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_FULLTEXT
< || $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
< ) {
< $bind[':query'] = implode(' ', $preparedTerms[0]);
< $where = Mage::getResourceHelper('catalogsearch')
< ->chooseFulltext($this->getMainTable(), $mainTableAlias, $select);
< }
< if ($likeCond != '' && $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE) {
< $where .= ($where ? ' OR ' : '') . $likeCond;
< } elseif ($likeCond != '' && $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE) {
< $select->columns(array('relevance' => new Zend_Db_Expr(0)));
< $where = $likeCond;
< }
---
> $mainTableAlias = 's';
> $fields = array('product_id');
379,381c358,378
< if ($where != '') {
< $select->where($where);
< }
---
> $select = $adapter->select()
> ->from(array($mainTableAlias => $this->getMainTable()), $fields)
> ->joinInner(array('e' => $this->getTable('catalog/product')),
> 'e.entity_id = s.product_id',
> array())
> ->where($mainTableAlias . '.store_id = ?', (int)$query->getStoreId());
>
> $where = "";
> if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_FULLTEXT
> || $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
> ) {
> $bind[':query'] = implode(' ', $preparedTerms[0]);
> $where = Mage::getResourceHelper('catalogsearch')
> ->chooseFulltext($this->getMainTable(), $mainTableAlias, $select);
> }
> if ($likeCond != '' && $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE) {
> $where .= ($where ? ' OR ' : '') . $likeCond;
> } elseif ($likeCond != '' && $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE) {
> $select->columns(array('relevance' => new Zend_Db_Expr(0)));
> $where = $likeCond;
> }
383c380,381
< $this->_foundData = $adapter->fetchPairs($select, $bind);
---
> if ($where != '') {
> $select->where($where);
385a384,385
> $this->_foundData = $adapter->fetchPairs($select, $bind);
>
diff -r /magento1930/app/code/core/Mage/Cms/Block/Page.php /magento1931/app/code/core/Mage/Cms/Block/Page.php
87a88,95
> $breadcrumbsObject = new Varien_Object();
> $breadcrumbsObject->setCrumbs($breadcrumbsArray);
>
> Mage::dispatchEvent('cms_generate_breadcrumbs', array('breadcrumbs' => $breadcrumbsObject));
>
> foreach ($breadcrumbsObject->getCrumbs() as $breadcrumbsItem) {
> $breadcrumbs->addCrumb($breadcrumbsItem['crumbName'], $breadcrumbsItem['crumbInfo']);
> }
102,109d109
< $breadcrumbsObject = new Varien_Object();
< $breadcrumbsObject->setCrumbs($breadcrumbsArray);
<
< Mage::dispatchEvent('cms_generate_breadcrumbs', array('breadcrumbs' => $breadcrumbsObject));
<
< foreach ($breadcrumbsObject->getCrumbs() as $breadcrumbsItem) {
< $breadcrumbs->addCrumb($breadcrumbsItem['crumbName'], $breadcrumbsItem['crumbInfo']);
< }
diff -r /magento1930/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php /magento1931/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
388c388
< return true;
---
> return $this->getCookie()->getLifetime() > 0;
460a461
> && isset($sessionData[self::VALIDATOR_SESSION_EXPIRE_TIMESTAMP])
diff -r /magento1930/app/code/core/Mage/Customer/Model/Customer.php /magento1931/app/code/core/Mage/Customer/Model/Customer.php
599c599
< public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0', $password = '')
---
> public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0', $password = null)
614c614,617
< $this->setPassword($password);
---
> if (!is_null($password)) {
> $this->setPassword($password);
> }
>
diff -r /magento1930/app/code/core/Mage/Customer/Model/Session.php /magento1931/app/code/core/Mage/Customer/Model/Session.php
224a225
> Mage::getSingleton('core/session')->renewFormKey();
309a311
> Mage::getSingleton('core/session')->renewFormKey();
diff -r /magento1930/app/code/core/Mage/Customer/etc/config.xml /magento1931/app/code/core/Mage/Customer/etc/config.xml
606c606
< <model>mage_customer/observer::deleteCustomerFlowPassword</model>
---
> <model>customer/observer::deleteCustomerFlowPassword</model>
diff -r /magento1930/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php /magento1931/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php
1439,1443c1439,1443
< 'attribute_id' => $rowData['_media_attribute_id'],
< 'label' => $rowData['_media_lable'],
< 'position' => $rowData['_media_position'],
< 'disabled' => $rowData['_media_is_disabled'],
< 'value' => $rowData['_media_image']
---
> 'attribute_id' => isset($rowData['_media_attribute_id']) ? $rowData['_media_attribute_id'] : '',
> 'label' => isset($rowData['_media_lable']) ? $rowData['_media_lable'] : '',
> 'position' => isset($rowData['_media_position']) ? $rowData['_media_position'] : '',
> 'disabled' => isset($rowData['_media_is_disabled']) ? $rowData['_media_is_disabled'] : '',
> 'value' => $rowData['_media_image']
diff -r /magento1930/app/code/core/Mage/Sales/etc/config.xml /magento1931/app/code/core/Mage/Sales/etc/config.xml
1230d1229
< <before>weee,freeshipping</before>
diff -r /magento1930/app/code/core/Mage/SalesRule/Model/Validator.php /magento1931/app/code/core/Mage/SalesRule/Model/Validator.php
248d247
<
250,259c249,251
< if (
< $rule->getSimpleFreeShipping()
< && $this->_canProcessRule($rule, $address)
< && $rule->getActions()->validate($item)
< ) {
<
< switch ($rule->getSimpleFreeShipping()) {
< case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ITEM:
< $item->setFreeShipping($rule->getDiscountQty() ? $rule->getDiscountQty() : true);
< break;
---
> if (!$this->_canProcessRule($rule, $address)) {
> continue;
> }
261,265c253,263
< case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS:
< $address->setFreeShipping(true);
< break;
< }
< if ($rule->getStopRulesProcessing()) {
---
> if (!$rule->getActions()->validate($item)) {
> continue;
> }
>
> switch ($rule->getSimpleFreeShipping()) {
> case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ITEM:
> $item->setFreeShipping($rule->getDiscountQty() ? $rule->getDiscountQty() : true);
> break;
>
> case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS:
> $address->setFreeShipping(true);
267c265,267
< }
---
> }
> if ($rule->getStopRulesProcessing()) {
> break;
319,322c319,321
< if ($this->_canProcessRule($rule, $address) && $rule->getActions()->validate($item)) {
<
< $qty = $this->_getItemQty($item, $rule);
< $rulePercent = min(100, $rule->getDiscountAmount());
---
> if (!$this->_canProcessRule($rule, $address)) {
> continue;
> }
324,359c323,325
< $discountAmount = 0;
< $baseDiscountAmount = 0;
< //discount for original price
< $originalDiscountAmount = 0;
< $baseOriginalDiscountAmount = 0;
<
< switch ($rule->getSimpleAction()) {
< case Mage_SalesRule_Model_Rule::TO_PERCENT_ACTION:
< $rulePercent = max(0, 100 - $rule->getDiscountAmount());
< //no break;
< case Mage_SalesRule_Model_Rule::BY_PERCENT_ACTION:
< $step = $rule->getDiscountStep();
< if ($step) {
< $qty = floor($qty / $step) * $step;
< }
< $_rulePct = $rulePercent / 100;
< $discountAmount = ($qty * $itemPrice - $item->getDiscountAmount()) * $_rulePct;
< $baseDiscountAmount = ($qty * $baseItemPrice - $item->getBaseDiscountAmount()) * $_rulePct;
< //get discount for original price
< $originalDiscountAmount = ($qty * $itemOriginalPrice - $item->getDiscountAmount()) * $_rulePct;
< $baseOriginalDiscountAmount =
< ($qty * $baseItemOriginalPrice - $item->getDiscountAmount()) * $_rulePct;
<
< if (!$rule->getDiscountQty() || $rule->getDiscountQty() > $qty) {
< $discountPercent = min(100, $item->getDiscountPercent() + $rulePercent);
< $item->setDiscountPercent($discountPercent);
< }
< break;
< case Mage_SalesRule_Model_Rule::TO_FIXED_ACTION:
< $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
< $discountAmount = $qty * ($itemPrice - $quoteAmount);
< $baseDiscountAmount = $qty * ($baseItemPrice - $rule->getDiscountAmount());
< //get discount for original price
< $originalDiscountAmount = $qty * ($itemOriginalPrice - $quoteAmount);
< $baseOriginalDiscountAmount = $qty * ($baseItemOriginalPrice - $rule->getDiscountAmount());
< break;
---
> if (!$rule->getActions()->validate($item)) {
> continue;
> }
361,369c327,328
< case Mage_SalesRule_Model_Rule::BY_FIXED_ACTION:
< $step = $rule->getDiscountStep();
< if ($step) {
< $qty = floor($qty / $step) * $step;
< }
< $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
< $discountAmount = $qty * $quoteAmount;
< $baseDiscountAmount = $qty * $rule->getDiscountAmount();
< break;
---
> $qty = $this->_getItemQty($item, $rule);
> $rulePercent = min(100, $rule->getDiscountAmount());
371,374c330,334
< case Mage_SalesRule_Model_Rule::CART_FIXED_ACTION:
< if (empty($this->_rulesItemTotals[$rule->getId()])) {
< Mage::throwException(Mage::helper('salesrule')->__('Item totals are not set for rule.'));
< }
---
> $discountAmount = 0;
> $baseDiscountAmount = 0;
> //discount for original price
> $originalDiscountAmount = 0;
> $baseOriginalDiscountAmount = 0;
376,390c336,365
< /**
< * prevent applying whole cart discount for every shipping order, but only for first order
< */
< if ($quote->getIsMultiShipping()) {
< $usedForAddressId = $this->getCartFixedRuleUsedForAddress($rule->getId());
< if ($usedForAddressId && $usedForAddressId != $address->getId()) {
< break;
< } else {
< $this->setCartFixedRuleUsedForAddress($rule->getId(), $address->getId());
< }
< }
< $cartRules = $address->getCartFixedRules();
< if (!isset($cartRules[$rule->getId()])) {
< $cartRules[$rule->getId()] = $rule->getDiscountAmount();
< }
---
> switch ($rule->getSimpleAction()) {
> case Mage_SalesRule_Model_Rule::TO_PERCENT_ACTION:
> $rulePercent = max(0, 100-$rule->getDiscountAmount());
> //no break;
> case Mage_SalesRule_Model_Rule::BY_PERCENT_ACTION:
> $step = $rule->getDiscountStep();
> if ($step) {
> $qty = floor($qty/$step)*$step;
> }
> $_rulePct = $rulePercent/100;
> $discountAmount = ($qty * $itemPrice - $item->getDiscountAmount()) * $_rulePct;
> $baseDiscountAmount = ($qty * $baseItemPrice - $item->getBaseDiscountAmount()) * $_rulePct;
> //get discount for original price
> $originalDiscountAmount = ($qty * $itemOriginalPrice - $item->getDiscountAmount()) * $_rulePct;
> $baseOriginalDiscountAmount =
> ($qty * $baseItemOriginalPrice - $item->getDiscountAmount()) * $_rulePct;
>
> if (!$rule->getDiscountQty() || $rule->getDiscountQty()>$qty) {
> $discountPercent = min(100, $item->getDiscountPercent()+$rulePercent);
> $item->setDiscountPercent($discountPercent);
> }
> break;
> case Mage_SalesRule_Model_Rule::TO_FIXED_ACTION:
> $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
> $discountAmount = $qty * ($itemPrice-$quoteAmount);
> $baseDiscountAmount = $qty * ($baseItemPrice-$rule->getDiscountAmount());
> //get discount for original price
> $originalDiscountAmount = $qty * ($itemOriginalPrice-$quoteAmount);
> $baseOriginalDiscountAmount = $qty * ($baseItemOriginalPrice-$rule->getDiscountAmount());
> break;
392,400c367,375
< if ($cartRules[$rule->getId()] > 0) {
< if ($this->_rulesItemTotals[$rule->getId()]['items_count'] <= 1) {
< $quoteAmount = $quote->getStore()->convertPrice($cartRules[$rule->getId()]);
< $baseDiscountAmount = min($baseItemPrice * $qty, $cartRules[$rule->getId()]);
< } else {
< $discountRate = $baseItemPrice * $qty /
< $this->_rulesItemTotals[$rule->getId()]['base_items_price'];
< $maximumItemDiscount = $rule->getDiscountAmount() * $discountRate;
< $quoteAmount = $quote->getStore()->convertPrice($maximumItemDiscount);
---
> case Mage_SalesRule_Model_Rule::BY_FIXED_ACTION:
> $step = $rule->getDiscountStep();
> if ($step) {
> $qty = floor($qty/$step)*$step;
> }
> $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
> $discountAmount = $qty * $quoteAmount;
> $baseDiscountAmount = $qty * $rule->getDiscountAmount();
> break;
402,404c377,380
< $baseDiscountAmount = min($baseItemPrice * $qty, $maximumItemDiscount);
< $this->_rulesItemTotals[$rule->getId()]['items_count']--;
< }
---
> case Mage_SalesRule_Model_Rule::CART_FIXED_ACTION:
> if (empty($this->_rulesItemTotals[$rule->getId()])) {
> Mage::throwException(Mage::helper('salesrule')->__('Item totals are not set for rule.'));
> }
406,412c382,396
< $discountAmount = min($itemPrice * $qty, $quoteAmount);
< $discountAmount = $quote->getStore()->roundPrice($discountAmount);
< $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
<
< //get discount for original price
< $originalDiscountAmount = min($itemOriginalPrice * $qty, $quoteAmount);
< $baseOriginalDiscountAmount = $quote->getStore()->roundPrice($baseItemOriginalPrice);
---
> /**
> * prevent applying whole cart discount for every shipping order, but only for first order
> */
> if ($quote->getIsMultiShipping()) {
> $usedForAddressId = $this->getCartFixedRuleUsedForAddress($rule->getId());
> if ($usedForAddressId && $usedForAddressId != $address->getId()) {
> break;
> } else {
> $this->setCartFixedRuleUsedForAddress($rule->getId(), $address->getId());
> }
> }
> $cartRules = $address->getCartFixedRules();
> if (!isset($cartRules[$rule->getId()])) {
> $cartRules[$rule->getId()] = $rule->getDiscountAmount();
> }
414c398,409
< $cartRules[$rule->getId()] -= $baseDiscountAmount;
---
> if ($cartRules[$rule->getId()] > 0) {
> if ($this->_rulesItemTotals[$rule->getId()]['items_count'] <= 1) {
> $quoteAmount = $quote->getStore()->convertPrice($cartRules[$rule->getId()]);
> $baseDiscountAmount = min($baseItemPrice * $qty, $cartRules[$rule->getId()]);
> } else {
> $discountRate = $baseItemPrice * $qty /
> $this->_rulesItemTotals[$rule->getId()]['base_items_price'];
> $maximumItemDiscount = $rule->getDiscountAmount() * $discountRate;
> $quoteAmount = $quote->getStore()->convertPrice($maximumItemDiscount);
>
> $baseDiscountAmount = min($baseItemPrice * $qty, $maximumItemDiscount);
> $this->_rulesItemTotals[$rule->getId()]['items_count']--;
416d410
< $address->setCartFixedRules($cartRules);
418c412,414
< break;
---
> $discountAmount = min($itemPrice * $qty, $quoteAmount);
> $discountAmount = $quote->getStore()->roundPrice($discountAmount);
> $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
420,426c416,418
< case Mage_SalesRule_Model_Rule::BUY_X_GET_Y_ACTION:
< $x = $rule->getDiscountStep();
< $y = $rule->getDiscountAmount();
< if (!$x || $y > $x) {
< break;
< }
< $buyAndDiscountQty = $x + $y;
---
> //get discount for original price
> $originalDiscountAmount = min($itemOriginalPrice * $qty, $quoteAmount);
> $baseOriginalDiscountAmount = $quote->getStore()->roundPrice($baseItemOriginalPrice);
428,429c420,422
< $fullRuleQtyPeriod = floor($qty / $buyAndDiscountQty);
< $freeQty = $qty - $fullRuleQtyPeriod * $buyAndDiscountQty;
---
> $cartRules[$rule->getId()] -= $baseDiscountAmount;
> }
> $address->setCartFixedRules($cartRules);
431,434c424
< $discountQty = $fullRuleQtyPeriod * $y;
< if ($freeQty > $x) {
< $discountQty += $freeQty - $x;
< }
---
> break;
436,440c426,429
< $discountAmount = $discountQty * $itemPrice;
< $baseDiscountAmount = $discountQty * $baseItemPrice;
< //get discount for original price
< $originalDiscountAmount = $discountQty * $itemOriginalPrice;
< $baseOriginalDiscountAmount = $discountQty * $baseItemOriginalPrice;
---
> case Mage_SalesRule_Model_Rule::BUY_X_GET_Y_ACTION:
> $x = $rule->getDiscountStep();
> $y = $rule->getDiscountAmount();
> if (!$x || $y > $x) {
442c431,432
< }
---
> }
> $buyAndDiscountQty = $x + $y;
444,481c434,448
< $result = new Varien_Object(array(
< 'discount_amount' => $discountAmount,
< 'base_discount_amount' => $baseDiscountAmount,
< ));
< Mage::dispatchEvent('salesrule_validator_process', array(
< 'rule' => $rule,
< 'item' => $item,
< 'address' => $address,
< 'quote' => $quote,
< 'qty' => $qty,
< 'result' => $result,
< ));
<
< $discountAmount = $result->getDiscountAmount();
< $baseDiscountAmount = $result->getBaseDiscountAmount();
<
< $percentKey = $item->getDiscountPercent();
< /**
< * Process "delta" rounding
< */
< if ($percentKey) {
< $delta = isset($this->_roundingDeltas[$percentKey]) ? $this->_roundingDeltas[$percentKey] : 0;
< $baseDelta = isset($this->_baseRoundingDeltas[$percentKey])
< ? $this->_baseRoundingDeltas[$percentKey]
< : 0;
< $discountAmount += $delta;
< $baseDiscountAmount += $baseDelta;
<
< $this->_roundingDeltas[$percentKey] = $discountAmount -
< $quote->getStore()->roundPrice($discountAmount);
< $this->_baseRoundingDeltas[$percentKey] = $baseDiscountAmount -
< $quote->getStore()->roundPrice($baseDiscountAmount);
< $discountAmount = $quote->getStore()->roundPrice($discountAmount);
< $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
< } else {
< $discountAmount = $quote->getStore()->roundPrice($discountAmount);
< $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
< }
---
> $fullRuleQtyPeriod = floor($qty / $buyAndDiscountQty);
> $freeQty = $qty - $fullRuleQtyPeriod * $buyAndDiscountQty;
>
> $discountQty = $fullRuleQtyPeriod * $y;
> if ($freeQty > $x) {
> $discountQty += $freeQty - $x;
> }
>
> $discountAmount = $discountQty * $itemPrice;
> $baseDiscountAmount = $discountQty * $baseItemPrice;
> //get discount for original price
> $originalDiscountAmount = $discountQty * $itemOriginalPrice;
> $baseOriginalDiscountAmount = $discountQty * $baseItemOriginalPrice;
> break;
> }
483,486c450,487
< /**
< * We can't use row total here because row total not include tax
< * Discount can be applied on price included tax
< */
---
> $result = new Varien_Object(array(
> 'discount_amount' => $discountAmount,
> 'base_discount_amount' => $baseDiscountAmount,
> ));
> Mage::dispatchEvent('salesrule_validator_process', array(
> 'rule' => $rule,
> 'item' => $item,
> 'address' => $address,
> 'quote' => $quote,
> 'qty' => $qty,
> 'result' => $result,
> ));
>
> $discountAmount = $result->getDiscountAmount();
> $baseDiscountAmount = $result->getBaseDiscountAmount();
>
> $percentKey = $item->getDiscountPercent();
> /**
> * Process "delta" rounding
> */
> if ($percentKey) {
> $delta = isset($this->_roundingDeltas[$percentKey]) ? $this->_roundingDeltas[$percentKey] : 0;
> $baseDelta = isset($this->_baseRoundingDeltas[$percentKey])
> ? $this->_baseRoundingDeltas[$percentKey]
> : 0;
> $discountAmount += $delta;
> $baseDiscountAmount += $baseDelta;
>
> $this->_roundingDeltas[$percentKey] = $discountAmount -
> $quote->getStore()->roundPrice($discountAmount);
> $this->_baseRoundingDeltas[$percentKey] = $baseDiscountAmount -
> $quote->getStore()->roundPrice($baseDiscountAmount);
> $discountAmount = $quote->getStore()->roundPrice($discountAmount);
> $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
> } else {
> $discountAmount = $quote->getStore()->roundPrice($discountAmount);
> $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
> }
488,489c489,495
< $itemDiscountAmount = $item->getDiscountAmount();
< $itemBaseDiscountAmount = $item->getBaseDiscountAmount();
---
> /**
> * We can't use row total here because row total not include tax
> * Discount can be applied on price included tax
> */
>
> $itemDiscountAmount = $item->getDiscountAmount();
> $itemBaseDiscountAmount = $item->getBaseDiscountAmount();
491,492c497,498
< $discountAmount = min($itemDiscountAmount + $discountAmount, $itemPrice * $qty);
< $baseDiscountAmount = min($itemBaseDiscountAmount + $baseDiscountAmount, $baseItemPrice * $qty);
---
> $discountAmount = min($itemDiscountAmount + $discountAmount, $itemPrice * $qty);
> $baseDiscountAmount = min($itemBaseDiscountAmount + $baseDiscountAmount, $baseItemPrice * $qty);
494,495c500,501
< $item->setDiscountAmount($discountAmount);
< $item->setBaseDiscountAmount($baseDiscountAmount);
---
> $item->setDiscountAmount($discountAmount);
> $item->setBaseDiscountAmount($baseDiscountAmount);
497,498c503,504
< $item->setOriginalDiscountAmount($originalDiscountAmount);
< $item->setBaseOriginalDiscountAmount($baseOriginalDiscountAmount);
---
> $item->setOriginalDiscountAmount($originalDiscountAmount);
> $item->setBaseOriginalDiscountAmount($baseOriginalDiscountAmount);
500c506
< $appliedRuleIds[$rule->getRuleId()] = $rule->getRuleId();
---
> $appliedRuleIds[$rule->getRuleId()] = $rule->getRuleId();
502,503c508,509
< $this->_maintainAddressCouponCode($address, $rule);
< $this->_addDiscountDescription($address, $rule);
---
> $this->_maintainAddressCouponCode($address, $rule);
> $this->_addDiscountDescription($address, $rule);
505,508c511,513
< if ($rule->getStopRulesProcessing()) {
< $this->_stopFurtherRules = true;
< break;
< }
---
> if ($rule->getStopRulesProcessing()) {
> $this->_stopFurtherRules = true;
> break;
510a516
>
diff -r /magento1930/app/code/core/Mage/SalesRule/etc/config.xml /magento1931/app/code/core/Mage/SalesRule/etc/config.xml
137,138c137,138
< <after>subtotal,tax_subtotal</after>
< <before>shipping</before>
---
> <after>subtotal</after>
> <before>tax_subtotal,shipping</before>
diff -r /magento1930/app/code/core/Mage/Tax/etc/config.xml /magento1931/app/code/core/Mage/Tax/etc/config.xml
165,166c165,166
< <after>subtotal</after>
< <before>tax,discount,msrp</before>
---
> <after>freeshipping</after>
> <before>tax,discount</before>
diff -r /magento1930/downloader/Maged/Controller.php /magento1931/downloader/Maged/Controller.php
1052c1052
< 'patch' => '0',
---
> 'patch' => '1',
Only in /magento1930/var/package: Cm_RedisSession-1.9.3.0.xml
Only in /magento1931/var/package: Cm_RedisSession-1.9.3.1.xml
Only in /magento1930/var/package: Interface_Adminhtml_Default-1.9.3.0.xml
Only in /magento1931/var/package: Interface_Adminhtml_Default-1.9.3.1.xml
Only in /magento1930/var/package: Interface_Frontend_Base_Default-1.9.3.0.xml
Only in /magento1931/var/package: Interface_Frontend_Base_Default-1.9.3.1.xml
Only in /magento1930/var/package: Interface_Frontend_Default-1.9.3.0.xml
Only in /magento1931/var/package: Interface_Frontend_Default-1.9.3.1.xml
Only in /magento1930/var/package: Interface_Frontend_Rwd_Default-1.9.3.0.xml
Only in /magento1931/var/package: Interface_Frontend_Rwd_Default-1.9.3.1.xml
Only in /magento1930/var/package: Interface_Install_Default-1.9.3.0.xml
Only in /magento1931/var/package: Interface_Install_Default-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Cm-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Cm-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Credis-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Credis-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Google_Checkout-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Google_Checkout-1.9.3.1.xml
Only in /magento1930/var/package: Lib_IDNA2-1.9.3.0.xml
Only in /magento1931/var/package: Lib_IDNA2-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Js_Calendar-1.51.1.6.xml
Only in /magento1931/var/package: Lib_Js_Calendar-1.51.1.7.xml
Only in /magento1930/var/package: Lib_Js_Ext-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Js_Ext-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Js_Mage-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Js_Mage-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Js_Prototype-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Js_Prototype-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Js_TinyMCE-3.5.11.5.xml
Only in /magento1931/var/package: Lib_Js_TinyMCE-3.5.11.6.xml
Only in /magento1930/var/package: Lib_LinLibertineFont-2.8.14.6.xml
Only in /magento1931/var/package: Lib_LinLibertineFont-2.8.14.7.xml
Only in /magento1930/var/package: Lib_Mage-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Mage-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Magento-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Magento-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Pelago-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Pelago-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Phpseclib-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Phpseclib-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Unserialize-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Unserialize-1.9.3.1.xml
Only in /magento1930/var/package: Lib_Varien-1.9.3.0.xml
Only in /magento1931/var/package: Lib_Varien-1.9.3.1.xml
Only in /magento1930/var/package: Lib_ZF-1.12.10.5.xml
Only in /magento1931/var/package: Lib_ZF-1.12.10.6.xml
Only in /magento1930/var/package: Lib_ZF_Locale-1.12.10.5.xml
Only in /magento1931/var/package: Lib_ZF_Locale-1.12.10.6.xml
Only in /magento1930/var/package: Mage_All_Latest-1.9.3.0.xml
Only in /magento1931/var/package: Mage_All_Latest-1.9.3.1.xml
Only in /magento1930/var/package: Mage_Centinel-1.9.3.0.xml
Only in /magento1931/var/package: Mage_Centinel-1.9.3.1.xml
Only in /magento1930/var/package: Mage_Compiler-1.9.3.0.xml
Only in /magento1931/var/package: Mage_Compiler-1.9.3.1.xml
Only in /magento1930/var/package: Mage_Core_Adminhtml-1.9.3.0.xml
Only in /magento1931/var/package: Mage_Core_Adminhtml-1.9.3.1.xml
Only in /magento1930/var/package: Mage_Core_Modules-1.9.3.0.xml
Only in /magento1931/var/package: Mage_Core_Modules-1.9.3.1.xml
Only in /magento1930/var/package: Mage_Downloader-1.9.3.0.xml
Only in /magento1931/var/package: Mage_Downloader-1.9.3.1.xml
Only in /magento1930/var/package: Mage_Locale_en_US-1.9.3.0.xml
Only in /magento1931/var/package: Mage_Locale_en_US-1.9.3.1.xml
Only in /magento1930/var/package: Magento_Mobile-1.9.3.0.xml
Only in /magento1931/var/package: Magento_Mobile-1.9.3.1.xml
Only in /magento1930/var/package: Phoenix_Moneybookers-1.9.3.0.xml
Only in /magento1931/var/package: Phoenix_Moneybookers-1.9.3.1.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.