1404/11/11-add description in product
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
<!-- Product Image -->
|
||||
<div class="bg-gray-100 rounded-lg flex justify-center items-center p-3 min-w-[80px] h-[80px]">
|
||||
<img
|
||||
:src="getProductImage(item.product.group_type)"
|
||||
:src="getProductImage(item.product)"
|
||||
class="max-w-full max-h-full object-contain"
|
||||
alt=""
|
||||
/>
|
||||
@@ -165,7 +165,14 @@ const totalPrice = computed(() => {
|
||||
return cartStore.cartItems.reduce((sum, item) => sum + item.totalPrice, 0)
|
||||
})
|
||||
|
||||
function getProductImage(type?: string) {
|
||||
function getProductImage(product: any) {
|
||||
// Check if product has file field from server with src property
|
||||
if (product?.file?.src) {
|
||||
return product.file.src
|
||||
}
|
||||
|
||||
// Fallback to local images based on group_type if file is empty or doesn't exist
|
||||
const type = product?.group_type
|
||||
switch (type) {
|
||||
case 'گوی':
|
||||
return goyImg
|
||||
|
||||
Reference in New Issue
Block a user