From 130a4544cc5e0e1d4d001916152c316e104579ee Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Wed, 7 Jun 2023 19:23:34 +0800 Subject: [PATCH] Show SPU image for product list --- beike/Shop/Http/Resources/ProductSimple.php | 8 ++------ beike/Shop/Services/CheckoutService.php | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/beike/Shop/Http/Resources/ProductSimple.php b/beike/Shop/Http/Resources/ProductSimple.php index febc4359..61e43df2 100644 --- a/beike/Shop/Http/Resources/ProductSimple.php +++ b/beike/Shop/Http/Resources/ProductSimple.php @@ -30,12 +30,8 @@ class ProductSimple extends JsonResource throw new \Exception("invalid master sku for product {$this->id}"); } - $name = $this->description->name ?? ''; - if ($masterSku && $masterSku->images) { - $images = $masterSku->images; - } else { - $images = $this->images ?? []; - } + $name = $this->description->name ?? ''; + $images = $this->images; $data = [ 'id' => $this->id, diff --git a/beike/Shop/Services/CheckoutService.php b/beike/Shop/Services/CheckoutService.php index 3941fe9c..17701cc8 100644 --- a/beike/Shop/Services/CheckoutService.php +++ b/beike/Shop/Services/CheckoutService.php @@ -220,7 +220,7 @@ class CheckoutService public function initTotalService() { - $customer = $this->customer; + $customer = $this->customer; $totalClass = hook_filter('service.checkout.total_service', 'Beike\Shop\Services\TotalService'); $totalService = (new $totalClass($this->cart, CartService::list($customer, true))); $this->totalService = $totalService; @@ -240,7 +240,7 @@ class CheckoutService $cartList = CartService::list($customer, true); $carts = CartService::reloadData($cartList); - if (!$this->totalService) { + if (! $this->totalService) { $this->initTotalService(); }