This commit is contained in:
Pranshu Tomar 2020-03-23 15:29:40 +05:30
commit 45b6849006
21 changed files with 722 additions and 600 deletions

View File

@ -4,10 +4,10 @@ APP_VERSION=1.1.0
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_TIMEZONE=Asia/Kolkata
APP_TIMEZONE=
APP_LOCALE=en
LOG_CHANNEL=stack
APP_CURRENCY=USD
APP_CURRENCY=
DB_CONNECTION=mysql
DB_HOST=127.0.0.1

View File

@ -16,6 +16,9 @@ class CustomerAddress extends JsonResource
{
return [
'id' => $this->id,
'first_name' => $this->first_name,
'last_name' => $this->last_name,
'company_name' => $this->company_name,
'address1' => explode(PHP_EOL, $this->address1),
'country' => $this->country,
'country_name' => core()->country_name($this->country),
@ -27,4 +30,4 @@ class CustomerAddress extends JsonResource
'updated_at' => $this->updated_at,
];
}
}
}

View File

@ -52,7 +52,7 @@
<div class="control-group" :class="[errors.has('{{$locale}}[name]') ? 'has-error' : '']">
<label for="name" class="required">{{ __('admin::app.catalog.categories.name') }}</label>
<input type="text" v-validate="'required'" class="control" id="name" name="{{$locale}}[name]" value="{{ old($locale)['name'] ?? $category->translate($locale)['name'] }}" data-vv-as="&quot;{{ __('admin::app.catalog.categories.name') }}&quot;" v-slugify-target="'slug'"/>
<input type="text" v-validate="'required'" class="control" id="name" name="{{$locale}}[name]" value="{{ old($locale)['name'] ?? ($category->translate($locale)['name'] ?? '') }}" data-vv-as="&quot;{{ __('admin::app.catalog.categories.name') }}&quot;" v-slugify-target="'slug'"/>
<span class="control-error" v-if="errors.has('{{$locale}}[name]')">@{{ errors.first('{!!$locale!!}[name]') }}</span>
</div>
@ -180,23 +180,23 @@
<div class="control-group">
<label for="meta_title">{{ __('admin::app.catalog.categories.meta_title') }}</label>
<input type="text" class="control" id="meta_title" name="{{$locale}}[meta_title]" value="{{ old($locale)['meta_title'] ?? $category->translate($locale)['meta_title'] }}"/>
<input type="text" class="control" id="meta_title" name="{{$locale}}[meta_title]" value="{{ old($locale)['meta_title'] ?? ($category->translate($locale)['meta_title'] ?? '') }}"/>
</div>
<div class="control-group" :class="[errors.has('{{$locale}}[slug]') ? 'has-error' : '']">
<label for="slug" class="required">{{ __('admin::app.catalog.categories.slug') }}</label>
<input type="text" v-validate="'required'" class="control" id="slug" name="{{$locale}}[slug]" value="{{ old($locale)['slug'] ?? $category->translate($locale)['slug'] }}" data-vv-as="&quot;{{ __('admin::app.catalog.categories.slug') }}&quot;" v-slugify/>
<input type="text" v-validate="'required'" class="control" id="slug" name="{{$locale}}[slug]" value="{{ old($locale)['slug'] ?? ($category->translate($locale)['slug'] ?? '') }}" data-vv-as="&quot;{{ __('admin::app.catalog.categories.slug') }}&quot;" v-slugify/>
<span class="control-error" v-if="errors.has('{{$locale}}[slug]')">@{{ errors.first('{!!$locale!!}[slug]') }}</span>
</div>
<div class="control-group">
<label for="meta_description">{{ __('admin::app.catalog.categories.meta_description') }}</label>
<textarea class="control" id="meta_description" name="{{$locale}}[meta_description]">{{ old($locale)['meta_description'] ?? $category->translate($locale)['meta_description'] }}</textarea>
<textarea class="control" id="meta_description" name="{{$locale}}[meta_description]">{{ old($locale)['meta_description'] ?? ($category->translate($locale)['meta_description'] ?? '') }}</textarea>
</div>
<div class="control-group">
<label for="meta_keywords">{{ __('admin::app.catalog.categories.meta_keywords') }}</label>
<textarea class="control" id="meta_keywords" name="{{$locale}}[meta_keywords]">{{ old($locale)['meta_keywords'] ?? $category->translate($locale)['meta_keywords'] }}</textarea>
<textarea class="control" id="meta_keywords" name="{{$locale}}[meta_keywords]">{{ old($locale)['meta_keywords'] ?? ($category->translate($locale)['meta_keywords'] ?? '') }}</textarea>
</div>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.controls.after', ['category' => $category]) !!}
@ -220,7 +220,7 @@
<div class="control-group" :class="[errors.has('{{$locale}}[description]') ? 'has-error' : '']">
<label for="description" :class="isRequired ? 'required' : ''">{{ __('admin::app.catalog.categories.description') }}</label>
<textarea v-validate="isRequired ? 'required' : ''" class="control" id="description" name="{{$locale}}[description]" data-vv-as="&quot;{{ __('admin::app.catalog.categories.description') }}&quot;">{{ old($locale)['description'] ?? $category->translate($locale)['description'] }}</textarea>
<textarea v-validate="isRequired ? 'required' : ''" class="control" id="description" name="{{$locale}}[description]" data-vv-as="&quot;{{ __('admin::app.catalog.categories.description') }}&quot;">{{ old($locale)['description'] ?? ($category->translate($locale)['description'] ?? '') }}</textarea>
<span class="control-error" v-if="errors.has('{{$locale}}[description]')">@{{ errors.first('{!!$locale!!}[description]') }}</span>
</div>

View File

@ -0,0 +1,20 @@
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use Faker\Generator as Faker;
use Webkul\CartRule\Models\CartRule;
use Webkul\CartRule\Models\CartRuleCoupon;
$factory->define(CartRuleCoupon::class, function (Faker $faker) {
return [
'code' => $faker->uuid(),
'usage_limit' => 100,
'usage_per_customer' => 100,
'type' => 0,
'is_primary' => 1,
'cart_rule_id' => static function () {
return factory(CartRule::class)->create()->id;
},
];
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{
"/js/velocity.js": "/js/velocity.js?id=ead79036faabfd4de68d",
"/js/velocity.js": "/js/velocity.js?id=402de46225161bbc3aa8",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=612d35e452446366eef7",
"/css/velocity.css": "/css/velocity.css?id=6f5bad6b6ae5777a1a98"
"/css/velocity.css": "/css/velocity.css?id=b453a0556f29d54363a4"
}

View File

@ -5,6 +5,7 @@ namespace Webkul\Velocity\Http\Controllers\Shop;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Webkul\Velocity\Helpers\Helper;
use Webkul\Product\Helpers\ProductImage;
use Webkul\Product\Repositories\SearchRepository;
@ -85,13 +86,15 @@ class Controller extends BaseController
/**
* Create a new controller instance.
*
* @param \Webkul\Velocity\Helpers\Helper $velocityHelper
* @param \Webkul\Product\Helpers\ProductImage $productImageHelper
* @param \Webkul\Product\Repositories\SearchRepository $searchRepository
* @param \Webkul\Product\Repositories\ProductRepository $productRepository
* @param \Webkul\Category\Repositories\CategoryRepository $categoryRepository
* @param \Webkul\Velocity\Repositories\Product\ProductRepository $velocityProductRepository
* @param \Webkul\Velocity\Helpers\Helper $velocityHelper
* @param \Webkul\Product\Helpers\ProductImage $productImageHelper
* @param \Webkul\Product\Repositories\SearchRepository $searchRepository
* @param \Webkul\Product\Repositories\ProductRepository $productRepository
* @param \Webkul\Category\Repositories\CategoryRepository $categoryRepository
* @param \Webkul\Velocity\Repositories\Product\ProductRepository $velocityProductRepository
* @param \Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository $compareProductsRepository
* @param \Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository $compareProductsRepository
*
* @return void
*/
public function __construct(

View File

@ -231,4 +231,25 @@ class ShopController extends Controller
'status' => false
]);
}
public function getCategoryProducts($categoryId)
{
$products = $this->productRepository->getAll($categoryId);
$productItems = $products->items();
if ($productItems) {
$formattedProducts =[];
foreach ($productItems as $product) {
array_push($formattedProducts, $this->velocityHelper->formatProduct($product));
}
$products = $products->toArray();
$products['data'] = $formattedProducts;
}
return response()->json($response ?? [
'products' => $products
]);
}
}

View File

@ -57,5 +57,8 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
Route::get('/detailed-products', 'ShopController@getDetailedProducts')
->name('velocity.product.details');
Route::get('/category-products/{categoryId}', 'ShopController@getCategoryProducts')
->name('velocity.category.products');
});
});

View File

