misc. minor updates
This commit is contained in:
parent
133dd6ebd4
commit
85b5261e4b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"/js/velocity.js": "/js/velocity.js?id=59115275749529fc9e30",
|
||||
"/js/velocity.js": "/js/velocity.js?id=3b296af97201fcbef148",
|
||||
"/css/velocity-admin.css": "/css/velocity-admin.css?id=612d35e452446366eef7",
|
||||
"/css/velocity.css": "/css/velocity.css?id=581e5c29d2518a2b2bb1"
|
||||
"/css/velocity.css": "/css/velocity.css?id=d12aae8c42eea4e2829b"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,10 +246,10 @@ class Helper extends Review
|
|||
'firstReviewText' => trans('velocity::app.products.be-first-review'),
|
||||
'priceHTML' => view('shop::products.price', ['product' => $product])->render(),
|
||||
'addToCartHtml' => view('shop::products.add-to-cart', [
|
||||
'product' => $product,
|
||||
'showCompare' => true,
|
||||
'addWishlistClass' => !(isset($list) && $list) ? '' : '',
|
||||
'addToCartBtnClass' => !(isset($list) && $list) ? 'small-padding' : '',
|
||||
'product' => $product,
|
||||
'addWishlistClass' => ! (isset($list) && $list) ? '' : '',
|
||||
'addToCartBtnClass' => ! (isset($list) && $list) ? 'small-padding' : '',
|
||||
])->render(),
|
||||
];
|
||||
}
|
||||
|
|
@ -261,10 +261,10 @@ class Helper extends Review
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fetchProductCollection($items)
|
||||
public function fetchProductCollection($items, $separator='&')
|
||||
{
|
||||
$productCollection = [];
|
||||
$productSlugs = explode('&', $items);
|
||||
$productSlugs = explode($separator, $items);
|
||||
|
||||
foreach ($productSlugs as $slug) {
|
||||
$product = $this->productRepository->findBySlug($slug);
|
||||
|
|
|
|||
|
|
@ -15,35 +15,6 @@ use Webkul\Product\Repositories\ProductRepository;
|
|||
*/
|
||||
class CartController extends Controller
|
||||
{
|
||||
/**
|
||||
* Webkul\Velocity\Helpers\Helper object
|
||||
*
|
||||
* @var Helper
|
||||
*/
|
||||
protected $velocityHelper;
|
||||
|
||||
/**
|
||||
* Webkul\Product\Repositories\ProductRepository object
|
||||
*
|
||||
* @var ProductRepository
|
||||
*/
|
||||
protected $productRepository;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
Helper $velocityHelper,
|
||||
ProductRepository $productRepository
|
||||
) {
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->velocityHelper = $velocityHelper;
|
||||
$this->productRepository = $productRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrives the mini cart details
|
||||
*
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Webkul\Velocity\Http\Controllers\Shop;
|
|||
|
||||
use Webkul\Velocity\Helpers\Helper;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository;
|
||||
use Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository as CustomerCompareProductRepository;
|
||||
|
||||
/**
|
||||
* Comparison controller
|
||||
|
|
@ -14,47 +14,6 @@ use Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository;
|
|||
*/
|
||||
class ComparisonController extends Controller
|
||||
{
|
||||
/**
|
||||
* Webkul\Velocity\Helpers\Helper object
|
||||
*
|
||||
* @var Helper
|
||||
*/
|
||||
protected $velocityHelper;
|
||||
|
||||
/**
|
||||
* Webkul\Product\Repositories\ProductRepository object
|
||||
*
|
||||
* @var ProductRepository
|
||||
*/
|
||||
protected $productRepository;
|
||||
|
||||
/**
|
||||
* Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository object of repository
|
||||
*
|
||||
* @var VelocityCustomerCompareProductRepository
|
||||
*/
|
||||
protected $velocityCompareProductsRepository;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\Product\Repositories\ProductRepository $productRepository
|
||||
* @param \Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository $velocityCompareProductsRepository
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
Helper $velocityHelper,
|
||||
ProductRepository $productRepository,
|
||||
VelocityCustomerCompareProductRepository $velocityCompareProductsRepository
|
||||
) {
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->velocityHelper = $velocityHelper;
|
||||
$this->productRepository = $productRepository;
|
||||
$this->velocityCompareProductsRepository = $velocityCompareProductsRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* function for customers to get products in comparison.
|
||||
*
|
||||
|
|
@ -67,7 +26,7 @@ class ComparisonController extends Controller
|
|||
$productCollection = [];
|
||||
|
||||
if (auth()->guard('customer')->user()) {
|
||||
$productCollection = $this->velocityCompareProductsRepository
|
||||
$productCollection = $this->compareProductsRepository
|
||||
->leftJoin(
|
||||
'product_flat',
|
||||
'velocity_customer_compare_products.product_flat_id',
|
||||
|
|
@ -113,14 +72,14 @@ class ComparisonController extends Controller
|
|||
$productId = request()->get('productId');
|
||||
$customerId = auth()->guard('customer')->user()->id;
|
||||
|
||||
$compareProduct = $this->velocityCompareProductsRepository->findOneByField([
|
||||
$compareProduct = $this->compareProductsRepository->findOneByField([
|
||||
'customer_id' => $customerId,
|
||||
'product_flat_id' => $productId,
|
||||
]);
|
||||
|
||||
if (! $compareProduct) {
|
||||
// insert new row
|
||||
$this->velocityCompareProductsRepository->create([
|
||||
$this->compareProductsRepository->create([
|
||||
'customer_id' => $customerId,
|
||||
'product_flat_id' => $productId,
|
||||
]);
|
||||
|
|
@ -150,12 +109,12 @@ class ComparisonController extends Controller
|
|||
if (request()->get('productId') == 'all') {
|
||||
// delete all
|
||||
$customerId = auth()->guard('customer')->user()->id;
|
||||
$this->velocityCompareProductsRepository->deleteWhere([
|
||||
$this->compareProductsRepository->deleteWhere([
|
||||
'customer_id' => auth()->guard('customer')->user()->id,
|
||||
]);
|
||||
} else {
|
||||
// delete individual
|
||||
$this->velocityCompareProductsRepository->deleteWhere([
|
||||
$this->compareProductsRepository->deleteWhere([
|
||||
'product_flat_id' => request()->get('productId'),
|
||||
'customer_id' => auth()->guard('customer')->user()->id,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,115 @@ 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;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Customer\Repositories\WishlistRepository;
|
||||
use Webkul\Category\Repositories\CategoryRepository;
|
||||
use Webkul\Velocity\Repositories\Product\ProductRepository as VelocityProductRepository;
|
||||
use Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository as CustomerCompareProductRepository;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use DispatchesJobs, ValidatesRequests;
|
||||
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* Webkul\Product\Helpers\ProductImage object
|
||||
*
|
||||
* @var ProductImage
|
||||
*/
|
||||
protected $productImageHelper;
|
||||
|
||||
/**
|
||||
* SearchRepository object
|
||||
*
|
||||
* @var SearchRepository
|
||||
*/
|
||||
protected $searchRepository;
|
||||
|
||||
/**
|
||||
* ProductRepository object
|
||||
*
|
||||
* @var ProductRepository
|
||||
*/
|
||||
protected $productRepository;
|
||||
|
||||
/**
|
||||
* ProductRepository object of velocity package
|
||||
*
|
||||
* @var ProductRepository
|
||||
*/
|
||||
protected $velocityProductRepository;
|
||||
|
||||
/**
|
||||
* CategoryRepository object of velocity package
|
||||
*
|
||||
* @var CategoryRepository
|
||||
*/
|
||||
protected $categoryRepository;
|
||||
|
||||
/**
|
||||
* WishlistRepository object
|
||||
*
|
||||
* @var WishlistRepository
|
||||
*/
|
||||
protected $wishlistRepository;
|
||||
|
||||
/**
|
||||
* \Webkul\Velocity\Helpers\Helper object
|
||||
*
|
||||
* @var Helper
|
||||
*/
|
||||
protected $velocityHelper;
|
||||
|
||||
/**
|
||||
* Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository object of repository
|
||||
*
|
||||
* @var VelocityCustomerCompareProductRepository
|
||||
*/
|
||||
protected $compareProductsRepository;
|
||||
|
||||
|
||||
/**
|
||||
* 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 CustomerCompareProductRepository $compareProductsRepository
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
Helper $velocityHelper,
|
||||
ProductImage $productImageHelper,
|
||||
SearchRepository $searchRepository,
|
||||
ProductRepository $productRepository,
|
||||
WishlistRepository $wishlistRepository,
|
||||
CategoryRepository $categoryRepository,
|
||||
VelocityProductRepository $velocityProductRepository,
|
||||
CustomerCompareProductRepository $compareProductsRepository
|
||||
) {
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->velocityHelper = $velocityHelper;
|
||||
$this->searchRepository = $searchRepository;
|
||||
$this->productRepository = $productRepository;
|
||||
$this->productImageHelper = $productImageHelper;
|
||||
$this->categoryRepository = $categoryRepository;
|
||||
$this->wishlistRepository = $wishlistRepository;
|
||||
$this->velocityProductRepository = $velocityProductRepository;
|
||||
$this->compareProductsRepository = $compareProductsRepository;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,8 @@ namespace Webkul\Velocity\Http\Controllers\Shop;
|
|||
use Illuminate\Http\Request;
|
||||
|
||||
use Cart;
|
||||
use Webkul\Product\Helpers\ProductImage;
|
||||
use Webkul\Velocity\Http\Shop\Controllers;
|
||||
use Webkul\Checkout\Contracts\Cart as CartModel;
|
||||
use Webkul\Product\Repositories\SearchRepository;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Category\Repositories\CategoryRepository;
|
||||
use Webkul\Velocity\Repositories\Product\ProductRepository as VelocityProductRepository;
|
||||
|
||||
/**
|
||||
* Shop controller
|
||||
|
|
@ -21,79 +16,11 @@ use Webkul\Velocity\Repositories\Product\ProductRepository as VelocityProductRep
|
|||
*/
|
||||
class ShopController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* Webkul\Product\Helpers\ProductImage object
|
||||
*
|
||||
* @var ProductImage
|
||||
*/
|
||||
protected $productImageHelper;
|
||||
|
||||
/**
|
||||
* SearchRepository object
|
||||
*
|
||||
* @var SearchRepository
|
||||
*/
|
||||
protected $searchRepository;
|
||||
|
||||
/**
|
||||
* ProductRepository object
|
||||
*
|
||||
* @var ProductRepository
|
||||
*/
|
||||
protected $productRepository;
|
||||
|
||||
/**
|
||||
* ProductRepository object of velocity package
|
||||
*
|
||||
* @var ProductRepository
|
||||
*/
|
||||
protected $velocityProductRepository;
|
||||
|
||||
/**
|
||||
* CategoryRepository object of velocity package
|
||||
*
|
||||
* @var CategoryRepository
|
||||
*/
|
||||
protected $categoryRepository;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @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
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
ProductImage $productImageHelper,
|
||||
SearchRepository $searchRepository,
|
||||
ProductRepository $productRepository,
|
||||
CategoryRepository $categoryRepository,
|
||||
VelocityProductRepository $velocityProductRepository
|
||||
) {
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->searchRepository = $searchRepository;
|
||||
$this->productRepository = $productRepository;
|
||||
$this->productImageHelper = $productImageHelper;
|
||||
$this->categoryRepository = $categoryRepository;
|
||||
$this->velocityProductRepository = $velocityProductRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Index to handle the view loaded with the search results
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$results = $this->velocityProductRepository->searchProductsFromCategory(request()->all());
|
||||
|
|
@ -272,4 +199,57 @@ class ShopController extends Controller
|
|||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function will provide the count of wishlist and comparison for logged in user
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getItemsCount()
|
||||
{
|
||||
if ($customer = auth()->guard('customer')->user()) {
|
||||
$wishlistItemsCount = $this->wishlistRepository->count([
|
||||
'customer_id' => $customer->id,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
]);
|
||||
|
||||
$comparedItemsCount = $this->compareProductsRepository->count([
|
||||
'customer_id' => $customer->id,
|
||||
]);
|
||||
|
||||
$response = [
|
||||
'status' => true,
|
||||
'compareProductsCount' => $comparedItemsCount,
|
||||
'wishlistedProductsCount' => $wishlistItemsCount,
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($response ?? [
|
||||
'status' => false
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function will provide details of multiple product
|
||||
*
|
||||
* @param $productIds
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getDetailedProducts()
|
||||
{
|
||||
// for product details
|
||||
if ($items = request()->get('items')) {
|
||||
$productCollection = $this->velocityHelper->fetchProductCollection($items);
|
||||
|
||||
$response = [
|
||||
'status' => 'success',
|
||||
'products' => $productCollection,
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($response ?? [
|
||||
'status' => false
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,23 +3,30 @@
|
|||
Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function () {
|
||||
Route::namespace('Webkul\Velocity\Http\Controllers\Shop')->group(function () {
|
||||
Route::get('/product-details/{slug}', 'ShopController@fetchProductDetails')
|
||||
->name('velocity.shop.product');
|
||||
->name('velocity.shop.product');
|
||||
|
||||
Route::get('/categorysearch', 'ShopController@search')->defaults('_config', [
|
||||
'view' => 'shop::search.search'
|
||||
])->name('velocity.search.index');
|
||||
Route::get('/categorysearch', 'ShopController@search')
|
||||
->name('velocity.search.index')
|
||||
->defaults('_config', [
|
||||
'view' => 'shop::search.search'
|
||||
]);
|
||||
|
||||
Route::get('/categories', 'ShopController@fetchCategories')->name('velocity.categoriest');
|
||||
Route::get('/categories', 'ShopController@fetchCategories')
|
||||
->name('velocity.categoriest');
|
||||
|
||||
Route::get('/category-details', 'ShopController@categoryDetails')->name('velocity.category.details');
|
||||
Route::get('/category-details', 'ShopController@categoryDetails')
|
||||
->name('velocity.category.details');
|
||||
|
||||
Route::get('/fancy-category-details/{slug}', 'ShopController@fetchFancyCategoryDetails')->name('velocity.fancy.category.details');
|
||||
|
||||
Route::get('/mini-cart', 'CartController@getMiniCartDetails')->name('velocity.cart.get.details');
|
||||
Route::get('/mini-cart', 'CartController@getMiniCartDetails')
|
||||
->name('velocity.cart.get.details');
|
||||
|
||||
Route::post('/cart/add', 'CartController@addProductToCart')->name('velocity.cart.add.product');
|
||||
Route::post('/cart/add', 'CartController@addProductToCart')
|
||||
->name('velocity.cart.add.product');
|
||||
|
||||
Route::delete('/cart/remove/{id}', 'CartController@removeProductFromCart')->name('velocity.cart.remove.product');
|
||||
Route::delete('/cart/remove/{id}', 'CartController@removeProductFromCart')
|
||||
->name('velocity.cart.remove.product');
|
||||
|
||||
Route::get('/comparison', 'ComparisonController@getComparisonList')
|
||||
->name('velocity.product.compare')
|
||||
|
|
@ -27,14 +34,22 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
|
|||
'view' => 'shop::guest.compare.index'
|
||||
]);
|
||||
|
||||
Route::put('/comparison', 'ComparisonController@addCompareProduct')->name('customer.product.add.compare');
|
||||
Route::put('/comparison', 'ComparisonController@addCompareProduct')
|
||||
->name('customer.product.add.compare');
|
||||
|
||||
Route::delete('/comparison', 'ComparisonController@deleteComparisonProduct')->name('customer.product.delete.compare');
|
||||
Route::delete('/comparison', 'ComparisonController@deleteComparisonProduct')
|
||||
->name('customer.product.delete.compare');
|
||||
|
||||
Route::get('/guest-wishlist', 'ShopController@getWishlistList')
|
||||
->name('velocity.product.guest-wishlist')
|
||||
->defaults('_config', [
|
||||
'view' => 'shop::guest.wishlist.index'
|
||||
]);
|
||||
|
||||
Route::get('/items-count', 'ShopController@getItemsCount')
|
||||
->name('velocity.product.details');
|
||||
|
||||
Route::get('/detailed-products', 'ShopController@getDetailedProducts')
|
||||
->name('velocity.product.details');
|
||||
});
|
||||
});
|
||||
|
|
@ -56,7 +56,10 @@
|
|||
|
||||
<div class="product-price fs16" v-html="product.priceHTML"></div>
|
||||
|
||||
<div class="product-rating col-12 no-padding" v-if="product.totalReviews && product.totalReviews > 0">
|
||||
<div
|
||||
class="product-rating col-12 no-padding"
|
||||
v-if="product.totalReviews && product.totalReviews > 0">
|
||||
|
||||
<star-ratings :ratings="product.avgRating"></star-ratings>
|
||||
<a class="fs14 align-top unset active-hover" :href="`${$root.baseUrl}/reviews/${product.slug}`">
|
||||
{{ __('products.reviews-count', {'totalReviews': product.totalReviews}) }}
|
||||
|
|
|
|||
|
|
@ -279,12 +279,17 @@
|
|||
.card-body {
|
||||
.compare-icon,
|
||||
.wishlist-icon {
|
||||
margin-left: 10px;
|
||||
left: 0;
|
||||
top: 10px;
|
||||
display: none;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.compare-icon {
|
||||
right: 0;
|
||||
position: absolute;
|
||||
left: unset;
|
||||
}
|
||||
|
||||
.add-to-cart-btn {
|
||||
|
|
@ -346,6 +351,17 @@
|
|||
transform: scale(1.05);
|
||||
}
|
||||
}
|
||||
|
||||
.compare-icon,
|
||||
.wishlist-icon {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
.sticker {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.lg-card-container:hover {
|
||||
|
|
@ -683,6 +699,11 @@
|
|||
max-width: 110px;
|
||||
max-height: 110px;
|
||||
}
|
||||
|
||||
.wishlist-icon {
|
||||
margin: 0;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.product-details-content {
|
||||
|
|
@ -1967,6 +1988,7 @@
|
|||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-height: 500px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@
|
|||
.compare-icon,
|
||||
.wishlist-icon {
|
||||
height: 46px;
|
||||
margin-left: 0;
|
||||
padding-left: 10px;
|
||||
|
||||
i {
|
||||
|
|
|
|||
|
|
@ -129,17 +129,15 @@
|
|||
</a>
|
||||
{!! view_render_event('bagisto.shop.layout.header.compare.after') !!}
|
||||
|
||||
@guest('customer')
|
||||
{!! view_render_event('bagisto.shop.layout.header.wishlist.before') !!}
|
||||
<a class="wishlist-btn unset" href="{{ route('velocity.product.guest-wishlist') }}">
|
||||
<i class="material-icons">favorite_border</i>
|
||||
<div class="badge-container" v-if="wishlistCount > 0">
|
||||
<span class="badge" v-text="wishlistCount"></span>
|
||||
</div>
|
||||
<span>{{ __('shop::app.layouts.wishlist') }}</span>
|
||||
</a>
|
||||
{!! view_render_event('bagisto.shop.layout.header.wishlist.after') !!}
|
||||
@endguest
|
||||
{!! view_render_event('bagisto.shop.layout.header.wishlist.before') !!}
|
||||
<a class="wishlist-btn unset" :href="`${isCustomer ? '{{ route('customer.wishlist.index') }}' : '{{ route('velocity.product.guest-wishlist') }}'}`">
|
||||
<i class="material-icons">favorite_border</i>
|
||||
<div class="badge-container" v-if="wishlistCount > 0">
|
||||
<span class="badge" v-text="wishlistCount"></span>
|
||||
</div>
|
||||
<span>{{ __('shop::app.layouts.wishlist') }}</span>
|
||||
</a>
|
||||
{!! view_render_event('bagisto.shop.layout.header.wishlist.after') !!}
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
|
@ -539,7 +537,7 @@
|
|||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
Vue.component('close-btn', {
|
||||
template: '#close-btn-template',
|
||||
|
|
@ -617,7 +615,8 @@
|
|||
return {
|
||||
compareCount: 0,
|
||||
wishlistCount: 0,
|
||||
searchedQuery: []
|
||||
searchedQuery: [],
|
||||
isCustomer: '{{ auth()->guard('customer')->user() ? "true" : "false" }}' == "true",
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -649,19 +648,30 @@
|
|||
},
|
||||
|
||||
'updateHeaderItemsCount': function () {
|
||||
let comparedItems = this.getStorageValue('compared_product');
|
||||
let wishlistedItems = this.getStorageValue('wishlist_product');
|
||||
if (! this.isCustomer) {
|
||||
let comparedItems = this.getStorageValue('compared_product');
|
||||
let wishlistedItems = this.getStorageValue('wishlist_product');
|
||||
|
||||
if (wishlistedItems) {
|
||||
this.wishlistCount = wishlistedItems.length;
|
||||
}
|
||||
if (wishlistedItems) {
|
||||
this.wishlistCount = wishlistedItems.length;
|
||||
}
|
||||
|
||||
if (comparedItems) {
|
||||
this.compareCount = comparedItems.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'));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
Vue.component('content-header', {
|
||||
template: '#content-header-template',
|
||||
|
|
@ -735,6 +745,6 @@
|
|||
this[metaKey] = !this[metaKey];
|
||||
}
|
||||
},
|
||||
})
|
||||
});
|
||||
})()
|
||||
</script>
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
@include ('shop::products.list.card', [
|
||||
'checkmode' => true,
|
||||
'itemId' => $item->id,
|
||||
'addToCartForm' => true,
|
||||
'removeWishlist' => true,
|
||||
'product' => $item->product,
|
||||
'btnText' => $moveToCartText,
|
||||
|
|
|
|||
|
|
@ -132,25 +132,24 @@
|
|||
|
||||
methods: {
|
||||
'getComparedProducts': function () {
|
||||
if (this.isCustomer) {
|
||||
var data = {
|
||||
params: {
|
||||
data: true,
|
||||
}
|
||||
};
|
||||
} else {
|
||||
let items = JSON.parse(window.localStorage.getItem('compared_product'));
|
||||
let url = `${this.$root.baseUrl}/${this.isCustomer ? 'comparison' : 'detailed-products'}`;
|
||||
|
||||
let data = {
|
||||
params: {'data': true}
|
||||
}
|
||||
|
||||
if (! this.isCustomer) {
|
||||
let items = this.getStorageValue('compared_product');
|
||||
items = items ? items.join('&') : '';
|
||||
|
||||
var data = {
|
||||
data = {
|
||||
params: {
|
||||
items,
|
||||
data: true,
|
||||
items
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this.$http.get(`${this.$root.baseUrl}/comparison`, data)
|
||||
this.$http.get(url, data)
|
||||
.then(response => {
|
||||
this.isProductListLoaded = true;
|
||||
this.products = response.data.products;
|
||||
|
|
|
|||
|
|
@ -36,20 +36,24 @@
|
|||
{!! view_render_event('bagisto.shop.customers.account.guest-customer.view.before') !!}
|
||||
|
||||
<div class="row products-collection col-12 ml0">
|
||||
<carousel-component
|
||||
slides-per-page="6"
|
||||
navigation-enabled="hide"
|
||||
pagination-enabled="hide"
|
||||
id="wishlist-products-carousel"
|
||||
:slides-count="products.length">
|
||||
<template v-if="products.length > 0">
|
||||
<carousel-component
|
||||
slides-per-page="6"
|
||||
navigation-enabled="hide"
|
||||
pagination-enabled="hide"
|
||||
id="wishlist-products-carousel"
|
||||
:slides-count="products.length">
|
||||
|
||||
<slide
|
||||
:key="index"
|
||||
:slot="`slide-${index}`"
|
||||
v-for="(product, index) in products">
|
||||
<product-card :product="product"></product-card>
|
||||
</slide>
|
||||
</carousel-component>
|
||||
<slide
|
||||
:key="index"
|
||||
:slot="`slide-${index}`"
|
||||
v-for="(product, index) in products">
|
||||
<product-card :product="product"></product-card>
|
||||
</slide>
|
||||
</carousel-component>
|
||||
</template>
|
||||
|
||||
<span v-else>{{ __('customer::app.wishlist.empty') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.guest-customer.view.after') !!}
|
||||
|
|
@ -67,68 +71,57 @@
|
|||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'$root.headerItemsCount': function () {
|
||||
this.getProducts();
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function () {
|
||||
this.getProducts();
|
||||
},
|
||||
|
||||
methods: {
|
||||
'getProducts': function () {
|
||||
let items = JSON.parse(window.localStorage.getItem('wishlist_product'));
|
||||
let items = this.getStorageValue('wishlist_product');
|
||||
items = items ? items.join('&') : '';
|
||||
|
||||
var data = {
|
||||
params: {
|
||||
items,
|
||||
data: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.$http.get(`${this.$root.baseUrl}/comparison`, data)
|
||||
.then(response => {
|
||||
this.isProductListLoaded = true;
|
||||
this.products = response.data.products;
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(this.__('error.something_went_wrong'));
|
||||
});
|
||||
},
|
||||
|
||||
'removeProduct': function (productId) {
|
||||
if (this.isCustomer) {
|
||||
this.$http.delete(`${this.$root.baseUrl}/comparison?productId=${productId}`)
|
||||
if (items != "") {
|
||||
this.$http
|
||||
.get(`${this.$root.baseUrl}/detailed-products`, {
|
||||
params: { items }
|
||||
})
|
||||
.then(response => {
|
||||
if (productId == 'all') {
|
||||
this.$set(this, 'products', this.products.filter(product => false));
|
||||
} else {
|
||||
this.$set(this, 'products', this.products.filter(product => product.id != productId));
|
||||
}
|
||||
|
||||
window.showAlert(`alert-${response.data.status}`, response.data.label, response.data.message);
|
||||
this.isProductListLoaded = true;
|
||||
this.products = response.data.products;
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(this.__('error.something_went_wrong'));
|
||||
});
|
||||
} else {
|
||||
let existingItems = window.localStorage.getItem('compared_product');
|
||||
existingItems = JSON.parse(existingItems);
|
||||
|
||||
if (productId == "all") {
|
||||
updatedItems = [];
|
||||
this.$set(this, 'products', []);
|
||||
} else {
|
||||
updatedItems = existingItems.filter(item => item != productId);
|
||||
this.$set(this, 'products', this.products.filter(product => product.slug != productId));
|
||||
}
|
||||
|
||||
window.localStorage.setItem('compared_product', JSON.stringify(updatedItems));
|
||||
|
||||
window.showAlert(
|
||||
`alert-success`,
|
||||
this.__('shop.general.alert.success'),
|
||||
`${this.__('customer.compare.removed')}`
|
||||
);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
'removeProduct': function (productId) {
|
||||
let existingItems = this.getStorageValue('wishlist_product');
|
||||
|
||||
if (productId == "all") {
|
||||
updatedItems = [];
|
||||
this.$set(this, 'products', []);
|
||||
} else {
|
||||
updatedItems = existingItems.filter(item => item != productId);
|
||||
this.$set(this, 'products', this.products.filter(product => product.slug != productId));
|
||||
}
|
||||
|
||||
this.$root.headerItemsCount++;
|
||||
this.setStorageValue('wishlist_product', updatedItems);
|
||||
|
||||
window.showAlert(
|
||||
`alert-success`,
|
||||
this.__('shop.general.alert.success'),
|
||||
`${this.__('customer.compare.removed')}`
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@
|
|||
{!! view_render_event('bagisto.shop.home.content.before') !!}
|
||||
|
||||
@if ($velocityMetaData)
|
||||
{!! DbView::make($velocityMetaData)->field('home_page_content')->render() !!}
|
||||
{{-- {!! DbView::make($velocityMetaData)->field('home_page_content')->render() !!} --}}
|
||||
@include('shop::home.new-products')
|
||||
@else
|
||||
@include('shop::home.advertisements.advertisement-four')
|
||||
@include('shop::home.featured-products')
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{!! view_render_event('bagisto.shop.products.add_to_cart.before', ['product' => $product]) !!}
|
||||
|
||||
<div class="row mx-0 col-12 no-padding">
|
||||
<div class="mx-0 no-padding">
|
||||
@if (isset($showCompare) && $showCompare)
|
||||
<compare-component
|
||||
@auth('customer')
|
||||
|
|
@ -37,6 +37,29 @@
|
|||
{{ __('shop::app.products.add-to-cart') }}
|
||||
</span>
|
||||
</button>
|
||||
@elseif(isset($addToCartForm) && !$addToCartForm)
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ route('cart.add', $product->product_id) }}">
|
||||
|
||||
@csrf
|
||||
|
||||
<input type="hidden" name="product_id" value="{{ $product->product_id }}">
|
||||
<input type="hidden" name="quantity" value="1">
|
||||
<button
|
||||
type="submit"
|
||||
{{ ! $product->isSaleable() ? 'disabled' : '' }}
|
||||
class="btn btn-add-to-cart {{ $addToCartBtnClass ?? '' }}">
|
||||
|
||||
@if (! (isset($showCartIcon) && !$showCartIcon))
|
||||
<i class="material-icons text-down-3">shopping_cart</i>
|
||||
@endif
|
||||
|
||||
<span class="fs14 fw6 text-uppercase text-up-4">
|
||||
{{ $btnText ?? __('shop::app.products.add-to-cart') }}
|
||||
</span>
|
||||
</button>
|
||||
</form>
|
||||
@else
|
||||
<add-to-cart
|
||||
form="true"
|
||||
|
|
|
|||
|
|
@ -117,11 +117,12 @@
|
|||
</div>
|
||||
@endif
|
||||
|
||||
<div class="cart-wish-wrap row col-12 no-padding ml0">
|
||||
<div class="cart-wish-wrap no-padding ml0">
|
||||
@include ('shop::products.add-to-cart', [
|
||||
'product' => $product,
|
||||
'showCompare' => true,
|
||||
'btnText' => $btnText ?? null,
|
||||
'showCompare' => true,
|
||||
'product' => $product,
|
||||
'btnText' => $btnText ?? null,
|
||||
'addToCartForm' => $addToCartForm ?? false,
|
||||
'addToCartBtnClass' => $addToCartBtnClass ?? '',
|
||||
])
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue