cart icon with a "1"

Phoca Cart - complex e-commerce extension
webprojekte
Phoca Member
Phoca Member
Posts: 13
Joined: 13 May 2020, 16:31

cart icon with a "1"

Post by webprojekte »

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
maintainthedomain
Phoca Member
Phoca Member
Posts: 46
Joined: 21 Sep 2018, 11:34

Re: cart icon with a "1"

Post by maintainthedomain »

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...)
maintainthedomain
Phoca Member
Phoca Member
Posts: 46
Joined: 21 Sep 2018, 11:34

Re: cart icon with a "1"

Post by maintainthedomain »

I'm actually not sure why I put that chatAt(0) there...please check
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: cart icon with a "1"

Post by Jan »

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
If you find Phoca extensions useful, please support the project
Post Reply