0

I am using Magento 1.9.2 and a theme I am making from the RWD theme. So,

what I want in my theme is to have the number of products that are in the cart to be shown in the cart icon. Like the image below.

amazon cart

Vaishal Patel
  • 399
  • 4
  • 24
  • What did you already try? There are lots of articles about the topic, i.e. [this SO Q&A](http://stackoverflow.com/questions/8925271/magento-how-to-get-cart-items-total-in-header-phtml) could help. – SaschaM78 Jan 26 '16 at 15:18
  • @SaschaM78 so far not attempted it as you can call me pretty new to magento. – Vaishal Patel Jan 26 '16 at 16:02
  • Especially then I would recommend to try around with to get used to the code and to get a better understanding what is going on behind the scenes. – SaschaM78 Jan 26 '16 at 16:12
  • @SaschaM78 Yeah good shout. just wanted pointers so I wasn't running into nothing. – Vaishal Patel Jan 26 '16 at 17:28

1 Answers1

1

Looking in the file minicart.phtml:

/app/design/frontend/vishlibrex/default/template/checkout/cart

it contains the line :

<span class="count"><?php echo $_cartQty; ?></span>

This ability is included in the rwd theme and the variable $_cartqty is defined as such:

<?php
      $_cartQty = $this->getSummaryCount();
      if(empty($_cartQty)) {
         $_cartQty = 0;
      }
?>

So, as the theme itself is a creation from the rwd theme it will include this by default. Add a product to the cart and the number will display. At the first visit/start you have no products in cart thus no count shown.

Vaishal Patel
  • 399
  • 4
  • 24