From 812d7814b8facba4a526c8c53e4a67aea7dc74f5 Mon Sep 17 00:00:00 2001 From: amansinghbais <singh11amanbais@gmail.com> Date: Fri, 12 Jan 2024 19:02:06 +0530 Subject: [PATCH 1/2] Fixed: solr query for fetching products on count page --- src/store/modules/product/actions.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/store/modules/product/actions.ts b/src/store/modules/product/actions.ts index 354473df..94f022a5 100644 --- a/src/store/modules/product/actions.ts +++ b/src/store/modules/product/actions.ts @@ -28,7 +28,6 @@ const actions: ActionTree<ProductState, RootState> = { } const productQueryPayload = prepareProductQuery(params) resp = await ProductService.fetchProducts(productQueryPayload) - // resp.data.response.numFound tells the number of items in the response if (resp.status === 200 && resp.data.response?.numFound > 0 && !hasError(resp)) { let products = resp.data.response.docs; @@ -97,10 +96,17 @@ const actions: ActionTree<ProductState, RootState> = { if(currentProduct) { commit(types.PRODUCT_CURRENT_UPDATED, { product: currentProduct }) } else { - const resp = await ProductService.fetchProducts({ - // used sku as we are currently only using sku to search for the product - "filters": ['sku: ' + payload, 'isVirtual: false'], - }) + // used sku as we are currently only using sku to search for the product + const params = { + filters: { + isVirtual: { value: 'false' }, + sku: { value: payload } + } + } + const productQueryPayload = prepareProductQuery(params) + + const resp = await ProductService.fetchProducts(productQueryPayload) + if(resp.status === 200 && !hasError(resp) && resp.data.response?.numFound > 0) { commit(types.PRODUCT_CURRENT_UPDATED, { product: resp.data.response.docs[0] }) } else { From dd15c8445d366d9f46b4525e6abda17c238e5f5c Mon Sep 17 00:00:00 2001 From: amansinghbais <singh11amanbais@gmail.com> Date: Fri, 12 Jan 2024 19:04:58 +0530 Subject: [PATCH 2/2] Reverted: unwanted changes in actions --- src/store/modules/product/actions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/store/modules/product/actions.ts b/src/store/modules/product/actions.ts index 94f022a5..391015bf 100644 --- a/src/store/modules/product/actions.ts +++ b/src/store/modules/product/actions.ts @@ -28,6 +28,7 @@ const actions: ActionTree<ProductState, RootState> = { } const productQueryPayload = prepareProductQuery(params) resp = await ProductService.fetchProducts(productQueryPayload) + // resp.data.response.numFound tells the number of items in the response if (resp.status === 200 && resp.data.response?.numFound > 0 && !hasError(resp)) { let products = resp.data.response.docs;