I am adding configurable products in to cart using the below code.
$product_id = 123; $qty = 1; $product = Mage::getModel('catalog/product')->load($product_id); $cart = Mage::getModel('checkout/cart'); $cart->init(); $superAttributeArray = array('151' => '3'); $params = array( 'product' => $product_id, 'qty' => $qty, 'super_attribute' => $superAttributeArray ); $cart->addProduct($product, $params); $cart->save();
this code works well and I can able to add the product in to cart. Tested the same in Database.
I want to map user id for the quote that was created. products will be added only after loggging in. When I add products with above code, customer_id field in 'sales_flat_quote' table is NULL. I want current logged in user id need to be set to this quote.
Can any one help me with this?