@ -2,7 +2,11 @@
<div class="col-12 lg-card-container list-card product-card row" v-if="list">
<div class="product-image">
<a :title="product.name" :href="`${baseUrl}/${product.slug}`">
<img :src="product.image" />
<img
:src="product.image"
:onerror="`this.src='${this.$root.baseUrl}/vendor/webkul/ui/assets/images/product/large-product-placeholder.png'`" />
<product-quick-view-btn :quick-view-details="product"></product-quick-view-btn>
</a>
</div>
@ -18,14 +22,14 @@
<div class="product-rating" v-if="product.totalReviews && product.totalReviews > 0">
<star-ratings :ratings="product.avgRating"></star-ratings>
<span>{{ product.totalReviews }}</span>
<span>{{ __('products.reviews-count', {'totalReviews': product.totalReviews}) }}</span>
</div>
<div class="product-rating" v-else>
<span class="fs14" v-text="product.firstReviewText"></span>
</div>
<div class="cart-wish-wrap row mt5" v-html="product.addToCartHtml"></div>
<vnode-injector :nodes="getDynamicHTML(product.addToCartHtml)"></vnode-injector>
</div>
</div>
</div>
@ -37,7 +41,8 @@
:alt="product.name"
:src="product.image"
:data-src="product.image"
class="card-img-top lzy_img" />
class="card-img-top lzy_img"
:onerror="`this.src='${this.$root.baseUrl}/vendor/webkul/ui/assets/images/product/large-product-placeholder.png'`" />
<!-- :src="`${$root.baseUrl}/vendor/webkul/ui/assets/images/product/meduim-product-placeholder.png`" /> -->
<product-quick-view-btn :quick-view-details="product"></product-quick-view-btn>
@ -76,7 +81,6 @@
</template>
<script type="text/javascript">
// compile add to cart html (it contains wishlist component)
export default {
props: [
'list',

View File

@ -4,13 +4,13 @@
id="shimmer-carousel"
navigation-enabled="hide"
pagination-enabled="hide"
:slides-count="shimmerCount + 1"
:slides-per-page="shimmerCount">
:slides-count="shimmerCountInt + 1"
:slides-per-page="shimmerCountInt">
<slide
:key="count"
:slot="`slide-${count}`"
v-for="count in shimmerCount">
v-for="count in shimmerCountInt">
<div class="shimmer-card">
<div class="shimmer-wrapper">
@ -30,9 +30,14 @@
props: {
'shimmerCount': {
default: 6,
type: Number,
},
},
data: function () {
return {
shimmerCountInt: parseInt(this.shimmerCount),
}
}
}
</script>

View File

@ -678,6 +678,8 @@
.product-quantity {
.quantity {
float: left;
label {
display: none !important;
}
@ -2277,8 +2279,9 @@
.col,
.col-2 {
padding-left: 0;
max-width: 20%;
padding-left: 0;
word-break: break-word;
}
.image-wrapper {

View File

@ -864,6 +864,11 @@
.actions {
margin-top: 7px !important;
}
.continue-shopping,
.empty-cart-message {
padding: 0;
}
}
.checkout-process {

View File

@ -448,7 +448,14 @@
height: 270px;
max-width: 200px;
max-height: 200px;
position: relative;
background: #f2f2f2;
.quick-view-btn-container {
button {
left: calc(50% - 40px);
}
}
}
.product-information {
@ -485,7 +492,8 @@
.wishlist-icon {
height: 40px;
display: table;
vertical-align: top;
display: inline-table;
padding-left: 0 !important;
i {
@ -497,10 +505,13 @@
.compare-icon {
padding-left: 0;
display: inline-table;
}
.add-to-cart-btn {
float: left;
max-width: 150px;
display: inline-block;
}
}

View File

@ -0,0 +1,493 @@
<script type="text/x-template" id="content-header-template">
<header class="row velocity-divide-page vc-header header-shadow active">
<div class="vc-small-screen container" v-if="isMobile()">
<div class="row">
<div class="col-6">
<div v-if="hamburger" class="nav-container scrollable">
<div class="wrapper" v-if="this.rootCategories">
<div class="greeting drawer-section fw6">
<i class="material-icons">perm_identity</i>
<span>
@guest('customer')
<a class="unset" href="{{ route('customer.session.index') }}">
{{ __('velocity::app.responsive.header.greeting', ['customer' => 'Guest']) }}
</a>
@endguest
@auth('customer')
<a class="unset" href="{{ route('customer.profile.index') }}">
{{ __('velocity::app.responsive.header.greeting', ['customer' => auth()->guard('customer')->user()->first_name]) }}
</a>
@endauth
<i
class="material-icons pull-right"
@click="closeDrawer()">
cancel
</i>
</span>
</div>
@php
$currency = $locale = null;
$currentLocale = app()->getLocale();
$currentCurrency = core()->getCurrentCurrencyCode();
$allLocales = core()->getCurrentChannel()->locales;
$allCurrency = core()->getCurrentChannel()->currencies;
@endphp
@foreach ($allLocales as $appLocale)
@if ($appLocale->code == $currentLocale)
@php
$locale = $appLocale;
@endphp
@endif
@endforeach
@foreach ($allCurrency as $appCurrency)
@if ($appCurrency->code == $currentCurrency)
@php
$currency = $appCurrency;
@endphp
@endif
@endforeach
<ul type="none" class="velocity-content">
<li :key="index" v-for="(content, index) in headerContent">
<a
class="unset"
v-text="content.title"
:href="`${$root.baseUrl}/${content.page_link}`">
</a>
</li>
</ul>
<ul type="none" class="category-wrapper">
<li v-for="(category, index) in $root.sharedRootCategories">
<a class="unset" :href="`${$root.baseUrl}/${category.slug}`">
<div class="category-logo">
<img
class="category-icon"
v-if="category.category_icon_path"
:src="`${$root.baseUrl}/storage/${category.category_icon_path}`" />
</div>
<span v-text="category.name"></span>
</a>
<i class="rango-arrow-right" @click="toggleSubcategories(index, $event)"></i>
</li>
</ul>
@auth('customer')
<ul type="none" class="vc-customer-options">
<li>
<a href="{{ route('customer.profile.index') }}" class="unset">
<i class="icon profile text-down-3"></i>
<span>{{ __('shop::app.header.profile') }}</span>
</a>
</li>
<li>
<a href="{{ route('customer.address.index') }}" class="unset">
<i class="icon address text-down-3"></i>
<span>{{ __('velocity::app.shop.general.addresses') }}</span>
</a>
</li>
<li>
<a href="{{ route('customer.reviews.index') }}" class="unset">
<i class="icon reviews text-down-3"></i>
<span>{{ __('velocity::app.shop.general.reviews') }}</span>
</a>
</li>
<li>
<a href="{{ route('customer.wishlist.index') }}" class="unset">
<i class="icon wishlist text-down-3"></i>
<span>{{ __('shop::app.header.wishlist') }}</span>
</a>
</li>
<li>
<a href="{{ route('customer.orders.index') }}" class="unset">
<i class="icon orders text-down-3"></i>
<span>{{ __('velocity::app.shop.general.orders') }}</span>
</a>
</li>
<li>
<a href="{{ route('customer.downloadable_products.index') }}" class="unset">
<i class="icon downloadables text-down-3"></i>
<span>{{ __('velocity::app.shop.general.downloadables') }}</span>
</a>
</li>
</ul>
@endauth
<ul type="none" class="meta-wrapper">
<li>
<div class="language-logo-wrapper">
@if ($locale->locale_image)
<img
class="language-logo"
src="{{ asset('/storage/' . $locale->locale_image) }}" />
@elseif ($locale->code == "en")
<img
class="language-logo"
src="{{ asset('/themes/velocity/assets/images/flags/en.png') }}" />
@endif
</div>
<span>{{ $locale->name }}</span>
<i
class="rango-arrow-right"
@click="toggleMetaInfo('languages')">
</i>
</li>
<li>
<span>{{ $currency->code }}</span>
<i
class="rango-arrow-right"
@click="toggleMetaInfo('currencies')">
</i>
</li>
<li>
@auth('customer')
<a
class="unset"
href="{{ route('customer.session.destroy') }}">
<span>{{ __('shop::app.header.logout') }}</span>
</a>
@endauth
@guest('customer')
<a
class="unset"
href="{{ route('customer.session.create') }}">
<span>{{ __('shop::app.customer.login-form.title') }}</span>
</a>
@endguest
</li>
</ul>
</div>
<div class="wrapper" v-else-if="subCategory">
<div class="drawer-section">
<i class="rango-arrow-left fs24 text-down-4" @click="toggleSubcategories('root')"></i>
<h4 class="display-inbl">@{{ subCategory.name }}</h4>
<i class="material-icons pull-right" @click="closeDrawer()">
cancel
</i>
</div>
<ul type="none">
<li
:key="index"
v-for="(nestedSubCategory, index) in subCategory.children">
<a
class="unset"
:href="`${$root.baseUrl}/${nestedSubCategory.slug}`">
<div class="category-logo">
<img
class="category-icon"
v-if="nestedSubCategory.category_icon_path"
:src="`${$root.baseUrl}/storage/${nestedSubCategory.category_icon_path}`" />
</div>
<span>@{{ nestedSubCategory.name }}</span>
</a>
<ul
type="none"
class="nested-category"
v-if="nestedSubCategory.children && nestedSubCategory.children.length > 0">
<li
:key="`index-${Math.random()}`"
v-for="(thirdLevelCategory, index) in nestedSubCategory.children">
<a
class="unset"
:href="`${$root.baseUrl}/${nestedSubCategory.slug}`">
<div class="category-logo">
<img
class="category-icon"
v-if="thirdLevelCategory.category_icon_path"
:src="`${$root.baseUrl}/storage/${thirdLevelCategory.category_icon_path}`" />
</div>
<span>@{{ thirdLevelCategory.name }}</span>
</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="wrapper" v-else-if="languages">
<div class="drawer-section">
<i class="rango-arrow-left fs24 text-down-4" @click="toggleSubcategories('root')"></i>
<h4 class="display-inbl">Languages</h4>
<i class="material-icons pull-right" @click="closeDrawer()">cancel</i>
</div>
<ul type="none">
@foreach ($allLocales as $locale)
<li>
<a
class="unset"
@if (isset($serachQuery))
href="?{{ $serachQuery }}&locale={{ $locale->code }}"
@else
href="?locale={{ $locale->code }}"
@endif>
<div class="category-logo">
<img
class="category-icon"
src="{{ asset('/storage/' . $locale->locale_image) }}" />
</div>
<span>
{{ isset($serachQuery) ? $locale->title : $locale->name }}
</span>
</a>
</li>
@endforeach
</ul>
</div>
<div class="wrapper" v-else-if="currencies">
<div class="drawer-section">
<i class="rango-arrow-left fs24 text-down-4" @click="toggleSubcategories('root')"></i>
<h4 class="display-inbl">Currencies</h4>
<i class="material-icons pull-right" @click="closeDrawer()">cancel</i>
</div>
<ul type="none">
@foreach ($allCurrency as $currency)
<li>
@if (isset($serachQuery))
<a
class="unset"
href="?{{ $serachQuery }}&locale={{ $currency->code }}">
<span>{{ $currency->code }}</span>
</a>
@else
<a
class="unset"
href="?locale={{ $currency->code }}">
<span>{{ $currency->code }}</span>
</a>
@endif
</li>
@endforeach
</ul>
</div>
</div>
<div class="hamburger-wrapper" @click="toggleHamburger">
<i class="rango-toggle hamburger"></i>
</div>
<logo-component></logo-component>
</div>
<div class="right-vc-header col-6">
<a
class="compare-btn unset"
@auth('customer')
href="{{ route('velocity.customer.product.compare') }}"
@endauth
@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>
<a class="wishlist-btn unset" :href="`${isCustomer ? '{{ route('customer.wishlist.index') }}' : '{{ route('velocity.product.guest-wishlist') }}'}`">
<div class="badge-container" v-if="wishlistCount > 0">
<span class="badge" v-text="wishlistCount"></span>
</div>
<i class="material-icons">favorite_border</i>
</a>
<a class="unset cursor-pointer" @click="openSearchBar">
<i class="material-icons">search</i>
</a>
@php
$cart = cart()->getCart();
$cartItemsCount = trans('shop::app.minicart.zero');
if ($cart) {
$cartItemsCount = $cart->items->count();
}
@endphp
<a href="{{ route('shop.checkout.cart.index') }}" class="unset">
<div class="badge-wrapper">
<span class="badge">{{ $cartItemsCount }}</span>
</div>
<i class="material-icons text-down-3">shopping_cart</i>
</a>
</div>
<searchbar-component v-if="isSearchbar"></searchbar-component>
</div>
</div>
<div
v-else
@mouseout="toggleSidebar('0', $event, 'mouseout')"
@mouseover="toggleSidebar('0', $event, 'mouseover')"
:class="`main-category fs16 unselectable fw6 ${($root.sharedRootCategories.length > 0) ? 'cursor-pointer' : 'cursor-not-allowed'} left`">
<i class="rango-view-list text-down-4 align-vertical-top fs18">
</i>
<span
class="pl5"
v-text="heading"
@mouseover="toggleSidebar('0', $event, 'mouseover')">
</span>
</div>
<div class="content-list right">
<ul type="none" class="no-margin">
<li v-for="(content, index) in headerContent" :key="index">
<a
v-text="content.title"
:href="`${$root.baseUrl}/${content['page_link']}`"
v-if="(content['content_type'] == 'link' || content['content_type'] == 'category')"
:target="content['link_target'] ? '_blank' : '_self'">
</a>
</li>
</ul>
</div>
</header>
</script>
<script type="text/javascript">
(() => {
Vue.component('content-header', {
template: '#content-header-template',
props: [
'heading',
'headerContent',
],
data: function () {
return {
'compareCount': 0,
'wishlistCount': 0,
'languages': false,
'hamburger': false,
'currencies': false,
'subCategory': null,
'isSearchbar': false,
'rootCategories': true,
'isCustomer': '{{ auth()->guard('customer')->user() ? "true" : "false" }}' == "true",
}
},
watch: {
hamburger: function (value) {
if (value) {
document.body.classList.add('open-hamburger');
} else {
document.body.classList.remove('open-hamburger');
}
},
'$root.headerItemsCount': function () {
this.updateHeaderItemsCount();
}
},
created: function () {
this.updateHeaderItemsCount();
},
methods: {
openSearchBar: function () {
this.isSearchbar = !this.isSearchbar;
let footer = $('.footer');
let homeContent = $('#home-right-bar-container');
if (this.isSearchbar) {
footer[0].style.opacity = '.3';
homeContent[0].style.opacity = '.3';
} else {
footer[0].style.opacity = '1';
homeContent[0].style.opacity = '1';
}
},
toggleHamburger: function () {
this.hamburger = !this.hamburger;
},
closeDrawer: function() {
$('.nav-container').hide();
this.toggleHamburger();
this.rootCategories = true;
},
toggleSubcategories: function (index, event) {
if (index == "root") {
this.rootCategories = true;
} else {
event.preventDefault();
let categories = this.$root.sharedRootCategories;
this.rootCategories = false;
this.subCategory = categories[index];
}
},
toggleMetaInfo: function (metaKey) {
this.rootCategories = false;
this[metaKey] = !this[metaKey];
},
updateHeaderItemsCount: function () {
if (! this.isCustomer) {
let comparedItems = this.getStorageValue('compared_product');
let wishlistedItems = this.getStorageValue('wishlist_product');
if (wishlistedItems) {
this.wishlistCount = wishlistedItems.length;
}
if (comparedItems) {
this.compareCount = comparedItems.length;
}
} else {
this.$http.get(`${this.$root.baseUrl}/items-count`)
.then(response => {
this.compareCount = response.data.compareProductsCount;
this.wishlistCount = response.data.wishlistedProductsCount;
})
.catch(exception => {
console.log(this.__('error.something_went_wrong'));
});
}
}
},
});
})()
</script>

View File

@ -41,6 +41,8 @@
</div>
</script>
@include('velocity::UI.header')
<script type="text/x-template" id="logo-template">
<a
:class="`left ${addClass}`"
@ -152,387 +154,6 @@
</div>
</script>
<script type="text/x-template" id="content-header-template">
<header class="row velocity-divide-page vc-header header-shadow active">
<div class="vc-small-screen container" v-if="isMobile()">
<div class="row">
<div class="col-6">
<div v-if="hamburger" class="nav-container scrollable">
<div class="wrapper" v-if="this.rootCategories">
<div class="greeting drawer-section fw6">
<i class="material-icons">perm_identity</i>
<span>
@guest('customer')
<a class="unset" href="{{ route('customer.session.index') }}">
{{ __('velocity::app.responsive.header.greeting', ['customer' => 'Guest']) }}
</a>
@endguest
@auth('customer')
<a class="unset" href="{{ route('customer.profile.index') }}">
{{ __('velocity::app.responsive.header.greeting', ['customer' => auth()->guard('customer')->user()->first_name]) }}
</a>
@endauth
<i
class="material-icons pull-right"
@click="closeDrawer()">
cancel
</i>
</span>
</div>
@php
$currency = $locale = null;
$currentLocale = app()->getLocale();
$currentCurrency = core()->getCurrentCurrencyCode();
$allLocales = core()->getCurrentChannel()->locales;
$allCurrency = core()->getCurrentChannel()->currencies;
@endphp
@foreach ($allLocales as $appLocale)
@if ($appLocale->code == $currentLocale)
@php
$locale = $appLocale;
@endphp
@endif
@endforeach
@foreach ($allCurrency as $appCurrency)
@if ($appCurrency->code == $currentCurrency)
@php
$currency = $appCurrency;
@endphp
@endif
@endforeach
<ul type="none" class="velocity-content">
<li :key="index" v-for="(content, index) in headerContent">
<a
class="unset"
v-text="content.title"
:href="`${$root.baseUrl}/${content.page_link}`">
</a>
</li>
</ul>
<ul type="none" class="category-wrapper">
<li v-for="(category, index) in $root.sharedRootCategories">
<a class="unset" :href="`${$root.baseUrl}/${category.slug}`">
<div class="category-logo">
<img
class="category-icon"
v-if="category.category_icon_path"
:src="`${$root.baseUrl}/storage/${category.category_icon_path}`" />
</div>
<span v-text="category.name"></span>
</a>
<i class="rango-arrow-right" @click="toggleSubcategories(index, $event)"></i>
</li>
</ul>
@auth('customer')
<ul type="none" class="vc-customer-options">
<li>
<a href="{{ route('customer.profile.index') }}" class="unset">
<i class="icon profile text-down-3"></i>
<span>{{ __('shop::app.header.profile') }}</span>
</a>
</li>
<li>
<a href="{{ route('customer.address.index') }}" class="unset">
<i class="icon address text-down-3"></i>
<span>{{ __('velocity::app.shop.general.addresses') }}</span>
</a>
</li>
<li>
<a href="{{ route('customer.reviews.index') }}" class="unset">
<i class="icon reviews text-down-3"></i>
<span>{{ __('velocity::app.shop.general.reviews') }}</span>
</a>
</li>
<li>
<a href="{{ route('customer.wishlist.index') }}" class="unset">
<i class="icon wishlist text-down-3"></i>
<span>{{ __('shop::app.header.wishlist') }}</span>
</a>
</li>
<li>
<a href="{{ route('customer.orders.index') }}" class="unset">
<i class="icon orders text-down-3"></i>
<span>{{ __('velocity::app.shop.general.orders') }}</span>
</a>
</li>
<li>
<a href="{{ route('customer.downloadable_products.index') }}" class="unset">
<i class="icon downloadables text-down-3"></i>
<span>{{ __('velocity::app.shop.general.downloadables') }}</span>
</a>
</li>
</ul>
@endauth
<ul type="none" class="meta-wrapper">
<li>
<div class="language-logo-wrapper">
@if ($locale->locale_image)
<img
class="language-logo"
src="{{ asset('/storage/' . $locale->locale_image) }}" />
@elseif ($locale->code == "en")
<img
class="language-logo"
src="{{ asset('/themes/velocity/assets/images/flags/en.png') }}" />
@endif
</div>
<span>{{ $locale->name }}</span>
<i
class="rango-arrow-right"
@click="toggleMetaInfo('languages')">
</i>
</li>
<li>
<span>{{ $currency->code }}</span>
<i
class="rango-arrow-right"
@click="toggleMetaInfo('currencies')">
</i>
</li>
<li>
@auth('customer')
<a
class="unset"
href="{{ route('customer.session.destroy') }}">
<span>{{ __('shop::app.header.logout') }}</span>
</a>
@endauth
@guest('customer')
<a
class="unset"
href="{{ route('customer.session.create') }}">
<span>{{ __('shop::app.customer.login-form.title') }}</span>
</a>
@endguest
</li>
</ul>
</div>
<div class="wrapper" v-else-if="subCategory">
<div class="drawer-section">
<i class="rango-arrow-left fs24 text-down-4" @click="toggleSubcategories('root')"></i>
<h4 class="display-inbl">@{{ subCategory.name }}</h4>
<i class="material-icons pull-right" @click="closeDrawer()">
cancel
</i>
</div>
<ul type="none">
<li
:key="index"
v-for="(nestedSubCategory, index) in subCategory.children">
<a
class="unset"
:href="`${$root.baseUrl}/${nestedSubCategory.slug}`">
<div class="category-logo">
<img
class="category-icon"
v-if="nestedSubCategory.category_icon_path"
:src="`${$root.baseUrl}/storage/${nestedSubCategory.category_icon_path}`" />
</div>
<span>@{{ nestedSubCategory.name }}</span>
</a>
<ul
type="none"
class="nested-category"
v-if="nestedSubCategory.children && nestedSubCategory.children.length > 0">
<li
:key="`index-${Math.random()}`"
v-for="(thirdLevelCategory, index) in nestedSubCategory.children">
<a
class="unset"
:href="`${$root.baseUrl}/${nestedSubCategory.slug}`">
<div class="category-logo">
<img
class="category-icon"
v-if="thirdLevelCategory.category_icon_path"
:src="`${$root.baseUrl}/storage/${thirdLevelCategory.category_icon_path}`" />
</div>
<span>@{{ thirdLevelCategory.name }}</span>
</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="wrapper" v-else-if="languages">
<div class="drawer-section">
<i class="rango-arrow-left fs24 text-down-4" @click="toggleSubcategories('root')"></i>
<h4 class="display-inbl">Languages</h4>
<i class="material-icons pull-right" @click="closeDrawer()">cancel</i>
</div>
<ul type="none">
@foreach ($allLocales as $locale)
<li>
<a
class="unset"
@if (isset($serachQuery))
href="?{{ $serachQuery }}&locale={{ $locale->code }}"
@else
href="?locale={{ $locale->code }}"
@endif>
<div class="category-logo">
<img
class="category-icon"
src="{{ asset('/storage/' . $locale->locale_image) }}" />
</div>
<span>
{{ isset($serachQuery) ? $locale->title : $locale->name }}
</span>
</a>
</li>
@endforeach
</ul>
</div>
<div class="wrapper" v-else-if="currencies">
<div class="drawer-section">
<i class="rango-arrow-left fs24 text-down-4" @click="toggleSubcategories('root')"></i>
<h4 class="display-inbl">Currencies</h4>
<i class="material-icons pull-right" @click="closeDrawer()">cancel</i>
</div>
<ul type="none">
@foreach ($allCurrency as $currency)
<li>
@if (isset($serachQuery))
<a
class="unset"
href="?{{ $serachQuery }}&locale={{ $currency->code }}">
<span>{{ $currency->code }}</span>
</a>
@else
<a
class="unset"
href="?locale={{ $currency->code }}">
<span>{{ $currency->code }}</span>
</a>
@endif
</li>
@endforeach
</ul>
</div>
</div>
<div class="hamburger-wrapper" @click="toggleHamburger">
<i class="rango-toggle hamburger"></i>
</div>
<logo-component></logo-component>
</div>
<div class="right-vc-header col-6">
<a
class="compare-btn unset"
@auth('customer')
href="{{ route('velocity.customer.product.compare') }}"
@endauth
@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>
<a class="wishlist-btn unset" :href="`${isCustomer ? '{{ route('customer.wishlist.index') }}' : '{{ route('velocity.product.guest-wishlist') }}'}`">
<div class="badge-container" v-if="wishlistCount > 0">
<span class="badge" v-text="wishlistCount"></span>
</div>
<i class="material-icons">favorite_border</i>
</a>
<a class="unset cursor-pointer" @click="openSearchBar">
<i class="material-icons">search</i>
</a>
@php
$cart = cart()->getCart();
$cartItemsCount = trans('shop::app.minicart.zero');
if ($cart) {
$cartItemsCount = $cart->items->count();
}
@endphp
<a href="{{ route('shop.checkout.cart.index') }}" class="unset">
<div class="badge-wrapper">
<span class="badge">{{ $cartItemsCount }}</span>
</div>
<i class="material-icons text-down-3">shopping_cart</i>
</a>
</div>
<searchbar-component v-if="isSearchbar"></searchbar-component>
</div>
</div>
<div
v-else
@mouseout="toggleSidebar('0', $event, 'mouseout')"
@mouseover="toggleSidebar('0', $event, 'mouseover')"
:class="`main-category fs16 unselectable fw6 ${($root.sharedRootCategories.length > 0) ? 'cursor-pointer' : 'cursor-not-allowed'} left`">
<i class="rango-view-list text-down-4 align-vertical-top fs18">
</i>
<span
class="pl5"
v-text="heading"
@mouseover="toggleSidebar('0', $event, 'mouseover')">
</span>
</div>
<div class="content-list right">
<ul type="none" class="no-margin">
<li v-for="(content, index) in headerContent" :key="index">
<a
v-text="content.title"
:href="`${$root.baseUrl}/${content['page_link']}`"
v-if="(content['content_type'] == 'link' || content['content_type'] == 'category')"
:target="content['link_target'] ? '_blank' : '_self'">
</a>
</li>
</ul>
</div>
</header>
</script>
<script type="text/x-template" id="sidebar-categories-template">
<div class="wrapper" v-if="rootCategories">
Hello World
@ -698,112 +319,5 @@
}
}
});
Vue.component('content-header', {
template: '#content-header-template',
props: [
'heading',
'headerContent',
],
data: function () {
return {
'languages': false,
'hamburger': false,
'currencies': false,
'subCategory': null,
'isSearchbar': false,
'rootCategories': true,
'isCustomer': '{{ auth()->guard('customer')->user() ? "true" : "false" }}' == "true",
}
},
watch: {
hamburger: function (value) {
if (value) {
document.body.classList.add('open-hamburger');
} else {
document.body.classList.remove('open-hamburger');
}
},
'$root.headerItemsCount': function () {
this.updateHeaderItemsCount();
}
},
created: function () {
this.updateHeaderItemsCount();
},
methods: {
openSearchBar: function () {
this.isSearchbar = !this.isSearchbar;
let footer = $('.footer');
let homeContent = $('#home-right-bar-container');
if (this.isSearchbar) {
footer[0].style.opacity = '.3';
homeContent[0].style.opacity = '.3';
} else {
footer[0].style.opacity = '1';
homeContent[0].style.opacity = '1';
}
},
toggleHamburger: function () {
this.hamburger = !this.hamburger;
},
closeDrawer: function() {
$('.nav-container').hide();
this.toggleHamburger();
this.rootCategories = true;
},
toggleSubcategories: function (index, event) {
if (index == "root") {
this.rootCategories = true;
} else {
event.preventDefault();
let categories = this.$root.sharedRootCategories;
this.rootCategories = false;
this.subCategory = categories[index];
}
},
toggleMetaInfo: function (metaKey) {
this.rootCategories = false;
this[metaKey] = !this[metaKey];
},
updateHeaderItemsCount: function () {
if (! this.isCustomer) {
let comparedItems = this.getStorageValue('compared_product');
let wishlistedItems = this.getStorageValue('wishlist_product');
if (wishlistedItems) {
this.wishlistCount = wishlistedItems.length;
}
if (comparedItems) {
this.compareCount = comparedItems.length;
}
} else {
this.$http.get(`${this.$root.baseUrl}/items-count`)
.then(response => {
this.compareCount = response.data.compareProductsCount;
this.wishlistCount = response.data.wishlistedProductsCount;
})
.catch(exception => {
console.log(this.__('error.something_went_wrong'));
});
}
}
},
});
})()
</script>

