Merge pull request #3947 from deepaksinghgusain227/add-new-featured-product
Add new and featured Product Config
This commit is contained in:
commit
2af211a287
|
|
@ -149,6 +149,24 @@ return [
|
|||
'type' => 'boolean',
|
||||
],
|
||||
],
|
||||
], [
|
||||
'key' => 'catalog.products.homepage',
|
||||
'name' => 'admin::app.admin.system.homepage',
|
||||
'sort' => 2,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'no_of_new_product_homepage',
|
||||
'title' => 'admin::app.admin.system.allow-no-of-new-product-homepage',
|
||||
'type' => 'number',
|
||||
'validation' => 'required|min:0',
|
||||
],
|
||||
[
|
||||
'name' => 'no_of_featured_product_homepage',
|
||||
'title' => 'admin::app.admin.system.allow-no-of-featured-product-homepage',
|
||||
'type' => 'number',
|
||||
'validation' => 'required|min:0',
|
||||
],
|
||||
],
|
||||
], [
|
||||
'key' => 'catalog.products.storefront',
|
||||
'name' => 'admin::app.admin.system.storefront',
|
||||
|
|
|
|||
|
|
@ -1251,6 +1251,9 @@ return [
|
|||
],
|
||||
'system' => [
|
||||
'catalog' => 'Catalog',
|
||||
'homepage' => 'Homepage configuration',
|
||||
'allow-no-of-new-product-homepage' => 'Allowed No of New Product in Homepage',
|
||||
'allow-no-of-featured-product-homepage' => 'Allowed No of Featured Product in Homepage',
|
||||
'products' => 'Products',
|
||||
'guest-checkout' => 'Guest Checkout',
|
||||
'allow-guest-checkout' => 'Allow Guest Checkout',
|
||||
|
|
|
|||
|
|
@ -99,6 +99,10 @@
|
|||
@elseif ($field['type'] == 'password')
|
||||
|
||||
<input type="password" v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" value="{{ old($name) ?: core()->getConfigData($name) }}" data-vv-as=""{{ trans($field['title']) }}"">
|
||||
|
||||
@elseif ($field['type'] == 'number')
|
||||
|
||||
<input type="number" min="0" v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" value="{{ old($name) ?: core()->getConfigData($name) }}" data-vv-as=""{{ trans($field['title']) }}"">
|
||||
|
||||
@elseif ($field['type'] == 'color')
|
||||
|
||||
|
|
|
|||
|
|
@ -317,6 +317,8 @@ class ProductRepository extends Repository
|
|||
*/
|
||||
public function getNewProducts()
|
||||
{
|
||||
$count = core()->getConfigData('catalog.products.homepage.no_of_new_product_homepage');
|
||||
|
||||
$results = app(ProductFlatRepository::class)->scopeQuery(function ($query) {
|
||||
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
|
||||
|
||||
|
|
@ -330,7 +332,7 @@ class ProductRepository extends Repository
|
|||
->where('product_flat.channel', $channel)
|
||||
->where('product_flat.locale', $locale)
|
||||
->inRandomOrder();
|
||||
})->paginate(4);
|
||||
})->paginate($count ? $count : 4);
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
|
@ -342,6 +344,8 @@ class ProductRepository extends Repository
|
|||
*/
|
||||
public function getFeaturedProducts()
|
||||
{
|
||||
$count = core()->getConfigData('catalog.products.homepage.no_of_featured_product_homepage');
|
||||
|
||||
$results = app(ProductFlatRepository::class)->scopeQuery(function ($query) {
|
||||
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
|
||||
|
||||
|
|
@ -355,7 +359,7 @@ class ProductRepository extends Repository
|
|||
->where('product_flat.channel', $channel)
|
||||
->where('product_flat.locale', $locale)
|
||||
->inRandomOrder();
|
||||
})->paginate(4);
|
||||
})->paginate($count ? $count : 4);
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@if (app('Webkul\Product\Repositories\ProductRepository')->getFeaturedProducts()->count())
|
||||
@if (app('Webkul\Product\Repositories\ProductRepository')->getFeaturedProducts())
|
||||
<section class="featured-products">
|
||||
|
||||
<div class="featured-heading">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@if (app('Webkul\Product\Repositories\ProductRepository')->getNewProducts()->count())
|
||||
@if (app('Webkul\Product\Repositories\ProductRepository')->getNewProducts())
|
||||
<section class="featured-products">
|
||||
|
||||
<div class="featured-heading">
|
||||
|
|
|
|||
|
|
@ -105,30 +105,9 @@
|
|||
value="{{ $metaData ? $metaData->header_content_count : '5' }}" />
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label>{{ __('shop::app.home.featured-products') }}</label>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
class="control"
|
||||
id="featured_product_count"
|
||||
name="featured_product_count"
|
||||
value="{{ $metaData ? $metaData->featured_product_count : 10 }}" />
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label>{{ __('shop::app.home.new-products') }}</label>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
class="control"
|
||||
id="new_products_count"
|
||||
name="new_products_count"
|
||||
value="{{ $metaData ? $metaData->new_products_count : 10 }}" />
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="control-group">
|
||||
<label style="width:100%;">
|
||||
{{ __('velocity::app.admin.meta-data.home-page-content') }}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
@php
|
||||
$count = $velocityMetaData ? $velocityMetaData->featured_product_count : 10;
|
||||
$count = core()->getConfigData('catalog.products.homepage.no_of_featured_product_homepage');
|
||||
$count = $count ? $count : 10;
|
||||
$direction = core()->getCurrentLocale()->direction == 'rtl' ? 'rtl' : 'ltr';
|
||||
@endphp
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
@php
|
||||
$count = $velocityMetaData ? $velocityMetaData->new_products_count : 10;
|
||||
$count = core()->getConfigData('catalog.products.homepage.no_of_new_product_homepage');
|
||||
$count = $count ? $count : 10;
|
||||
$direction = core()->getCurrentLocale()->direction == 'rtl' ? 'rtl' : 'ltr';
|
||||
@endphp
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue