title: Programmatically add product in cart - empty cart
body: <p>I'm trying to add a product in cart but the cart stay empty.
  Here's my code</p>
  
  <pre><code>try{
      $product_model = Mage::getSingleton('catalog/product');
  
      // Load product
      $_sku = "1-574#AD-B00731";
      $my_product_id  = $product_model-&gt;getIdBySku($_sku);
      $my_product     = $product_model-&gt;load($my_product_id);
      $qty_value = 1;
  
      // Add to cart 
      $cart = Mage::getModel('checkout/cart');
      $cart-&gt;init();
      $cart-&gt;addProduct($my_product, array('qty' =&gt; $qty_value));
      $cart-&gt;save();
      print_r($cart-&gt;getItemsQty().PHP_EOL);
      Mage::getSingleton('checkout/session')-&gt;setCartWasUpdated(true);
      var_dump("working");
   }
  catch(Exception $e){
      return $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>When I print <code>$cart-&gt;getItemsQty()</code> my item quantity are incremanting but my cart is still empty. I think it's <code>Mage::getSingleton('checkout/session')-&gt;setCartWasUpdated(true);</code> that is not working properly.</p>
  
  <p>Anybody have an idea of what is not working?</p>
  
  <p>Edit 1: I use Magento 1.8.0, so via an url query is not working because of the form_key</p>