Problem/Motivation

The cart count in the block currently shows the unique amount of products. I some cases we might want to show the total quantity of alle the products.

Proposed resolution

Add a configuration on the block level to choose if we want to show the quantity of products or total items.

Comments

harings_rob created an issue. See original summary.

harings_rob’s picture

StatusFileSize
new2.92 KB
AlexeiK’s picture

StatusFileSize
new1.04 KB
new3.12 KB

There was a small issue with counter implementation, the patch fixes this.

mglaman’s picture

Assigned: Unassigned » mglaman
Status: Needs review » Needs work
+++ b/js/module.es6.js
@@ -53,7 +53,14 @@
+            for (var j in json[i].order_items) {
+              count += parseInt(json[i].order_items[j].quantity);
+            }

We can use `.reduce` here since it is an array.

Also, there was no change in the schema.yml definition. :P there is no schema.yml, we'll need to add one.

mglaman’s picture

Status: Needs work » Needs review
StatusFileSize
new4.17 KB

Here is an updated patch.

  • mglaman committed 5f85259 on 8.x-1.x
    Issue #2989072 by AlexeiK, harings_rob, mglaman: Cart counter: show...
mglaman’s picture

Assigned: mglaman » Unassigned
Status: Needs review » Fixed

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.