This article is incomplete and the solution might not work!
Ever wondered wether it would be possible creating a negative discount? This article describes how to create a negative shopping cart price rule.
By default, Magento doesn’t accept negative price rule discount values:
We have to add some changes through the core in Magento conform the article:
- Go to: app/code/core/Mage/Rule/Model/Rule.php and fin:
//check if discount amount > 0
if ((int)$this->getDiscountAmount() < 0) { 3 Mage::throwException(Mage::helper(‘rule’)->__(‘Invalid discount amount.’));
}
Replace this code, by 'commenting':
// if ((int)$this->getDiscountAmount() < 0) { 3 //Mage::throwException(Mage::helper(‘rule’)->__(‘Invalid discount //amount.’));
//}- Go to: app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab and find:
'class' => 'validate-not-negative-number',
- ‘Comment’ this code as well:
// 'class' => 'validate-not-negative-number',
Now it works for shopping cart price rules. Unfortunately the article doesn’t describe how to enable negative values for catalog price rules. We have the solution:
- Repeat step 3 and 4 for the file app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Action.php
- Then you can upload these files, I’ll prefer to save it in the app/code/local directory instead of core.
What about the TAX and the invoice?
Totals in the orders in the backend are messed up, is there a solution for this problem?
Hi Marcel,
Unfortunately, I never got this workaround 100% working. So it requires some final modifications in order to get it working properly.
seems that the catalog price rule not works, have u tried this ? thanks
Thanks for sharing this video tutorial, I was working to set catalog price rules in my Magento store, Your vide and this post helped me a lot, https://www.cloudways.com/blog/shopping-cart-and-catalog-price-rules-in-magento/.