In the standard OpenCart template, there is a $ cart variable that displays the button for the current state of the user's cart. This displays the total number of items in the cart and the total amount of items ordered.

How to display the total number of products in the basket, for example, in the header of the site?

    1 answer 1

    1. In the /catalog/controller/common/header.php file add the following code to the index method:

      $ this-> data ['cart_total'] = $ this-> cart-> countProducts ();

    2. In your template, use the variable $ cart_total to display the number of products.