optional compare option

This commit is contained in:
Shubham Mehrotra 2020-06-19 13:16:01 +05:30
parent cf5217a18d
commit 3d44f95469
11 changed files with 115 additions and 44 deletions

View File

@ -0,0 +1,20 @@
<?php
return [
[
'key' => 'general.content.shop',
'name' => 'shop::app.products.settings',
'sort' => 1,
'fields' => [
[
'name' => 'compare_option',
'title' => 'shop::app.products.compare_options',
'type' => 'boolean',
'locale_based' => true,
'channel_based' => true,
],
],
]
];
?>

View File

@ -81,5 +81,9 @@ class ShopServiceProvider extends ServiceProvider
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/menu.php', 'menu.customer'
);
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/system.php', 'core'
);
}
}

View File

@ -417,7 +417,9 @@ return [
'your-customization' => 'Your Customization',
'total-amount' => 'Total Amount',
'none' => 'None',
'available-for-order' => 'Available for Order'
'available-for-order' => 'Available for Order',
'settings' => 'Settings',
'compare_options' => 'Compare Options',
],
// 'reviews' => [

View File

@ -335,13 +335,18 @@ class Helper extends Review
'priceHTML' => view('shop::products.price', ['product' => $product])->render(),
'defaultAddToCart' => view('shop::products.add-buttons', ['product' => $product])->render(),
'addToCartHtml' => view('shop::products.add-to-cart', [
'showCompare' => true,
'product' => $product,
'addWishlistClass' => ! (isset($list) && $list) ? '' : '',
'showCompare' => core()->getConfigData('general.content.shop.compare_option') == "1"
? true : false,
'btnText' => (isset($metaInformation['btnText']) && $metaInformation['btnText'])
? $metaInformation['btnText'] : null,
'moveToCart' => (isset($metaInformation['moveToCart']) && $metaInformation['moveToCart'])
? $metaInformation['moveToCart'] : null,
'addToCartBtnClass' => ! (isset($list) && $list) ? 'small-padding' : '',
])->render(),
];

View File

@ -2552,6 +2552,7 @@
.term-list a {
padding: 5px 8px;
margin-top: 10px;
background: #fff;
margin-right: 10px;
}

View File

@ -939,4 +939,17 @@
.wishlist-icon {
margin-left: 0;
}
.image-search-result {
.searched-terms {
margin-left: 0;
margin-top: 20px;
.term-list {
a {
line-height: 40px;
}
}
}
}
}

View File

@ -302,23 +302,29 @@
<logo-component></logo-component>
</div>
@php
$showCompare = core()->getConfigData('general.content.shop.compare_option') == "1" ? true : false
@endphp
<div class="right-vc-header col-6">
<a
class="compare-btn unset"
@auth('customer')
href="{{ route('velocity.customer.product.compare') }}"
@endauth
@if ($showCompare)
<a
class="compare-btn unset"
@auth('customer')
href="{{ route('velocity.customer.product.compare') }}"
@endauth
@guest('customer')
href="{{ route('velocity.product.compare') }}"
@endguest
>
@guest('customer')
href="{{ route('velocity.product.compare') }}"
@endguest
>
<div class="badge-container" v-if="compareCount > 0">
<span class="badge" v-text="compareCount"></span>
</div>
<i class="material-icons">compare_arrows</i>
</a>
<div class="badge-container" v-if="compareCount > 0">
<span class="badge" v-text="compareCount"></span>
</div>
<i class="material-icons">compare_arrows</i>
</a>
@endif
<a class="wishlist-btn unset" :href="`${isCustomer ? '{{ route('customer.wishlist.index') }}' : '{{ route('velocity.product.guest-wishlist') }}'}`">
<div class="badge-container" v-if="wishlistCount > 0">

View File

