title: Opencart 1.5.4 addToCart() first time page shows function does not work
body: <p>I am currently working on a project in Open Cart 1.5.4. I slighty moved the cart into another div without any problems. The thing is on new computers and first time they enter the site it´s not possible for the customer to add a product to cart. If they go into another page and then back it works just fine. The javascript file is loaded properly without any problems.</p>
  
  <p>Hope this explanation explains the problem or bug pretty good.</p>
  
  <p>Thanks in advance.</p>
  
  <p>JAVASCRIPT</p>
  
  <pre><code>function addToCart(product_id, quantity) {
      quantity = typeof(quantity) != 'undefined' ? quantity : 1;
  
      $.ajax({
          url: 'index.php?route=checkout/cart/add',
          type: 'post',
          data: 'product_id=' + product_id + '&amp;quantity=' + quantity,
          dataType: 'json',
          success: function(json) {
              $('.success, .warning, .attention, .information, .error').remove();
  
              if (json['redirect']) {
                  location = json['redirect'];
              }
  
              if (json['success']) {
                  //$('#notification').html('&lt;div class="success" style="display: none;"&gt;' + json['success'] + '&lt;img src="catalog/view/theme/default/image/close.png" alt="" class="close" /&gt;&lt;/div&gt;');
  
                  $('.success').fadeIn('slow');
                  try {
                      $('#cart-total').html(json['total']);
                  }
                  catch(err) {
                      console.log(err.message());
                  }
  
                  $('html, body').animate({ scrollTop: 0 }, 'slow');
  
                  $(".heading").animate({backgroundColor: "#FFFFFF"}, 'slow');
  
                  $(".cart_arrow").attr("style", "display: block;");
  
                  $(".heading").animate({backgroundColor: "#585858"}, 'slow');
  
              }   
          }
      });
  }
  </code></pre>