0

I need to replace the product price with group price for the product which is in the cart.[without logged in any customers].

I am getting a product from the cart and getting a price and other information. I am unable to get product customerGroupId and group price and all.

$cart = Mage::getModel('checkout/cart')->getQuote();
        $cartItems = $cart->getAllVisibleItems();
        foreach ($cartItems as $item)
        {
            //Mage::log(print_r($item->getCustomerGroupId(), true));
         //   Mage::log(print_r($item, true));
            $item->setCustomerGroupId(4);
            Mage::log(print_r($item->getPrice(), true));
 Mage::log(print_r($item->getGroupPrice(), true));
}

The above code not able to print group price or unable to set product customerGroup

Help me to get an answer for this, Thanks in advance:)

1

Charlie.you can not get Customer group price from item`.

Here $item Mage_Sales_Quote_Item object and it not product object Mage_Catalog_Product .

So, you can not get group price from $item->getGroupPrice() and but you can only item price on here and using $item->getPrice() you can get Product cart price not group price.

Ifyou need to load product Object (Mage::getModel('catalog/product')) by product id($item->getProduct()->getId())

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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