title: Magento Ajax add to cart not working for subsites
body: <p>I've written a small script that is called via ajax for adding products to the cart.</p>
  
  <pre><code>$request = Mage::app()-&gt;getRequest();
  $session = Mage::getSingleton('core/session', array('name'=&gt;'frontend'));
  $cart = Mage::helper('checkout/cart')-&gt;getCart();
  foreach($pids as $pid){
      if(!pid || $pid == ''){continue;}
      $product = Mage::getModel('catalog/product')-&gt;load($pid);
      $cart-&gt;addProduct($product, $qty);
  }
  $session-&gt;setCartWasUpdated(true);
  $cart-&gt;save();
  </code></pre>
  
  <p>I have a multi site setup and this script works fine when it is run under the main site but when I run it under one of the subsites it doesn't add it to the cart.</p>
  
  <p>I've tried having the addtocart.php in the root of the subsite (and including the main sites mage.php) and have also tried adding it to the root of the main site, But nothing works.</p>
  
  <p>Do I need to specify the website id somewhere?</p>
  
  <p>Thanks</p>