I have a cashier module that replaces the ordinary checkout i Magento 1.8. It has a unique url, such as mystore.com/mycashier
My problem is that the discount breakdowns (labels and individual discount amounts) in Amasty is not showing up in the cart. This is working in for example mystore.com/checkout/cart or mystore.com/checkout/onepage, but not in mystore.com/mycashier.
I found these specific lines in discount.phtml:
<?php if (is_array($this->getTotal()->getFullInfo())) : ?>
<?php foreach ($this->getTotal()->getFullInfo() as $info): ?>
$this->getTotal()->getFullInfo() is NULL in mystore.com/mycashier. So I tried to track down with profiler what was going on:
The following lines are found in the profiler when visiting mystore.com/checkout/cart but not when visiting mystore.com/mycashier:
OBSERVER: amasty_promo_model_observer
CORE::create_object_of::Amasty_Rules_Model_SalesRule_Rule_Condition_Product_Combine
CORE::create_object_of::Amasty_Rules_Model_SalesRule_Rule_Condition_Product
OBSERVER: amasty_rules_model_observer
However, notice that the total discount amount is visible and working perfectly, just not the individual discount labels and amounts.
What can I do to make this work and how do i do it?
Any ideas are appreciated!
Thanks!
Finally I found the solution, thanks to Amasty.
In the cashier module I needed to trigger the salesrule_validator_process through getTotals(), specifically from Mage::getModel('checkout/cart')->getQuote()
So I added two lines before the layout rendering in the indexController file for the module:
$new_quote = Mage::getModel('checkout/cart')->getQuote();
$new_quote->collectTotals();
The promo module in the question adds individual item discount in the file app\code\local\Amasty\Rules\Model\Observer.php
It observes event salesrule_validator_process
and check if the item discount is greater than zero. Then calls
$this->_addFullDescription($observer->getEvent()->getAddress(),
$rule, $item, $amountToDisplay);
The function, it it's turn sets the address full description.
Then it adds it in the class Mage_SalesRule_Model_Quote_Discount and shows in the template.
So you custom module can 1. do not throw the event
2. rewrites the class Mage_SalesRule_Model_Quote_Discount
3. uses custom template for totals
4. uses CSS that hides the discount (check page HTML source)