cek brand shipment

This commit is contained in:
merdan 2022-11-25 16:30:49 +05:00
parent ed6fb21bd5
commit 035f379c26
6 changed files with 13 additions and 13 deletions

View File

@ -72,12 +72,14 @@ class Products extends ProductController
}
public function newProducts(){
$products = $this->getRepositoryInstance()->getNewProducts();
$count = core()->getConfigData('catalog.products.homepage.no_of_featured_product_homepage');
$products = $this->getRepositoryInstance()->getNewProducts(10);
return $this->getResourceCollection($products);
}
public function featuredProducts(){
$products = $this->getRepositoryInstance()->getFeaturedProducts();
$products = $this->getRepositoryInstance()->getFeaturedProducts(10);
return $this->getResourceCollection($products);
}

View File

@ -17,8 +17,7 @@ class Slider extends JsonResource
return [
'id' => $this->id,
'title' => $this->title,
// 'image_url' => $this->mobile_image_url,
// 'mobile_url' => $this->image_url,
'image_url' => $this->mobile_image_url,
'content' => $this->content,
'expired_at'=> $this->expired_at,
'sort_order'=> $this->sort_order,

View File

@ -442,10 +442,8 @@ class ProductRepository extends PRepository
*
* @return \Illuminate\Support\Collection
*/
public function getNewProducts()
public function getNewProducts($count = 5)
{
$count = core()->getConfigData('catalog.products.homepage.no_of_new_product_homepage');
$results = app(ProductFlatRepository::class)->scopeQuery(function ($query) {
$channel = core()->getRequestedChannelCode();
@ -467,7 +465,7 @@ class ProductRepository extends PRepository
return $qb->inRandomOrder();
})->paginate($count ? $count : 5);
})->paginate($count);
return $results;
}
@ -476,9 +474,8 @@ class ProductRepository extends PRepository
*
* @return \Illuminate\Support\Collection
*/
public function getFeaturedProducts()
public function getFeaturedProducts($count = 5)
{
$count = core()->getConfigData('catalog.products.homepage.no_of_featured_product_homepage');
$results = app(ProductFlatRepository::class)->scopeQuery(function ($query) {
$channel = core()->getRequestedChannelCode();
@ -499,7 +496,7 @@ class ProductRepository extends PRepository
}
return $qb->inRandomOrder();
})->paginate($count ? $count : 5);
})->paginate($count);
return $results;
}

View File

@ -1,4 +1,5 @@
@if ($featured_products = app('TPS\Shop\Repositories\ProductRepository')->getFeaturedProducts())
@if ($featured_products = app('TPS\Shop\Repositories\ProductRepository')->getFeaturedProducts($count))
<div class="item-gallery-inner">
<div class="item-gallery-title">
<h2>{{__('shop::app.home.featured-products')}}</h2>

View File

@ -16,6 +16,7 @@
$metaKeywords = $homeSEO->meta_keywords;
}
$count = core()->getConfigData('catalog.products.homepage.no_of_featured_product_homepage');
@endphp
@section('page_title')

View File

@ -1,4 +1,4 @@
@if ($new_products = app('TPS\Shop\Repositories\ProductRepository')->getNewProducts())
@if ($new_products = app('TPS\Shop\Repositories\ProductRepository')->getNewProducts($count))
<div class="item-gallery-inner">
<div class="item-gallery-title">
<h2>{{__('shop::app.home.new-products')}}</h2>