Merge pull request #698 from jitendra-webkul/jitendra
Category display mode feature added
This commit is contained in:
commit
1759392af5
|
|
@ -461,6 +461,10 @@ return [
|
|||
'yes' => 'Yes',
|
||||
'no' => 'No',
|
||||
'position' => 'Position',
|
||||
'display-mode' => 'Display Mode',
|
||||
'products-and-description' => 'Products and Description',
|
||||
'products-only' => 'Products Only',
|
||||
'description-only' => 'Description Only',
|
||||
'description-and-images' => 'Description and Images',
|
||||
'description' => 'Description',
|
||||
'parent-category' => 'Parent Category',
|
||||
|
|
|
|||
|
|
@ -429,6 +429,10 @@ return [
|
|||
'yes' => 'Sim',
|
||||
'no' => 'Não',
|
||||
'position' => 'Posição',
|
||||
'display-mode' => 'Display Mode',
|
||||
'products-and-description' => 'Products and Description',
|
||||
'products-only' => 'Products Only',
|
||||
'description-only' => 'Description Only',
|
||||
'description-and-images' => 'Descrição e Imagens',
|
||||
'description' => 'Descrição',
|
||||
'parent-category' => 'Categoria Pai',
|
||||
|
|
|
|||
|
|
@ -77,6 +77,22 @@
|
|||
|
||||
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.description_images.controls.before') !!}
|
||||
|
||||
<div class="control-group" :class="[errors.has('display_mode') ? 'has-error' : '']">
|
||||
<label for="display_mode" class="required">{{ __('admin::app.catalog.categories.display-mode') }}</label>
|
||||
<select class="control" v-validate="'required'" id="display_mode" name="display_mode" data-vv-as=""{{ __('admin::app.catalog.categories.display-mode') }}"">
|
||||
<option value="products_and_description">
|
||||
{{ __('admin::app.catalog.categories.products-and-description') }}
|
||||
</option>
|
||||
<option value="products_only">
|
||||
{{ __('admin::app.catalog.categories.products-only') }}
|
||||
</option>
|
||||
<option value="description_only">
|
||||
{{ __('admin::app.catalog.categories.description-only') }}
|
||||
</option>
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('display_mode')">@{{ errors.first('display_mode') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
|
||||
<label for="description" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
|
||||
<textarea v-validate="'required'" class="control" id="description" name="description" data-vv-as=""{{ __('admin::app.catalog.categories.description') }}"">{{ old('description') }}</textarea>
|
||||
|
|
|
|||
|
|
@ -90,6 +90,22 @@
|
|||
|
||||
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.description_images.controls.before', ['category' => $category]) !!}
|
||||
|
||||
<div class="control-group" :class="[errors.has('display_mode') ? 'has-error' : '']">
|
||||
<label for="display_mode" class="required">{{ __('admin::app.catalog.categories.display-mode') }}</label>
|
||||
<select class="control" v-validate="'required'" id="display_mode" name="display_mode" data-vv-as=""{{ __('admin::app.catalog.categories.display-mode') }}"">
|
||||
<option value="products_and_description" {{ $category->display_mode == 'products_and_description' ? 'selected' : '' }}>
|
||||
{{ __('admin::app.catalog.categories.products-and-description') }}
|
||||
</option>
|
||||
<option value="products_only" {{ $category->display_mode == 'products_only' ? 'selected' : '' }}>
|
||||
{{ __('admin::app.catalog.categories.products-only') }}
|
||||
</option>
|
||||
<option value="description_only" {{ $category->display_mode == 'description_only' ? 'selected' : '' }}>
|
||||
{{ __('admin::app.catalog.categories.description-only') }}
|
||||
</option>
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('display_mode')">@{{ errors.first('display_mode') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('{{$locale}}[description]') ? 'has-error' : '']">
|
||||
<label for="description" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
|
||||
<textarea v-validate="'required'" class="control" id="description" name="{{$locale}}[description]" data-vv-as=""{{ __('admin::app.catalog.categories.description') }}"">{{ old($locale)['description'] ?: $category->translate($locale)['description'] }}</textarea>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddDisplayModeColumnInCategoriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('categories', function (Blueprint $table) {
|
||||
$table->string('display_mode')->default('products_and_description')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('categories', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ class Category extends TranslatableModel implements CategoryContract
|
|||
|
||||
public $translatedAttributes = ['name', 'description', 'slug', 'meta_title', 'meta_description', 'meta_keywords'];
|
||||
|
||||
protected $fillable = ['position', 'status', 'parent_id'];
|
||||
protected $fillable = ['position', 'status', 'display_mode', 'parent_id'];
|
||||
|
||||
/**
|
||||
* Get image url for the category image.
|
||||
|
|
|
|||
|
|
@ -17,65 +17,71 @@
|
|||
|
||||
<div class="category-container">
|
||||
|
||||
@include ('shop::products.list.layered-navigation')
|
||||
@if (in_array($category->display_mode, [null, 'products_only', 'products_and_description']))
|
||||
@include ('shop::products.list.layered-navigation')
|
||||
@endif
|
||||
|
||||
<div class="category-block">
|
||||
<div class="category-block" @if ($category->display_mode == 'description_only') style="width: 100%" @endif>
|
||||
<div class="hero-image mb-35">
|
||||
@if (!is_null($category->image))
|
||||
<img class="logo" src="{{ $category->image_url }}" />
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($category->description)
|
||||
<div class="category-description">
|
||||
{!! $category->description !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<?php $products = $productRepository->getAll($category->id); ?>
|
||||
|
||||
@if ($products->count())
|
||||
|
||||
@include ('shop::products.list.toolbar')
|
||||
|
||||
@inject ('toolbarHelper', 'Webkul\Product\Helpers\Toolbar')
|
||||
|
||||
@if ($toolbarHelper->getCurrentMode() == 'grid')
|
||||
<div class="product-grid-3">
|
||||
@foreach ($products as $productFlat)
|
||||
|
||||
@include ('shop::products.list.card', ['product' => $productFlat->product])
|
||||
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<div class="product-list">
|
||||
@foreach ($products as $productFlat)
|
||||
|
||||
@include ('shop::products.list.card', ['product' => $productFlat->product])
|
||||
|
||||
@endforeach
|
||||
@if (in_array($category->display_mode, [null, 'description_only', 'products_and_description']))
|
||||
@if ($category->description)
|
||||
<div class="category-description">
|
||||
{!! $category->description !!}
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
{!! view_render_event('bagisto.shop.products.index.pagination.before') !!}
|
||||
@if (in_array($category->display_mode, [null, 'products_only', 'products_and_description']))
|
||||
<?php $products = $productRepository->getAll($category->id); ?>
|
||||
|
||||
<div class="bottom-toolbar">
|
||||
{{ $products->appends(request()->input())->links() }}
|
||||
</div>
|
||||
@if ($products->count())
|
||||
|
||||
{!! view_render_event('bagisto.shop.products.index.pagination.after') !!}
|
||||
@include ('shop::products.list.toolbar')
|
||||
|
||||
@else
|
||||
@inject ('toolbarHelper', 'Webkul\Product\Helpers\Toolbar')
|
||||
|
||||
<div class="product-list empty">
|
||||
<h2>{{ __('shop::app.products.whoops') }}</h2>
|
||||
@if ($toolbarHelper->getCurrentMode() == 'grid')
|
||||
<div class="product-grid-3">
|
||||
@foreach ($products as $productFlat)
|
||||
|
||||
<p>
|
||||
{{ __('shop::app.products.empty') }}
|
||||
</p>
|
||||
</div>
|
||||
@include ('shop::products.list.card', ['product' => $productFlat->product])
|
||||
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<div class="product-list">
|
||||
@foreach ($products as $productFlat)
|
||||
|
||||
@include ('shop::products.list.card', ['product' => $productFlat->product])
|
||||
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{!! view_render_event('bagisto.shop.products.index.pagination.before') !!}
|
||||
|
||||
<div class="bottom-toolbar">
|
||||
{{ $products->appends(request()->input())->links() }}
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.products.index.pagination.after') !!}
|
||||
|
||||
@else
|
||||
|
||||
<div class="product-list empty">
|
||||
<h2>{{ __('shop::app.products.whoops') }}</h2>
|
||||
|
||||
<p>
|
||||
{{ __('shop::app.products.empty') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue