cancel
Showing results for 
Search instead for 
Did you mean: 

Cart - Error when configurable product is disable

Cart - Error when configurable product is disable

Hi,

 

I am using an observer for item in cart and get some option on simple product.

But when they are attached to a configurable product, it fails and show an error if the configurable product is disable when viewing cart. It happens when customer log in after some times and already have some product in cart.

 

I follow that code:

public function salesQuoteItemSetOrdreProduit($observer)
{

$quoteItem = $observer->getQuoteItem(); $product = $observer->getProduct(); $optionsEl = $product->getTypeInstance(true); $options = $optionsEl->getOrderOptions($product); //fails here if(isset($options['simple_sku'])){ $_sku = $options['simple_sku']; $product = Mage::getModel('catalog/product')->loadByAttribute('sku',$_sku); $product->getOrdreProduit(); }

Source: www.kathirvel.com/magento-get-the-chosen-configuration-options-of-the-products-in-the-cart/

 

Do you have any idea to avoid it?

 

Thank you,

Damien.

3 REPLIES 3

Re: Cart - getTypeInstance - Error when configurable is disable

Hi, a little up on the list, thank you

Re: Cart - getTypeInstance - Error when configurable is disable

Hi there, I had the same issue, to prevent this to happen we are checking if the quote has got missed the children product, and status of the child products, since when you are in a configurable, 2 rows are being used to indicate the selected product from a configurable one. 

 

For me the right place to fix this is by extending the method init from the 

Mage_Checkout_Model_Cart

class. 

 

That's working for me, the only thing I still concerned, is in the fact if the quote has to be cleansed or not. I'm doing some investigation on that and I'll keep you posted if I find something useful. 

 

Cheers

Re: Cart - getTypeInstance - Error when configurable is disable

So, got an update, sort that issue by flagging the product as deleted when is a configurable but has no childrens.

 

When the order is placed those items doesn't get carried to the order. So that's all for us.