VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: ibnati on June 21, 2018, 07:23:38 AM

Title: How to Show Total Products added on cart in the add to cart popup
Post by: ibnati on June 21, 2018, 07:23:38 AM

hello

i want Show Total number of Products added in the cart   in the add to cart popup

also i used this cod but it don't show the correct number of products added to the cart as you look here https://www.screencast.com/t/5ExwsZL9su

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


how can i fix this please ?

Title: Re: How to Show Total Products added on cart in the add to cart popup
Post by: GJC Web Design on June 21, 2018, 09:06:32 AM
if u mean the add to cart "product added" popup it is rendered by the file

com_virtuemart\views\cart\tmpl\padded.php

over ride that and the total should be available as

count($this->products)

if this hasn't the correct quantity check what else is available in $this

or within the loop do a cumulative count to find the total
Title: Re: How to Show Total Products added on cart in the add to cart popup
Post by: Jörgen on June 21, 2018, 11:37:18 AM
I guess count($this->products) would not give the correct answer if You order more than one from an item. As GJC said check $this for more info.

Jörgen @ Kreativ Fotografi
Title: Re: How to Show Total Products added on cart in the add to cart popup
Post by: ibnati on June 22, 2018, 02:31:11 AM
ok thanks , also how to get the same number that is on the cart module https://www.screencast.com/t/ejjsu815  ?

thanks
amine
Title: Re: How to Show Total Products added on cart in the add to cart popup
Post by: GJC Web Design on June 22, 2018, 12:07:25 PM
within the loop do a cumulative count to find the total
Title: Re: How to Show Total Products added on cart in the add to cart popup
Post by: ibnati on June 22, 2018, 16:19:47 PM
can you please tell me what is the cod that i must add to get it ?
Title: Re: How to Show Total Products added on cart in the add to cart popup
Post by: jenkinhill on June 22, 2018, 16:38:32 PM
(https://image.ibb.co/bJD9po/cod.jpg) (https://ibb.co/fmY9po)
Title: Re: How to Show Total Products added on cart in the add to cart popup
Post by: ibnati on June 22, 2018, 17:31:15 PM
your cod is not workings  ;D

can you please tell what the php cod that i must add to fix this ?

Title: Re: How to Show Total Products added on cart in the add to cart popup
Post by: GJC Web Design on June 22, 2018, 17:41:11 PM
Afraid when code starts getting written then the wallet has to come out...  you can PM me if u want to go further