From ee47abc95060bcb27307f5d594e7275eae84d8f0 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 3 Oct 2023 15:37:59 +0700 Subject: bugfix widget wa di page variant detail --- src/core/components/layouts/BasicLayout.jsx | 5 ++--- src/pages/shop/product/variant/[slug].jsx | 10 ++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/components/layouts/BasicLayout.jsx b/src/core/components/layouts/BasicLayout.jsx index e6bd4de0..9441dbd7 100644 --- a/src/core/components/layouts/BasicLayout.jsx +++ b/src/core/components/layouts/BasicLayout.jsx @@ -24,13 +24,12 @@ const BasicLayout = ({ children }) => { const router = useRouter() const { product } = useProductContext() - useEffect(() => { - if (router.pathname === '/shop/product/[slug]') { + if (router.pathname === '/shop/product/[slug]' || router.pathname === '/shop/product/variant/[slug]') { setPayloadWa({ name: product?.name, manufacture: product?.manufacture.name, - url: createSlug('/shop/product/', product?.name, product?.id, true) + url: process.env.NEXT_PUBLIC_SELF_HOST + router.asPath }) setTemplateWA('product') diff --git a/src/pages/shop/product/variant/[slug].jsx b/src/pages/shop/product/variant/[slug].jsx index ba2a79d5..88ac1c7f 100644 --- a/src/pages/shop/product/variant/[slug].jsx +++ b/src/pages/shop/product/variant/[slug].jsx @@ -6,6 +6,8 @@ import dynamic from 'next/dynamic' import { useRouter } from 'next/router' import cookie from 'cookie' import variantApi from '@/lib/product/api/variantApi' +import { useProductContext } from '@/contexts/ProductContext' +import { useEffect } from 'react' const BasicLayout = dynamic(() => import('@/core/components/layouts/BasicLayout')) const Product = dynamic(() => import('@/lib/product/components/Product/Product')) @@ -38,6 +40,14 @@ export async function getServerSideProps(context) { export default function ProductDetail({ product }) { const router = useRouter() + const { setProduct } = useProductContext() + + useEffect(() => { + if (product) { + setProduct(product) + } + }, [product, setProduct]) + if (!product) return return ( -- cgit v1.2.3 From d8ac722b56e3968c166fa17f8db3a323c7322ace Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 6 Oct 2023 08:55:49 +0700 Subject: Add label on google merchant xml --- src/pages/google_merchant/products/[page].js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js index eeda4347..352b2989 100644 --- a/src/pages/google_merchant/products/[page].js +++ b/src/pages/google_merchant/products/[page].js @@ -45,7 +45,10 @@ export async function getServerSideProps({ res, query }) { 'g:condition': { '#text': 'new' }, 'g:availability': { '#text': availability }, 'g:brand': { '#text': product.manufacture?.name || '' }, - 'g:price': { '#text': `${Math.round(product.lowestPrice.price * 1.11)} IDR` } + 'g:price': { '#text': `${Math.round(product.lowestPrice.price * 1.11)} IDR` }, + 'g:custom_label_0': { + '#text': product.stockTotal > 0 ? 'Stok Tersedia' : 'Stok Tidak Tersedia' + } } if (product.lowestPrice.discountPercentage > 0) { item['g:sale_price'] = { -- cgit v1.2.3 From 010cbf9ff08835ed0cf61e821ce4db79f744893c Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 6 Oct 2023 09:14:33 +0700 Subject: Update label on google merchant xml --- src/pages/google_merchant/products/[page].js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js index 352b2989..d6309090 100644 --- a/src/pages/google_merchant/products/[page].js +++ b/src/pages/google_merchant/products/[page].js @@ -45,11 +45,15 @@ export async function getServerSideProps({ res, query }) { 'g:condition': { '#text': 'new' }, 'g:availability': { '#text': availability }, 'g:brand': { '#text': product.manufacture?.name || '' }, - 'g:price': { '#text': `${Math.round(product.lowestPrice.price * 1.11)} IDR` }, - 'g:custom_label_0': { - '#text': product.stockTotal > 0 ? 'Stok Tersedia' : 'Stok Tidak Tersedia' - } + 'g:price': { '#text': `${Math.round(product.lowestPrice.price * 1.11)} IDR` } + } + + if (product.stockTotal == 0) { + item['g:custom_label_0'] = { '#text': 'Stok Tidak Tersedia' } + } else { + item['g:custom_label_1'] = { '#text': 'Stok Tersedia' } } + if (product.lowestPrice.discountPercentage > 0) { item['g:sale_price'] = { '#text': `${Math.round(product.lowestPrice.priceDiscount * 1.11)} IDR` -- cgit v1.2.3 From bfc9aed715521b3b9b603376161cf48dc0be0dea Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 9 Oct 2023 10:30:10 +0700 Subject: Add local font --- src/pages/_document.jsx | 3 ++- src/styles/globals.css | 44 ++++++++++++++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/pages/_document.jsx b/src/pages/_document.jsx index 5f3d2367..7db088d8 100644 --- a/src/pages/_document.jsx +++ b/src/pages/_document.jsx @@ -19,6 +19,7 @@ export default function MyDocument() { +