title: Custom "add to cart" button throws wrong error in PrestaShop
body: <p>I need to have an "Add to Cart" button on a custom page (not product page), basically a button that I can pass a certain product ID and calls the ajax-cart.js function "add".</p>
  
  <p>Now, I've tried this code: </p>
  
  <pre><code>&lt;a class="exclusive_small ajax_add_to_cart_button" title="{l s='Add to cart'}" onclick="ajaxCart.add(26, null, false, null, 1, null)"&gt;{l s='Add to cart'}&lt;/a&gt;
  </code></pre>
  
  <p>but, though it <strong>does</strong> add the product with the specified ID (26 in that case) to the cart, it also fires an alert box with 2 errors: <em>Product not found</em>, and <em>This product is no longer available.</em></p>
  
  <p>I've managed to find the piece of code that handles these errors, in the CartController.php: </p>
  
  <pre><code>protected function processChangeProductInCart()
  {
      $mode = (Tools::getIsset('update') &amp;&amp; $this-&gt;id_product) ? 'update' : 'add';
  
      if ($this-&gt;qty == 0)
          $this-&gt;errors[] = Tools::displayError('Null quantity.', !Tools::getValue('ajax'));
      elseif (!$this-&gt;id_product)
          $this-&gt;errors[] = Tools::displayError('Product not found', !Tools::getValue('ajax'));
  
      $product = new Product($this-&gt;id_product, true, $this-&gt;context-&gt;language-&gt;id);
      if (!$product-&gt;id || !$product-&gt;active)
      {
          $this-&gt;errors[] = Tools::displayError('This product is no longer available.', !Tools::getValue('ajax'));
          return;
      }
  </code></pre>
  
  <p>but I don't understand how it works, and why the errors show when it's otherwise working as it should.</p>
  
  <p>Have I done something wrong, is this a bug?</p>