News:

Looking for documentation? Take a look on our wiki

Main Menu

How to Show Total Products added on cart in the add to cart popup

Started by ibnati, June 21, 2018, 07:23:38 AM

Previous topic - Next topic

ibnati


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 ?


GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Jörgen

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
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

ibnati

ok thanks , also how to get the same number that is on the cart module https://www.screencast.com/t/ejjsu815  ?

thanks
amine

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

ibnati

can you please tell me what is the cod that i must add to get it ?

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

ibnati

your cod is not workings  ;D

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


GJC Web Design

Afraid when code starts getting written then the wallet has to come out...  you can PM me if u want to go further
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation