I need to add product to magento cart from another site. I make ajax request to magento function with code
$product_id = $this->getRequest()->getParam('id');
$cart = Mage::getSingleton('checkout/cart');
$cart->init();
$product = Mage::getModel('catalog/product')->load($product_id);
$cart->addProduct($product, array('qty' => 1));
$cart->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
New row appears in table sales_flat_quote, but when I open magento site - cart is empty. Why is that? What should I change in code to make it work?