From eec7e0e904a7fb9d61ee0869018c6816786d6b87 Mon Sep 17 00:00:00 2001 From: Disha Date: Fri, 31 Dec 2021 17:41:20 +0530 Subject: [PATCH 1/7] Implemented the logic to apply filters(1xc2eqg) --- src/views/product-details.vue | 55 +++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/src/views/product-details.vue b/src/views/product-details.vue index 47fe6aeb3..01a5c7751 100644 --- a/src/views/product-details.vue +++ b/src/views/product-details.vue @@ -33,7 +33,7 @@ {{ $t("Colors") }} - {{ colorFeature }} + {{ colorFeature }} @@ -41,7 +41,7 @@ {{ $t("Sizes") }} - {{ sizeFeature }} + {{ sizeFeature }} @@ -253,7 +253,8 @@ export default defineComponent({ selectedVariants: {} as any, cusotmerLoyaltyOptions : JSON.parse(process.env?.VUE_APP_CUST_LOYALTY_OPTIONS), cusotmerLoyalty: '', - hasPromisedDate: true + hasPromisedDate: true, + allVariants: this.current } }, computed: { @@ -268,6 +269,54 @@ export default defineComponent({ }) }, methods: { + filterSize(size: any){ + let products = [] as any; + this.current.list.items.forEach((x: any)=>{ + products.push(this.getProduct(x.groupValue)); + }) + const FilteredProducts =[] as any; + + products = products.filter((product: any)=>{ + return product.productFeatures.includes("Size/" + size); + + }) + console.log(products); + this.current.list.items.forEach((x: any)=>{ + products.forEach((product: any)=>{ + + if(x.groupValue == product.productId) + FilteredProducts.push(x); + }) + + }) + this.current.list.items = FilteredProducts; + + }, + filterColor(color: any){ + console.log(this.current.list.items) + let products = [] as any; + this.current.list.items.forEach((x: any)=>{ + products.push(this.getProduct(x.groupValue)); + }) + const FilteredProducts =[] as any; + + products = products.filter((product: any)=>{ + return product.productFeatures.includes("Color/" + color); + + }) + console.log(products); + this.current.list.items.forEach((x: any)=>{ + products.forEach((product: any)=>{ + + if(x.groupValue == product.productId) + FilteredProducts.push(x); + }) + + }) + this.current.list.items = FilteredProducts; + console.log(FilteredProducts); + console.log(this.current.list.items); + }, async getVariantProducts() { const payload = { groupByField: 'productId', From 4b94ac9f83aeed36a9ef0dbebd8dc7a747931b3e Mon Sep 17 00:00:00 2001 From: Disha Date: Mon, 3 Jan 2022 18:58:57 +0530 Subject: [PATCH 2/7] Improved the logic to show products variant on the basis of the selected attribute(#1xc2eqg) --- src/views/product-details.vue | 136 ++++++++++++++++++---------------- 1 file changed, 72 insertions(+), 64 deletions(-) diff --git a/src/views/product-details.vue b/src/views/product-details.vue index 01a5c7751..370680562 100644 --- a/src/views/product-details.vue +++ b/src/views/product-details.vue @@ -116,7 +116,7 @@
- +
@@ -161,7 +161,7 @@ -