This commit is contained in:
pushuo 2022-06-27 20:47:32 +08:00
parent 447eb80968
commit 9146add594
2 changed files with 8 additions and 8 deletions

View File

@ -36,10 +36,10 @@ class ProductRepo
* @param $categoryIds
* @return array
*/
public static function getProductsByCategories($categoryIds): array
public static function getProductsByCategories($categoryIds)
{
$products = self::getProductsByCategory($categoryIds);
$items = collect($products)->groupBy('category_id')->jsonSerialize();
$items = $products->groupBy('category_id');
return $items;
}
@ -50,11 +50,11 @@ class ProductRepo
* @param $categoryId
* @return array
*/
public static function getProductsByCategory($categoryId): array
public static function getProductsByCategory($categoryId)
{
$builder = self::getProductsBuilder($categoryId);
$products = $builder->get();
$items = ProductList::collection($products)->jsonSerialize();
$items = ProductList::collection($products);
return $items;
}

View File

@ -1,8 +1,8 @@
<div class="product-wrap">
<div class="image"><img src="{{ $product['image'] }}" class="img-fluid"></div>
<div class="product-name">{{ $product['name'] }}</div>
<div class="image"><a href="{{ $product->url }}"><img src="{{ $product->image }}" class="img-fluid"></a></div>
<div class="product-name">{{ $product->description->name }}</div>
<div class="product-price">
<span class="price-new">$55.00</span>
<span class="price-lod">$125.00</span>
<span class="price-new">{{ $product->master_sku->price }}</span>
<span class="price-lod">{{ $product->master_sku->origin_price }}</span>
</div>
</div>