瀏覽代碼

add blank on missing image product

master
azri 1 月之前
父節點
當前提交
21064dc3c8

+ 2
- 1
src/components/ProductHistoryList/ProductHistoryList.jsx 查看文件

@@ -1,6 +1,7 @@
1 1
 import { useState, useEffect } from 'react';
2 2
 import { Box, Typography, IconButton, Pagination, Button } from '@mui/material';
3 3
 import { useSelector, useDispatch } from 'react-redux';
4
+import defaultImage from "../../assets/images/default.png"
4 5
 
5 6
 import Grid from '@mui/material/Grid2';
6 7
 
@@ -117,7 +118,7 @@ const ProductHistoryList = () => {
117 118
           let minPriceCurrency = minVariantPrice.currencyCode
118 119
           let maxPrice = maxVariantPrice.amount
119 120
           let maxPriceCurrency = maxVariantPrice.currencyCode
120
-          let img_url = images[0]?.url
121
+          let img_url = images[0]?.url || defaultImage
121 122
           let collection_name = collections[0]?.title
122 123
 
123 124
           if (index < 4) {

+ 2
- 1
src/components/ProductSuggestion/ProductSuggestion.jsx 查看文件

@@ -3,6 +3,7 @@ import { Box, Typography, Button } from '@mui/material';
3 3
 import { useSelector } from 'react-redux';
4 4
 import Grid from '@mui/material/Grid2';
5 5
 import { useNavigate } from "react-router-dom";
6
+import defaultImage from "../../assets/images/default.png"
6 7
 
7 8
 const ProductSuggestion = () => {
8 9
 
@@ -155,7 +156,7 @@ const ProductSuggestion = () => {
155 156
           let minPriceCurrency = minVariantPrice.currencyCode;
156 157
           let maxPrice = maxVariantPrice.amount;
157 158
           let maxPriceCurrency = maxVariantPrice.currencyCode;
158
-          let img_url = images[0]?.url;
159
+          let img_url = images[0]?.url || defaultImage
159 160
           let collection_name = collections[0]?.title;
160 161
 
161 162
           return renderProduct(

Loading…
取消
儲存