title: OpenCart - function addToCart / no success message / no cart refresh
body: <p>I have a problem with a custom template, as after i add a product to the cart, no confirmation is displayed.In detail, after adding a product nothing happens and for example the cart information in the header stays empty. (See picture one)</p>
  
  <p><a href="http://de.tinypic.com/r/2hozei0/8" rel="nofollow">http://de.tinypic.com/r/2hozei0/8</a></p>
  
  <p>After clicking on the empty cart suddenly the product appears. (See picture two)
  So its seems that the success message and the cart refresh is missing after adding a product.</p>
  
  <p><a href="http://i58.tinypic.com/20zcl6g.png" rel="nofollow">http://i58.tinypic.com/20zcl6g.png</a></p>
  
  <p>Figured it out that the needed handling appears in <strong>catalog/view/javascript/common.js</strong></p>
  
  <p>Functions like "addToWishList" or "addToCompare" are working but the "addToCart" is NOT working.</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');
  
              $('#cart-total').html(json['total']);
  
              $('html, body').animate({ scrollTop: 0 }, 'slow'); 
          }   
      }
  });}
  </code></pre>
  
  <p>Any help appreciated! I am using OC 1.5.6</p>
  
  <p>Regards!</p>
  
  <hr>
  
  <p>see my <strong>/template/common/header.tpl</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html dir="&lt;?php echo $direction; ?&gt;" lang="&lt;?php echo $lang; ?&gt;"&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8" /&gt;
  &lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
  &lt;base href="&lt;?php echo $base; ?&gt;" /&gt;
  &lt;?php if ($description) { ?&gt;
  &lt;meta name="description" content="&lt;?php echo $description; ?&gt;" /&gt;
  &lt;?php } ?&gt;
  &lt;?php if ($keywords) { ?&gt;
  &lt;meta name="keywords" content="&lt;?php echo $keywords; ?&gt;" /&gt;
  &lt;?php } ?&gt;
  &lt;?php if ($icon) { ?&gt;
  &lt;link href="&lt;?php echo $icon; ?&gt;" rel="icon" /&gt;
  &lt;?php } ?&gt;
  &lt;?php foreach ($links as $link) { ?&gt;
  &lt;link href="&lt;?php echo $link['href']; ?&gt;" rel="&lt;?php echo $link['rel']; ?&gt;" /&gt;
  &lt;?php } ?&gt;
  &lt;link rel="stylesheet" type="text/css" href="catalog/view/theme/&lt;?php echo $this-&gt;config-&gt;get('config_template');?&gt;/stylesheet/stylesheet.css" /&gt;
  &lt;link href="catalog/view/theme/&lt;?php echo $this-&gt;config-&gt;get('config_template');?&gt;/stylesheet/cloud-zoom.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="catalog/view/theme/&lt;?php echo $this-&gt;config-&gt;get('config_template');?&gt;/stylesheet/superfish.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="catalog/view/theme/&lt;?php echo $this-&gt;config-&gt;get('config_template');?&gt;/stylesheet/slideshow.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="catalog/view/theme/&lt;?php echo $this-&gt;config-&gt;get('config_template');?&gt;/stylesheet/jquery.prettyPhoto.css" rel="stylesheet" type="text/css" /&gt;
  &lt;?php foreach ($styles as $style) { ?&gt;
  &lt;link rel="&lt;?php echo $style['rel']; ?&gt;" type="text/css" href="&lt;?php echo $style['href']; ?&gt;" media="&lt;?php echo $style['media']; ?&gt;" /&gt;
  &lt;?php } ?&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery/jquery-1.7.1.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery/ui/jquery-ui-1.8.16.custom.min.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/ui/themes/ui-lightness/jquery-ui-1.8.16.custom.css" /&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery/ui/external/jquery.cookie.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery/fancybox/jquery.fancybox-1.3.4.pack.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/fancybox/jquery.fancybox-1.3.4.css" media="screen" /&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery/colorbox/jquery.colorbox.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery/jquery.jcarousel.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery/jquery.cycle.js"&gt;&lt;/script&gt;
  &lt;link href="catalog/view/theme/&lt;?php echo $this-&gt;config-&gt;get('config_template'); ?&gt;/stylesheet/skin.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/colorbox/colorbox.css" media="screen" /&gt;
  &lt;link href='//fonts.googleapis.com/css?family=Krona+One' rel='stylesheet' type='text/css'&gt;
  &lt;link href='//fonts.googleapis.com/css?family=Oswald:400,700' rel='stylesheet' type='text/css'&gt;
  
  &lt;!--[if IE]&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery/fancybox/jquery.fancybox-1.3.4-iefix.js"&gt;&lt;/script&gt;
  &lt;![endif]--&gt;
  &lt;!--[if lt IE 8]&gt;&lt;div style='clear:both;height:59px;padding:0 15px 0 15px;position:relative;z-index:10000;text-align:center;'&gt;&lt;a href="http://www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode"&gt;&lt;img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." /&gt;&lt;/a&gt;&lt;/div&gt;&lt;![endif]--&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery/tabs.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery/easyTooltip.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/common.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jQuery.equalHeights.js"&gt;&lt;/script&gt;
  &lt;script type="text/JavaScript" src="catalog/view/javascript/cloud-zoom.1.0.2.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery.prettyPhoto.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jscript_zjquery.anythingslider.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/superfish.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery.bxSlider.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/script.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/jquery/nivo-slider/jquery.nivo.slider.pack.js"&gt;&lt;/script&gt;
  &lt;?php foreach ($scripts as $script) { ?&gt;
  &lt;script type="text/javascript" src="&lt;?php echo $script; ?&gt;"&gt;&lt;/script&gt;
  &lt;?php } ?&gt;
  &lt;!--[if  IE 8]&gt;
      &lt;style&gt;
          .success, #header #cart .content  { border:1px solid #e7e7e7;}
      &lt;/style&gt;
  &lt;![endif]--&gt;
  
  &lt;!--[if  IE 7]&gt;
  &lt;link rel="stylesheet" type="text/css" href="catalog/view/theme/&lt;?php echo $this-&gt;config-&gt;get('config_template');?&gt;/stylesheet/ie7.css" /&gt;
  &lt;![endif]--&gt;
  &lt;!--[if lt IE 7]&gt;
  &lt;link rel="stylesheet" type="text/css" href="catalog/view/theme/&lt;?php echo $this-&gt;config-&gt;get('config_template');?&gt;/stylesheet/ie6.css" /&gt;
  &lt;script type="text/javascript" src="catalog/view/javascript/DD_belatedPNG_0.0.8a-min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  DD_belatedPNG.fix('#logo img');
  &lt;/script&gt;
  &lt;![endif]--&gt;
  &lt;link rel="stylesheet" type="text/css" href="catalog/view/theme/&lt;?php echo $this-&gt;config-&gt;get('config_template');?&gt;/stylesheet/livesearch.css"/&gt;
  &lt;?php if ($stores) { ?&gt;
  &lt;script type="text/javascript"&gt;&lt;!--
  $(document).ready(function() {
  &lt;?php foreach ($stores as $store) { ?&gt;
  $('body').prepend('&lt;iframe src="&lt;?php echo $store; ?&gt;" style="display: none;"&gt;&lt;/iframe&gt;');
  &lt;?php } ?&gt;
  });
  //--&gt;&lt;/script&gt;
  &lt;?php } ?&gt;
  &lt;?php echo $google_analytics; ?&gt;
  &lt;/head&gt;
  &lt;body class="&lt;?php echo empty($this-&gt;request-&gt;get['route']) ? 'common-home' : str_replace('/', '-', $this-&gt;request-&gt;get['route']); ?&gt;"&gt;
  &lt;div class="bg-1"&gt;
  &lt;div class="main-shining"&gt;
  &lt;div class="row-1"&gt;
  &lt;div id="header"&gt;
      &lt;div class="toprow"&gt;
          &lt;div class="outer1"&gt;
  
              &lt;?php echo $currency; ?&gt;
              &lt;div id="welcome"&gt;
                  &lt;?php if (!$logged) { ?&gt;
                  &lt;?php echo $text_welcome; ?&gt;
                  &lt;?php } else { ?&gt;
                  &lt;?php echo $text_logged; ?&gt;
                  &lt;?php } ?&gt;
              &lt;/div&gt;
              &lt;div class="phone"&gt;
                  &lt;?php echo $telephone; ?&gt;
              &lt;/div&gt;
              &lt;?php echo $language; ?&gt;
              &lt;div class="clear"&gt;&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="outer1"&gt;
      &lt;?php if ($logo) { ?&gt;
      &lt;div id="logo"&gt;&lt;a href="&lt;?php echo $home; ?&gt;"&gt;&lt;img src="&lt;?php echo $logo; ?&gt;" title="&lt;?php echo $name; ?&gt;" alt="&lt;?php echo $name; ?&gt;" /&gt;&lt;/a&gt;&lt;/div&gt;
      &lt;?php } ?&gt;
      &lt;div class="header-top1"&gt; 
          &lt;div id="search"&gt;
              &lt;div class="button-search"&gt;&lt;/div&gt;
              &lt;input type="text" name="search" placeholder="&lt;?php echo $text_search; ?&gt;" value="&lt;?php echo $search; ?&gt;" /&gt;
          &lt;/div&gt;
          &lt;div class="clear"&gt;&lt;/div&gt;
          &lt;div class="cart-position"&gt;
              &lt;div class="cart-inner"&gt;&lt;?php echo $cart; ?&gt;&lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="clear"&gt;&lt;/div&gt;
          &lt;div class="topmenu"&gt;
              &lt;ul class="links"&gt;
                  &lt;?php if (!isset($this-&gt;request-&gt;get['route'])) { $route='active'; }  else {$route='';}?&gt; &lt;li class="first"&gt;&lt;a class="&lt;?php echo $route; if (isset($this-&gt;request-&gt;get['route']) &amp;&amp; $this-&gt;request-&gt;get['route']=="common/home") {echo "active";} ?&gt;" href="&lt;?php echo $home; ?&gt;"&gt;&lt;?php echo $text_home; ?&gt;&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a class="&lt;?php if (isset($this-&gt;request-&gt;get['route']) &amp;&amp; $this-&gt;request-&gt;get['route']=="account/wishlist") {echo "active";} ?&gt;" href="&lt;?php echo $wishlist; ?&gt;" id="wishlist-total"&gt;&lt;?php echo $text_wishlist; ?&gt;&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a class="&lt;?php if (isset($this-&gt;request-&gt;get['route']) &amp;&amp; $this-&gt;request-&gt;get['route']=="account/account") {echo "active";} ?&gt;" href="&lt;?php echo $account; ?&gt;"&gt;&lt;?php echo $text_account; ?&gt;&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a class="&lt;?php if (isset($this-&gt;request-&gt;get['route']) &amp;&amp; $this-&gt;request-&gt;get['route']=="checkout/cart") {echo "active";} ?&gt;" href="&lt;?php echo $shopping_cart; ?&gt;"&gt;&lt;?php echo $text_shopcart; ?&gt;&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a class="&lt;?php if (isset($this-&gt;request-&gt;get['route']) &amp;&amp; $this-&gt;request-&gt;get['route']=="checkout/checkout") {echo "active";} ?&gt;" href="&lt;?php echo $checkout; ?&gt;"&gt;&lt;?php echo $text_checkout; ?&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
              &lt;div class="clear"&gt;&lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="clear"&gt;&lt;/div&gt;
  
          &lt;/div&gt;
      &lt;div class="clear"&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="clear"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="clear"&gt;&lt;/div&gt;
  &lt;div id="menu"&gt;
    &lt;script type="text/javascript"&gt;
              $(document).ready(function(){
  
                  $('.menu ul li').last().addClass('last');
                  $('.menu ul li li').last().addClass('last');
              });
  
          &lt;/script&gt;
    &lt;?php if ($categories) { ?&gt;
    &lt;ul  class="menu"&gt;
      &lt;?php $cv=0;?&gt;
      &lt;?php foreach ($categories as $category) { $cv++; ?&gt;
      &lt;?php if ($category['category_id'] == $category_id) { ?&gt;
      &lt;li class="active cat_&lt;?php echo $cv ?&gt;"&gt;
        &lt;?php } else { ?&gt;
      &lt;li class="cat_&lt;?php echo $cv ?&gt;"&gt;
        &lt;?php } ?&gt;
        &lt;a href="&lt;?php echo $category['href']; ?&gt;"&gt;&lt;?php echo $category['name']; ?&gt;&lt;/a&gt;
        &lt;?php if ($category['children']) { ?&gt;
  
              &lt;?php for ($i = 0; $i &lt; count($category['children']);) { ?&gt;
              &lt;ul&gt;
                &lt;?php $j = $i + ceil(count($category['children']) / $category['column']); ?&gt;
                &lt;?php for (; $i &lt; $j; $i++) { ?&gt;
                &lt;?php if (isset($category['children'][$i])) { ?&gt;
                &lt;?php $id=$category['children'][$i]['category_id'];?&gt;
                &lt;?php if ( $id == $child_id) { ?&gt;
                &lt;li class="active"&gt;
                  &lt;?php } else { ?&gt;
                &lt;li&gt;
                  &lt;?php } ?&gt;
                  &lt;?php if ($category['children'][$i]['children3']) {?&gt;
                  &lt;a class="screenshot1"  href="&lt;?php echo $category['children'][$i]['href']; ?&gt;"&gt;&lt;?php echo $category['children'][$i]['name'];?&gt;&lt;/a&gt;
                  &lt;ul&gt;
                    &lt;?php foreach ($category['children'][$i]['children3'] as $ch3) { ?&gt;
                    &lt;li&gt;
                      &lt;?php if ($ch3['category_id'] == $ch3_id) { ?&gt;
                      &lt;a href="&lt;?php echo $ch3['href']; ?&gt;" class="active"&gt;&lt;?php echo $ch3['name']; ?&gt;&lt;/a&gt;
                      &lt;?php } else { ?&gt;
                      &lt;a href="&lt;?php echo $ch3['href']; ?&gt;"&gt;&lt;?php echo $ch3['name']; ?&gt;&lt;/a&gt;
                      &lt;?php } ?&gt;
                    &lt;/li&gt;
                    &lt;?php } ?&gt;
                  &lt;/ul&gt;
                  &lt;?php } else {?&gt;
                  &lt;a class="screenshot1"  href="&lt;?php echo $category['children'][$i]['href']; ?&gt;"&gt;&lt;?php echo $category['children'][$i]['name'];?&gt;&lt;/a&gt;
                &lt;?php }?&gt;
                &lt;/li&gt;
                &lt;?php } ?&gt;
                &lt;?php } ?&gt;
              &lt;/ul&gt;
              &lt;?php } ?&gt;
        &lt;?php } ?&gt;
      &lt;/li&gt;
      &lt;?php } ?&gt;
    &lt;/ul&gt;
    &lt;?php } ?&gt;
    &lt;div class="clear"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;?php if ($modules) {?&gt;
  &lt;div class="header-modules"&gt;
    &lt;?php foreach ($modules as $module) { ?&gt;
    &lt;?php echo $module; ?&gt;
    &lt;?php } ?&gt;
    &lt;div class="clear"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;?php }?&gt;
  &lt;div class="main-container"&gt;
  &lt;p id="back-top"&gt; &lt;a href="#top"&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt; &lt;/p&gt;
  &lt;div id="container"&gt;
  &lt;div id="notification"&gt; &lt;/div&gt;
  </code></pre>
  
  <p>I think it should be ok, any clue why the functions $('.success').fadeIn('slow'); / $('#cart-total').html(json['total']); are not working?</p>
  
  <p>I tried to change to the default template and the same problem appears, so maybe its no problem with the template?</p>