News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Cart Icon Numbers Only

Started by Jack Stiles, August 21, 2018, 19:30:28 PM

Previous topic - Next topic

Jack Stiles

Hey guys - so I have this issue here. What I needed was to create a cart icon and put it to my menu header. But I ONLY needed icon + a tiny little number of how much products is in a cart. Something like shopify has in a top right corner:

https://debut-demo.myshopify.com/

So what I did - I have published a VM - Shopping cart module in a header and I used a CSS to disable everything except number. But - it say "2 items" for example and it also says "cart is empty" when theres nothing in a cart. I tried to edit default.php file in tmpl but I cannot find a way to get rid of those texts :-D I only need numbers like 2 or 15 or so... Is there a way to do it?

Btw. I am on latest Joomla and latest VMart. ;-)

GJC Web Design

think $data->totalProduct is just a number ...  but don't think it updates by ajax - only on refresh

to ajax it add

$(module).find(".cart_total").html(datas.totalProduct);

to the vm cart mod js

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

Jack Stiles

Wow! So your solution made me think and I found this line:

<div class="total_products"><?php echo  $data->totalProductTxt ?></div>

I simply removed the Txt and now I only have a numbers there :-) Thanks mate!

GJC Web Design

then u will need to change in the js

$(module).find(".total_products").html(   datas.totalProductTxt);

to

$(module).find(".total_products").html(   datas.totalProduct);
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

Jack Stiles