multiple catalog rules with same price, calculate wrong final price
Question
I have multiple catalog price rules on same product with same price but different priority, so i suppose that system will apply the lowest (0 is lowest) priority rule to calculate final price.
Rule A:
status: active, Priority:0, action: to fixed amount, Discount: 223.200, Stop further rule: Yes
Rule B:
status: active, Priority:1, action: to fixed amount, Discount: 223.200, Stop further rule: yes
So I suppose final price has to be 223.200 by using Rule A. But Final price is coming 223.00.
I have no idea whats happening, can anyone has idea what possibly could be reason of this.
Solution
app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php
, in method _calculatePrice()
around line 440:
$byFixed => $this->_connection->getCheckSql(
new Zend_Db_Expr('0 > @price - cppt.action_amount'),
new Zend_Db_Expr('0'),
new Zend_Db_Expr('@price - cppt.action_amount')
),
)
)
),
'@price := @price' // <-- the culprit
);
}
replace with:
$byFixed => $this->_connection->getCheckSql(
new Zend_Db_Expr('0 > @price - cppt.action_amount'),
new Zend_Db_Expr('0'),
new Zend_Db_Expr('@price - cppt.action_amount')
),
)
)
),
'@price' // remove ':= @price' to fix rounding bug
);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange