diff --git a/packages/api-client/package.json b/packages/api-client/package.json index 116dc4d5..4e146fc6 100644 --- a/packages/api-client/package.json +++ b/packages/api-client/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/odoo-api", - "version": "1.2.5", + "version": "1.2.6", "private": false, "sideEffects": false, "server": "server/index.js", diff --git a/packages/api-client/src/types/types.ts b/packages/api-client/src/types/types.ts index 8450e5b1..d4699016 100644 --- a/packages/api-client/src/types/types.ts +++ b/packages/api-client/src/types/types.ts @@ -93,6 +93,7 @@ export type OrderSortInput = { export type ProductFilterInput = { categoryId?: number[]; attributeValueId?: number[]; + attribValues?: string[]; minPrice?: number; maxPrice?: number; }; @@ -567,6 +568,7 @@ export interface AgnosticFacetSearchParams { sort?: string | string[]; filters?: Record; metadata?: any; + fetchCategory?: boolean; [x: string]: any; } export interface SearchResultParams { diff --git a/packages/composables/package.json b/packages/composables/package.json index ecc403ff..e4164d3e 100644 --- a/packages/composables/package.json +++ b/packages/composables/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/odoo", - "version": "1.2.5", + "version": "1.2.6", "private": false, "sideEffects": false, "main": "lib/index.cjs.js", @@ -19,7 +19,7 @@ "dependencies": { "@nuxtjs/composition-api": "0.31.0", "@vue-storefront/core": "2.5.4", - "@vue-storefront/odoo-api": "1.2.5" + "@vue-storefront/odoo-api": "1.2.6" }, "peerDependencies": { "@vue/composition-api": "1.2.5" diff --git a/packages/composables/src/composables/useFacet/index.ts b/packages/composables/src/composables/useFacet/index.ts index 1bd7f126..05bce331 100644 --- a/packages/composables/src/composables/useFacet/index.ts +++ b/packages/composables/src/composables/useFacet/index.ts @@ -21,17 +21,21 @@ const factoryParams = { filter: { categoryId: params?.input?.filter?.categoryId, attributeValueId: params.input?.filter?.attributeValueId?.map(id => parseInt(id)), + attribValues: params.input?.filter?.attribValues?.map(id => id), minPrice: parseInt(params?.input?.minPrice), maxPrice: parseInt(params?.input?.maxPrice) } }; - const { data } = await context.$odoo.api.getCategory(categoryParams, customQueryCategories); + let categoryResponse = null; + if (params.input.fetchCategory) { + categoryResponse = await context.$odoo.api.getCategory(categoryParams, customQueryCategories); + } const { data: productData } = await context.$odoo.api.getProductTemplatesList(productParams, customQueryProducts); return { - categories: data.categories.categories, + categories: categoryResponse?.data?.categories?.categories || null, products: productData.products.products, attributes: productData.products.attributeValues, itemsPerPage: 1, diff --git a/packages/theme/composables/useUiHelpers/index.ts b/packages/theme/composables/useUiHelpers/index.ts index ae571e26..72f3bf87 100644 --- a/packages/theme/composables/useUiHelpers/index.ts +++ b/packages/theme/composables/useUiHelpers/index.ts @@ -43,6 +43,7 @@ const useUiHelpers = (): any => { currentPage: page, minPrice: price?.[0] || null, maxPrice: price?.[1] || null, + fetchCategory: true, filter: { categoryId, attributeValueId: filters diff --git a/packages/theme/package.json b/packages/theme/package.json index 299a220f..4bdf9b4f 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/odoo-theme", - "version": "1.2.5", + "version": "1.2.6", "private": true, "scripts": { "build": "nuxt build -m --dotenv .env_production", @@ -25,7 +25,7 @@ "@vue-storefront/middleware": "2.5.4", "@vue-storefront/nuxt": "2.5.4", "@vue-storefront/nuxt-theme": "2.5.4", - "@vue-storefront/odoo": "1.2.5", + "@vue-storefront/odoo": "1.2.6", "cookie-universal-nuxt": "^2.1.3", "core-js": "^2.6.5", "nuxt": "2.15.6",