VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: ibnati on February 25, 2018, 18:49:34 PM

Title: show the total number Products in the add to cart popup
Post by: ibnati on February 25, 2018, 18:49:34 PM
hello

i want show the total number Products (carts Product) in the add to cart popup

also i used this cod in the padded.php

$cart = VirtueMartCart::getCart(); //getting cart object
$dat = $cart->cartProductsData;
echo "Total Product Count: " . count($dat)."\n";
$cart->prepareCartData();

but it does not show the the correct number

how can i fix this please ?
Title: Re: show the total number Products in the add to cart popup
Post by: Ghost on February 26, 2018, 08:22:51 AM
That shows the count of unique products. Try this instead:

$this->cart->prepareCartData();
echo $this->cart->totalProduct;
Title: Re: show the total number Products in the add to cart popup
Post by: ibnati on February 26, 2018, 14:50:50 PM
yes , thanks , this works greet