Skip to content

Commit

Permalink
Merge pull request #252 from amansinghbais/fetchProductQueryUpdate
Browse files Browse the repository at this point in the history
Fixed: solr query for fetching products on count page
  • Loading branch information
ravilodhi authored Jan 12, 2024
2 parents 7b4a40b + dd15c84 commit 54aba65
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/store/modules/product/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,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 {
Expand Down

0 comments on commit 54aba65

Please sign in to comment.