From 3701899613c02e547fecebf62f7105860d1a2b72 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 28 Apr 2023 15:57:13 +0700 Subject: product similar product detail and top banner --- .../product/components/Product/ProductDesktop.jsx | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/lib/product/components/Product') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index bb2b2db9..b1ec971b 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -11,7 +11,8 @@ import { updateItemCart } from '@/core/utils/cart' import { useRouter } from 'next/router' import { createSlug } from '@/core/utils/slug' import BottomPopup from '@/core/components/elements/Popup/BottomPopup' -import { Toast } from 'flowbite-react' +import ProductCard from '../ProductCard' +import productSimilarApi from '../../api/productSimilarApi' const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { const router = useRouter() @@ -85,6 +86,17 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { `fq=-manufacture_id_i:${product.manufacture?.id || 0}` ].join('&') + const [productSimilarInBrand, setProductSimilarInBrand] = useState(null) + + useEffect(() => { + const loadProductSimilarInBrand = async () => { + const productSimilarQuery = [product?.name, `fq=-product_id_i:${product.id}`].join('&') + const dataProductSimilar = await productSimilarApi({ query: productSimilarQuery }) + setProductSimilarInBrand(dataProductSimilar.products) + } + if (!productSimilarInBrand) loadProductSimilarInBrand() + }, [product, productSimilarInBrand]) + return (
@@ -209,6 +221,20 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { Wishlist
+ +
+
+ Produk Serupa +
+
+ {productSimilarInBrand && + productSimilarInBrand?.map((product) => ( +
+ +
+ ))} +
+
-- cgit v1.2.3 From db5d67db219a6672848115b556fd572cdba7c60c Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 2 May 2023 15:14:18 +0700 Subject: fix product --- src/lib/product/components/Product/ProductDesktop.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/lib/product/components/Product') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index b1ec971b..9ff782ce 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -60,7 +60,6 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { selected: true }) setAddCartAlert(true) - // toast.success('Berhasil menambahkan ke keranjang') } const handleBuy = (variantId) => { @@ -222,11 +221,11 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { -
+
Produk Serupa
-
+
{productSimilarInBrand && productSimilarInBrand?.map((product) => (
-- cgit v1.2.3 From 92b99c8d1d890766da55031f921601372d5b49a3 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 3 May 2023 09:14:02 +0700 Subject: default banner brand, whatsapp link, bug fix after transaction --- src/lib/product/components/Product/ProductDesktop.jsx | 6 +++--- src/lib/product/components/Product/ProductMobile.jsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/lib/product/components/Product') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 9ff782ce..dc22fcae 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -141,7 +141,7 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => {
{product?.weight > 0 && {product?.weight} KG} {product?.weight == 0 && ( - + Tanya Berat )} @@ -171,7 +171,7 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { ) : ( Hubungi kami untuk dapatkan harga terbaik,  - + klik disini @@ -269,7 +269,7 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { {variant.price.priceDiscount > 0 ? ( currencyFormat(variant.price.priceDiscount) ) : ( - + Call for price )} diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx index b75a191b..02cf0137 100644 --- a/src/lib/product/components/Product/ProductMobile.jsx +++ b/src/lib/product/components/Product/ProductMobile.jsx @@ -152,7 +152,7 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { ) : ( Hubungi kami untuk dapatkan harga terbaik,  - + klik disini @@ -236,7 +236,7 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { )} {activeVariant?.stock == 0 && ( - + Tanya Stok )} @@ -244,7 +244,7 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { {activeVariant?.weight > 0 && {activeVariant?.weight} KG} {activeVariant?.weight == 0 && ( - + Tanya Berat )} -- cgit v1.2.3 From 93832023b7c2f560bd90a02e9768d0fccec79078 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 3 May 2023 16:03:45 +0700 Subject: whatsapp url --- .../product/components/Product/ProductDesktop.jsx | 25 +++++++++++++++++++--- .../product/components/Product/ProductMobile.jsx | 25 +++++++++++++++++++--- 2 files changed, 44 insertions(+), 6 deletions(-) (limited to 'src/lib/product/components/Product') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index dc22fcae..39651eab 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -13,6 +13,7 @@ import { createSlug } from '@/core/utils/slug' import BottomPopup from '@/core/components/elements/Popup/BottomPopup' import ProductCard from '../ProductCard' import productSimilarApi from '../../api/productSimilarApi' +import whatsappUrl from '@/core/utils/whatsappUrl' const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { const router = useRouter() @@ -141,7 +142,13 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => {
{product?.weight > 0 && {product?.weight} KG} {product?.weight == 0 && ( - + Tanya Berat )} @@ -171,7 +178,13 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { ) : ( Hubungi kami untuk dapatkan harga terbaik,  - + klik disini @@ -269,7 +282,13 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { {variant.price.priceDiscount > 0 ? ( currencyFormat(variant.price.priceDiscount) ) : ( - + Call for price )} diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx index 02cf0137..426fe1b8 100644 --- a/src/lib/product/components/Product/ProductMobile.jsx +++ b/src/lib/product/components/Product/ProductMobile.jsx @@ -13,6 +13,7 @@ import MobileView from '@/core/components/views/MobileView' import { toast } from 'react-hot-toast' import { createSlug } from '@/core/utils/slug' import BottomPopup from '@/core/components/elements/Popup/BottomPopup' +import whatsappUrl from '@/core/utils/whatsappUrl' const ProductMobile = ({ product, wishlist, toggleWishlist }) => { const router = useRouter() @@ -152,7 +153,13 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { ) : ( Hubungi kami untuk dapatkan harga terbaik,  - + klik disini @@ -236,7 +243,13 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { )} {activeVariant?.stock == 0 && ( - + Tanya Stok )} @@ -244,7 +257,13 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { {activeVariant?.weight > 0 && {activeVariant?.weight} KG} {activeVariant?.weight == 0 && ( - + Tanya Berat )} -- cgit v1.2.3 From c31653ce684ac2f80368906658895bacc9b4c9a7 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 5 May 2023 15:33:30 +0700 Subject: height produk serupa di product detail --- .../product/components/Product/ProductDesktop.jsx | 171 +++++++++++---------- 1 file changed, 89 insertions(+), 82 deletions(-) (limited to 'src/lib/product/components/Product') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 39651eab..8ce6da00 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -101,63 +101,102 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => {
-
- {product.name} -
-
-

{product?.name}

-
-
-
Nomor SKU
-
SKU-{product.id}
-
-
-
Part Number
-
{product.code || '-'}
-
-
-
Manufacture
-
- {product.manufacture?.name ? ( - - {product.manufacture?.name} - - ) : ( -
-
- )} +
+
+ {product.name} +
+ +
+

{product?.name}

+
+
+
Nomor SKU
+
SKU-{product.id}
+
+
+
Part Number
+
{product.code || '-'}
+
+
+
Manufacture
+
+ {product.manufacture?.name ? ( + + {product.manufacture?.name} + + ) : ( +
-
+ )} +
+
+
+
Berat Barang
+
+ {product?.weight > 0 && {product?.weight} KG} + {product?.weight == 0 && ( + + Tanya Berat + + )} +
-
-
Berat Barang
-
- {product?.weight > 0 && {product?.weight} KG} - {product?.weight == 0 && ( - + +
-
+
{product.variants.length > 1 && product.lowestPrice.priceDiscount > 0 && (
Harga mulai dari:
)} @@ -238,7 +277,7 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => {
Produk Serupa
-
+
{productSimilarInBrand && productSimilarInBrand?.map((product) => (
@@ -327,38 +366,6 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => {
)} -
-
Informasi Produk
-
- {informationTabOptions.map((option) => ( - setInformationTab(option.value)} - > - {option.label} - - ))} -
-
-
- - - - - Belum ada informasi. -
-
-
-
Kamu Mungkin Juga Suka
-- cgit v1.2.3