Search code examples
phpmagentomagento-1.8

Amasty promotions not working in Magento module


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!


Solution

  • 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();