@ -129,24 +129,30 @@
@include('shop::checkout.cart.mini-cart')
{!! view_render_event('bagisto.shop.layout.header.cart-item.after') !!}
@php
$showCompare = core()->getConfigData('general.content.shop.compare_option') == "1" ? true : false
@endphp
{!! view_render_event('bagisto.shop.layout.header.compare.before') !!}
<a
class="compare-btn unset"
@auth('customer')
href="{{ route('velocity.customer.product.compare') }}"
@endauth
@if ($showCompare)
<a
class="compare-btn unset"
@auth('customer')
href="{{ route('velocity.customer.product.compare') }}"
@endauth
@guest('customer')
href="{{ route('velocity.product.compare') }}"
@endguest
>
@guest('customer')
href="{{ route('velocity.product.compare') }}"
@endguest
>
<i class="material-icons">compare_arrows</i>
<div class="badge-container" v-if="compareCount > 0">
<span class="badge" v-text="compareCount"></span>
</div>
<span>{{ __('velocity::app.customer.compare.text') }}</span>
</a>
<i class="material-icons">compare_arrows</i>
<div class="badge-container" v-if="compareCount > 0">
<span class="badge" v-text="compareCount"></span>
</div>
<span>{{ __('velocity::app.customer.compare.text') }}</span>
</a>
@endif
{!! view_render_event('bagisto.shop.layout.header.compare.after') !!}
{!! view_render_event('bagisto.shop.layout.header.wishlist.before') !!}

View File

@ -1,7 +1,6 @@
@inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage')
@inject ('reviewHelper', 'Webkul\Product\Helpers\Review')
@inject ('toolbarHelper', 'Webkul\Product\Helpers\Toolbar')
{{-- @include('shop::UI.product-quick-view') --}}
@inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage')
@push('css')
<style type="text/css">
@ -20,9 +19,7 @@
if (isset($checkmode) && $checkmode && $toolbarHelper->getCurrentMode() == "list") {
$list = true;
}
@endphp
@php
$productBaseImage = $productImageHelper->getProductBaseImage($product);
$totalReviews = $reviewHelper->getTotalReviews($product);
$avgRatings = ceil($reviewHelper->getAverageRating($product));
@ -66,10 +63,11 @@
<div class="cart-wish-wrap mt5">
@include ('shop::products.add-to-cart', [
'product' => $product,
'showCompare' => true,
'addWishlistClass' => 'pl10',
'addToCartBtnClass' => 'medium-padding'
'addWishlistClass' => 'pl10',
'product' => $product,
'addToCartBtnClass' => 'medium-padding',
'showCompare' => core()->getConfigData('general.content.shop.compare_option') == "1"
? true : false,
])
</div>
</div>
@ -122,13 +120,14 @@
<div class="cart-wish-wrap no-padding ml0">
@include ('shop::products.add-to-cart', [
'showCompare' => true,
'product' => $product,
'btnText' => $btnText ?? null,
'moveToCart' => $moveToCart ?? null,
'reloadPage' => $reloadPage ?? null,
'addToCartForm' => $addToCartForm ?? false,
'addToCartBtnClass' => $addToCartBtnClass ?? '',
'showCompare' => core()->getConfigData('general.content.shop.compare_option') == "1"
? true : false,
])
</div>
</div>

View File

@ -126,8 +126,9 @@
@include ('shop::products.add-to-cart', [
'form' => false,
'product' => $product,
'showCompare' => true,
'showCartIcon' => false,
'showCompare' => core()->getConfigData('general.content.shop.compare_option') == "1"
? true : false,
])
</div>
</div>

View File

@ -6,15 +6,29 @@
{{ __('shop::app.search.page-title') }}
@endsection
@push('css')
<style type="text/css">
@media only screen and (max-width: 992px) {
.main-content-wrapper .vc-header {
box-shadow: unset;
}
}
</style>
@endpush
@section('content-wrapper')
<div class="container">
<section class="search-container row">
<div class="container category-page-wrapper">
<section class="search-container row category-container">
@if (request('image-search'))
<image-search-result-component></image-search-result-component>
@endif
@if ($results && $results->count())
<div class="filters-container col-12">
<div class="filters-container col-12" style="
margin-top: 20px;
padding-left: 0px !important;
padding-bottom: 10px !important;
">
@include ('shop::products.list.toolbar')
</div>
@endif