1
votes

I want to display the discounted price the client can have depending on the payment method he chooses directly on the product page.

Basically, what I need is a way to get the shopping cart rules that apply for payment methods. So then I could use it to build a table of payment methods X discounts like this:

Cash: $90 (10% discount)
CC: $100 (Full price)
Transfer: $100 (Full price)

So far I couldn't find a way to access the shopping cart rules. Any insights?

UPDATE:

For those wondering, I've found a way to get the shopping cart rules. Pretty simple actually:

$model = Mage::getModel('salesrule/rule')
        ->getCollection();

With this information I can loop through the rules and find the ones that apply to payment methods.

$conditions = unserialize($item['conditions_serialized']);

But I realized that this way is too much work and can get complex if rules are complex. I decided to get the rules that I want by ID and get the discount value, since it won't change all the time.

If you know how to make Magento calculate everything for me, like me asking "If a user chose this payment method, besides everything else (user group, catalog discounts, etc) what would be the final price?".

1

1 Answers

0
votes
$model = Mage::getModel('salesrule/rule')
        ->getCollection();

foreach($model as $item){
    // check, do whatever and get discount
}