Magento 1.7.
I have one configurable product and associated products, also I have some dropdown boxes. After choosing the option from my product, I added it to the cart. I want to now get the product_id or product_sku for the simple product; for configurable products working.
<checkout_cart_product_add_after>
<observers>
<cart_init>
<type>singleton</type>
<class>ExtraCart_Cart_Model_Observer</class>
<method>getProductIdSku</method>
</cart_init>
</observers>
</checkout_cart_product_add_after>
php code :
public function getProductIdSku(Varien_Event_Observer $observer){
$product = $observer->getEvent()->getQuoteItem();
$productSku = $product->getSku(); //for configurable product
$productQty = $product->getQty(); //for configurable product
$order = $observer->getEvent();
$data = $order->getData('sku'); //fr simple product is not working
$quote = Mage::getSingleton('checkout/session')->getQuote(); //for configurable product
$sales_quote = Mage::getModel('sales/quote_item_option');...->getId(); getSku();
}
Best Answer
You can get the simple product details on the same event by placing the following code in your observer :
Hope this works for you.