View File

@ -204,7 +204,7 @@
</div>
<div class="row col-12 remove-padding-margin actions">
<div class="product-quantity col-4 no-padding">
<div class="product-quantity col-lg-4 col-6 no-padding">
<quantity-changer
:control-name="'qty[{{$item->id}}]'"
quantity="{{ $item->quantity }}">
@ -248,18 +248,18 @@
{!! view_render_event('bagisto.shop.checkout.cart.summary.after', ['cart' => $cart]) !!}
@if ($cart)
<div class="col-lg-4 col-md-12 offset-2 row order-summary-container">
<div class="col-lg-4 col-md-12 offset-lg-2 row order-summary-container">
@include('shop::checkout.total.summary', ['cart' => $cart])
<coupon-component></coupon-component>
</div>
@else
<div class="fs16 col-12">
<div class="fs16 col-12 empty-cart-message">
{{ __('shop::app.checkout.cart.empty') }}
</div>
<a
class="fs16 mt15 col-12 remove-decoration"
class="fs16 mt15 col-12 remove-decoration continue-shopping"
href="{{ route('shop.home.index') }}">
<button type="button" class="theme-btn remove-decoration">

View File

@ -102,6 +102,7 @@
console.log(this.__('error.something_went_wrong'));
});
} else {
this.products = [];
this.isProductListLoaded = true;
}
},

