From 3ea1f49b036bfa352106142866f454bde2c61e02 Mon Sep 17 00:00:00 2001
From: Mqdd <ahmadmiqdad27@gmail.com>
Date: Thu, 4 Dec 2025 14:29:08 +0700
Subject: <Miqdad> fix image mobile variant

---
 src/lib/product/components/Product/ProductMobileVariant.jsx | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'src/lib/product/components/Product/ProductMobileVariant.jsx')

diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx
index 0f4953df..9d375deb 100644
--- a/src/lib/product/components/Product/ProductMobileVariant.jsx
+++ b/src/lib/product/components/Product/ProductMobileVariant.jsx
@@ -181,6 +181,11 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
     return Math.floor(Math.random() * 100) + 1;
   });
 
+  const getImageVariant = (img) => {
+    if (!img || img.trim() === '') return '/images/noimage.jpeg';
+    return `${img}?variant=True`;
+  };
+
   return (
     <MobileView>
       <div className='relative'>
@@ -338,7 +343,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
       </div>
 
       <Image
-        src={product.image + '?variant=True'}
+        src={getImageVariant(product?.image)}
         alt={product.name}
         className='h-72 object-contain object-center w-full border-b border-gray_r-4'
       />
@@ -532,7 +537,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
         <div className='flex mt-4'>
           <div className='w-[15%]'>
             <Image
-              src={product.image + '?variant=True'}
+              src={getImageVariant(product?.image)}
               alt={product.name}
               className='h-20 object-contain object-center w-full border border-gray_r-4'
             />
-- 
cgit v1.2.3

