1

It seems shopping cart prices are always applied to the price in the cart.

Is there a feature/module that allows shopping cart prices rules to be applied to the items original RRP/price regardless if it has a special price and or group price?

0

1 Answer 1

0

Use this event observer to set the shopping cart rule to base price of items instead speical or any group price.

sales_quote_address_collect_totals_after

public function updateccollects(Varien_Event_Observer $observer) 
{

    $quote = $observer->getQuoteAddress();
    if ($quote->getData('address_type') == 'shipping')
    {
        // getting the items in cart
        $quoteObj=   $quote->getQuote();
        $cartItems  = $quoteObj->getAllVisibleItems(); 
        // print_r($cartItems);
        $totalPrice  = 0;
        foreach($cartItems as $item)
        {
            $proId= $item->getId();
            $productObj = Mage::getModel("catalog/product")->load($proId);
            $originalPrice =   $productObj->getPrice();
            $totalBasePrice = $totalPrice + $originalPrice;
        }
        // get the applied rule ids
        $cartRuleId = $quoteObj->getAppliedRuleIds();
        $salesRule = Mage::getModel('salesrule/rule')->load($cartRuleId);
        $applyRule       = $salesRule->getData('simple_action'); 
        $discountAmmount =   $salesRule->getData('discount_amount');
        if($applyRule == "by_percent")
        {

            $finalDiscountAmount =  $totalBasePrice*($discountAmmount/100);
        }
        $quote->setDiscountAmount($finalDiscountAmount);
    }

}   

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.