View File

@ -40,87 +40,123 @@
@endphp
@section('content-wrapper')
<section class="row col-12 velocity-divide-page category-page-wrapper">
{!! view_render_event('bagisto.shop.productOrCategory.index.before', ['category' => $category]) !!}
<category-component></category-component>
@stop
@if (in_array($category->display_mode, [null, 'products_only', 'products_and_description']))
@include ('shop::products.list.layered-navigation')
@endif
<div class="category-container right">
<div class="row remove-padding-margin">
<div class="pl0 col-12">
<h1 class="fw6 mb10">{{ $category->name }}</h1>
@if ($isDisplayMode && $products->count())
@if ($category->description)
<div class="category-description">
{!! $category->description !!}
</div>
@endif
@endif
</div>
<div class="col-12 no-padding">
<div class="hero-image">
@if (!is_null($category->image))
<img class="logo" src="{{ $category->image_url }}" />
@push('scripts')
<script type="text/x-template" id="category-template">
<section class="row col-12 velocity-divide-page category-page-wrapper">
{!! view_render_event('bagisto.shop.productOrCategory.index.before', ['category' => $category]) !!}
@if (in_array($category->display_mode, [null, 'products_only', 'products_and_description']))
@include ('shop::products.list.layered-navigation')
@endif
<div class="category-container right">
<div class="row remove-padding-margin">
<div class="pl0 col-12">
<h1 class="fw6 mb10">{{ $category->name }}</h1>
@if ($isDisplayMode && $products->count())
@if ($category->description)
<div class="category-description">
{!! $category->description !!}
</div>
@endif
@endif
</div>
<div class="col-12 no-padding">
<div class="hero-image">
@if (!is_null($category->image))
<img class="logo" src="{{ $category->image_url }}" />
@endif
</div>
</div>
</div>
<div class="filters-container">
@include ('shop::products.list.toolbar')
</div>
<div
class="category-block"
@if ($category->display_mode == 'description_only')
style="width: 100%"
@endif>
@if ($isDisplayMode)
<shimmer-component v-if="isLoading && !isMobile()" shimmer-count="4"></shimmer-component>
<template v-else-if="products.length > 0">
@if ($toolbarHelper->getCurrentMode() == 'grid')
<div class="row col-12 remove-padding-margin">
<product-card
:key="index"
:product="product"
v-for="(product, index) in products">
</product-card>
</div>
@else
<div class="product-list">
<product-card
list=true
:key="index"
:product="product"
v-for="(product, index) in products">
</product-card>
</div>
@endif
{!! view_render_event('bagisto.shop.productOrCategory.index.pagination.before', ['category' => $category]) !!}
<div class="bottom-toolbar">
{{ $products->appends(request()->input())->links() }}
</div>
{!! view_render_event('bagisto.shop.productOrCategory.index.pagination.after', ['category' => $category]) !!}
</template>
<div class="product-list empty" v-else>
<h2>{{ __('shop::app.products.whoops') }}</h2>
<p>{{ __('shop::app.products.empty') }}</p>
</div>
@endif
</div>
</div>
{!! view_render_event('bagisto.shop.productOrCategory.index.after', ['category' => $category]) !!}
</section>
</script>
<div class="filters-container">
@include ('shop::products.list.toolbar')
</div>
<script>
Vue.component('category-component', {
template: '#category-template',
<div
class="category-block"
@if ($category->display_mode == 'description_only')
style="width: 100%"
@endif>
data: function () {
return {
'products': [],
'isLoading': true,
}
},
@if ($isDisplayMode)
@if ($products->count())
@if ($toolbarHelper->getCurrentMode() == 'grid')
<div class="row col-12 remove-padding-margin">
@foreach ($products as $productFlat)
@include ('shop::products.list.card', ['product' => $productFlat])
@endforeach
</div>
@else
<div class="product-list">
@foreach ($products as $productFlat)
@include ('shop::products.list.card', [
'list' => true,
'product' => $productFlat
])
@endforeach
</div>
@endif
created: function () {
this.getCategoryProducts();
},
{!! view_render_event('bagisto.shop.productOrCategory.index.pagination.before', ['category' => $category]) !!}
<div class="bottom-toolbar">
{{ $products->appends(request()->input())->links() }}
</div>
{!! view_render_event('bagisto.shop.productOrCategory.index.pagination.after', ['category' => $category]) !!}
@else
<div class="product-list empty">
<h2>{{ __('shop::app.products.whoops') }}</h2>
<p>
{{ __('shop::app.products.empty') }}
</p>
</div>
@endif
@endif
</div>
</div>
{!! view_render_event('bagisto.shop.productOrCategory.index.after', ['category' => $category]) !!}
</section>
@stop
methods: {
'getCategoryProducts': function () {
this.$http.get(`${this.$root.baseUrl}/category-products/{{ $category->id }}${window.location.search}`)
.then(response => {
this.isLoading = false;
this.products = response.data.products.data;
})
.catch(error => {
this.isLoading = false;
console.log(this.__('error.something_went_wrong'));
})
}
}
})
</script>
@endpush

View File

@ -128,7 +128,7 @@
</div>
</script>
<script type="text/javascript">
<script>
Vue.component('layered-navigation', {
template: '#layered-navigation-template',
data: function() {
@ -154,13 +154,13 @@
delete this.appliedFilters[attributeCode];
}
this.applyFilter()
this.applyFilter();
},
applyFilter: function () {
var params = [];
for(key in this.appliedFilters) {
for (key in this.appliedFilters) {
if (key != 'page') {
params.push(key + '=' + this.appliedFilters[key].join(','))
}