Hi,
how can I add a red "1" on our cart icon right at the top if somebody add an article to cart?
Or is there another possibility for my problem?
I need a shopping cart that shows when someone has inserted something.
URL: https://optikpark-rathenow.de/shop-phoca
cart icon with a "1"
-
- Phoca Member
- Posts: 46
- Joined: 21 Sep 2018, 11:34
Re: cart icon with a "1"
you can check how I did it at shop.symposium-restaurant.de (on mobile only!)
But you will need a list of the products in the cart on the page...
JS:
var summi = 0;
jQuery('.ph-cart-small-quantity').each(function() { summi += parseInt(jQuery(this).text().charAt(0)) });
jQuery('#phItemCartBoxCount').html(summi);
if (jQuery('#phItemCartBoxCount').html() == "0" || jQuery('#phItemCartBoxCount').html() === "") { jQuery('sup#phItemCartBoxCount').hide(); }
(this works only max 9 per product ! I know...)
But you will need a list of the products in the cart on the page...
JS:
var summi = 0;
jQuery('.ph-cart-small-quantity').each(function() { summi += parseInt(jQuery(this).text().charAt(0)) });
jQuery('#phItemCartBoxCount').html(summi);
if (jQuery('#phItemCartBoxCount').html() == "0" || jQuery('#phItemCartBoxCount').html() === "") { jQuery('sup#phItemCartBoxCount').hide(); }
(this works only max 9 per product ! I know...)
-
- Phoca Member
- Posts: 46
- Joined: 21 Sep 2018, 11:34
Re: cart icon with a "1"
I'm actually not sure why I put that chatAt(0) there...please check
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: cart icon with a "1"
Hi, it depends on template, some templates are ready to display the top modules in row with "1", etc. see:
https://www.phoca.cz/documents/116-phoc ... 5-template
So you can try to download the overrides and paste to your template:
https://www.phoca.cz/phocacart-extensions/5-overrides
Jan
https://www.phoca.cz/documents/116-phoc ... 5-template
So you can try to download the overrides and paste to your template:
https://www.phoca.cz/phocacart-extensions/5-overrides
Jan
If you find Phoca extensions useful, please support the project