Magento - Which "Shopping Basket Price Rules" have been applied to the cart?

StackOverflow https://stackoverflow.com/questions/23345496

  •  11-07-2023
  •  | 
  •  

Pregunta

I'd like to pull out a list of "Shopping Basket Price Rules" that have been applied to the current basket. I can't find the code for this! Can you help?

I can pull out the name of the discount voucher used like this:

echo Mage::getModel('salesrule/rule')->load(Mage::getModel('salesrule/coupon')->load($this->getQuote()->getCouponCode(), 'code')->getRuleId())->getName();

But any automatically applied basket discounts have me stuck. I don't know how to look them up. I've tried var_dump on things like data from Mage::getSingleton('checkout/session')->getQuote()->getTotals(), but Magento must be running out of memory because I just get a white screen.

¿Fue útil?

Solución

I've kind of fixed this, at least enough for my purposes. I can pull out a single line from the "totals" block in the basket using the following code:

echo $this->renderTotal($totals['discount']);

This line can either be displayed on its own, or data can be extracted from it.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top