diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-07-29 10:14:39 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-07-29 10:14:39 +0000 |
| commit | 183e81ec22b7fb4e164fb222fa772c3765fa691a (patch) | |
| tree | e8f6f5433c9773ad8ea84c47a322a97c04d51979 /src/pages | |
| parent | d980e4f1621f33edfbfb94c138be26edb30e60c8 (diff) | |
| parent | 7c2a69c9b48c1930dc3f7cbef20d6479b3047ca2 (diff) | |
Merged in Feature/category-management (pull request #180)
Feature/category management
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/index.jsx | 10 | ||||
| -rw-r--r-- | src/pages/shop/lob/[slug].jsx | 49 |
2 files changed, 53 insertions, 6 deletions
diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 30a7ac1f..64c880c7 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -45,9 +45,9 @@ const FlashSale = dynamic( } ); -const ProgramPromotion = dynamic(() => - import('@/lib/home/components/PromotionProgram') -); +// const ProgramPromotion = dynamic(() => +// import('@/lib/home/components/PromotionProgram') +// ); const BannerSection = dynamic(() => import('@/lib/home/components/BannerSection') @@ -138,7 +138,7 @@ export default function Home({categoryId}) { </div> {!auth?.feature?.soApproval && ( <> - <ProgramPromotion /> <FlashSale /> + {/* <ProgramPromotion /> <FlashSale /> */} </> )} <PromotinProgram /> @@ -168,7 +168,7 @@ export default function Home({categoryId}) { {!auth?.feature?.soApproval && ( <> <DelayRender renderAfter={400}> - <ProgramPromotion /> + {/* <ProgramPromotion /> */} </DelayRender> <DelayRender renderAfter={600}> <FlashSale /> diff --git a/src/pages/shop/lob/[slug].jsx b/src/pages/shop/lob/[slug].jsx index 2153b565..cdaf3c91 100644 --- a/src/pages/shop/lob/[slug].jsx +++ b/src/pages/shop/lob/[slug].jsx @@ -24,8 +24,55 @@ export default function CategoryDetail() { const categoryName = getNameFromSlug(slug); const lobId = getIdFromSlug(slug); const q = router?.query.q || null; + + useEffect(() => { + if(router.pathname.includes('lob')){ + const loadProduct = async () => { + const lobData = await odooApi('GET', `/api/v1/lob_homepage/${lobId}/category_id`); + + if (lobData) { + setDataLob(lobData); + } + }; + loadProduct(); + + } + }, [lobId]); + + useEffect(() => { + if (router.pathname.includes('lob')){ + + const fetchCategoryData = async () => { + if (dataLob[0]?.categoryIds) { + + for (const cate of dataLob[0].categoryIds) { + + dataIdCategories.push(cate.childId) + } + + + setData(dataIdCategories.flat()) + + // const newQuery = { + // fq: `category_id_ids:(${mergedArray.join(' OR ')})`, + // category : router.query.category? router.query.category : '', + // page : router.query.page? router.query.page : 1, + // brand : router.query.brand? router.query.brand : '', + // priceFrom, + // priceTo, + // limit, + // orderBy + // }; + + // setFinalQuery(newQuery); + + } + }; + fetchCategoryData(); + } + }, [dataCategoriesProduct, dataLob]); const query = { - fq: `id:${lobId}`, + fq: `category_id_ids:(${data.join(' OR ')})`, page, }; if (q) { |
