Merge remote-tracking branch 'upstream/master' into paypal-server-side-integration
Merged With Master
This commit is contained in:
commit
872dd9468d
|
|
@ -6,6 +6,7 @@ use Exception;
|
|||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Webkul\CartRule\Repositories\CartRuleRepository;
|
||||
use Webkul\CartRule\Repositories\CartRuleCouponRepository;
|
||||
|
||||
|
|
@ -113,30 +114,39 @@ class CartRuleController extends Controller
|
|||
*/
|
||||
public function store()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'name' => 'required',
|
||||
'channels' => 'required|array|min:1',
|
||||
'customer_groups' => 'required|array|min:1',
|
||||
'coupon_type' => 'required',
|
||||
'use_auto_generation' => 'required_if:coupon_type,==,1',
|
||||
'coupon_code' => 'required_if:use_auto_generation,==,0|unique:cart_rule_coupons,code',
|
||||
'starts_from' => 'nullable|date',
|
||||
'ends_till' => 'nullable|date|after_or_equal:starts_from',
|
||||
'action_type' => 'required',
|
||||
'discount_amount' => 'required|numeric',
|
||||
]);
|
||||
try {
|
||||
$this->validate(request(), [
|
||||
'name' => 'required',
|
||||
'channels' => 'required|array|min:1',
|
||||
'customer_groups' => 'required|array|min:1',
|
||||
'coupon_type' => 'required',
|
||||
'use_auto_generation' => 'required_if:coupon_type,==,1',
|
||||
'coupon_code' => 'required_if:use_auto_generation,==,0|unique:cart_rule_coupons,code',
|
||||
'starts_from' => 'nullable|date',
|
||||
'ends_till' => 'nullable|date|after_or_equal:starts_from',
|
||||
'action_type' => 'required',
|
||||
'discount_amount' => 'required|numeric',
|
||||
]);
|
||||
|
||||
$data = request()->all();
|
||||
$data = request()->all();
|
||||
|
||||
Event::dispatch('promotions.cart_rule.create.before');
|
||||
Event::dispatch('promotions.cart_rule.create.before');
|
||||
|
||||
$cartRule = $this->cartRuleRepository->create($data);
|
||||
$cartRule = $this->cartRuleRepository->create($data);
|
||||
|
||||
Event::dispatch('promotions.cart_rule.create.after', $cartRule);
|
||||
Event::dispatch('promotions.cart_rule.create.after', $cartRule);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Cart Rule']));
|
||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Cart Rule']));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
} catch (ValidationException $e) {
|
||||
|
||||
if ($firstError = collect($e->errors())->first()) {
|
||||
session()->flash('error', $firstError[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -163,30 +173,39 @@ class CartRuleController extends Controller
|
|||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'name' => 'required',
|
||||
'channels' => 'required|array|min:1',
|
||||
'customer_groups' => 'required|array|min:1',
|
||||
'coupon_type' => 'required',
|
||||
'use_auto_generation' => 'required_if:coupon_type,==,1',
|
||||
'coupon_code' => 'required_if:use_auto_generation,==,0|unique:cart_rule_coupons,code,' . $id,
|
||||
'starts_from' => 'nullable|date',
|
||||
'ends_till' => 'nullable|date|after_or_equal:starts_from',
|
||||
'action_type' => 'required',
|
||||
'discount_amount' => 'required|numeric',
|
||||
]);
|
||||
try {
|
||||
$this->validate(request(), [
|
||||
'name' => 'required',
|
||||
'channels' => 'required|array|min:1',
|
||||
'customer_groups' => 'required|array|min:1',
|
||||
'coupon_type' => 'required',
|
||||
'use_auto_generation' => 'required_if:coupon_type,==,1',
|
||||
'coupon_code' => 'required_if:use_auto_generation,==,0|unique:cart_rule_coupons,code,' . $id,
|
||||
'starts_from' => 'nullable|date',
|
||||
'ends_till' => 'nullable|date|after_or_equal:starts_from',
|
||||
'action_type' => 'required',
|
||||
'discount_amount' => 'required|numeric',
|
||||
]);
|
||||
|
||||
$cartRule = $this->cartRuleRepository->findOrFail($id);
|
||||
$cartRule = $this->cartRuleRepository->findOrFail($id);
|
||||
|
||||
Event::dispatch('promotions.cart_rule.update.before', $cartRule);
|
||||
Event::dispatch('promotions.cart_rule.update.before', $cartRule);
|
||||
|
||||
$cartRule = $this->cartRuleRepository->update(request()->all(), $id);
|
||||
$cartRule = $this->cartRuleRepository->update(request()->all(), $id);
|
||||
|
||||
Event::dispatch('promotions.cart_rule.update.after', $cartRule);
|
||||
Event::dispatch('promotions.cart_rule.update.after', $cartRule);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Cart Rule']));
|
||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Cart Rule']));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
} catch (ValidationException $e) {
|
||||
|
||||
if ($firstError = collect($e->errors())->first()) {
|
||||
session()->flash('error', $firstError[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
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=4ac9d3094b2372ee0b3e",
|
||||
"/js/velocity.js": "/js/velocity.js?id=9969a6f54dbcc0665da0",
|
||||
"/css/velocity-admin.css": "/css/velocity-admin.css?id=4322502d80a0e4a0affd",
|
||||
"/css/velocity.css": "/css/velocity.css?id=d1461e1147981876a7fd"
|
||||
"/css/velocity.css": "/css/velocity.css?id=e41e400c39a3cb5bc551"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,31 +3,34 @@
|
|||
<img
|
||||
:src="src"
|
||||
:data-zoom-image="src"
|
||||
ref="activeProductImage"
|
||||
id="active-product-image"
|
||||
class="main-product-image"
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.magnifier {
|
||||
> img {
|
||||
max-width: 100%;
|
||||
min-height: 530px;
|
||||
max-height: 530px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
export default {
|
||||
props: ['src'],
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
'activeImage': null,
|
||||
'activeImageElement': null,
|
||||
'activeImage': null
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function () {
|
||||
/* store image related info in global variables */
|
||||
this.activeImageElement = this.$refs.activeProductImage;
|
||||
|
||||
/* convert into jQuery object */
|
||||
this.activeImage = new jQuery.fn.init(this.activeImageElement);
|
||||
/* jQuery object */
|
||||
this.activeImage = $('.main-product-image');
|
||||
|
||||
/* initialise zoom */
|
||||
this.elevateZoom();
|
||||
|
|
@ -38,8 +41,8 @@
|
|||
this.activeImage.removeData('elevateZoom');
|
||||
|
||||
/* update source for images */
|
||||
this.activeImageElement.src = smallImageUrl;
|
||||
this.activeImage.data('zoom-image', (largeImageUrl ? largeImageUrl : smallImageUrl));
|
||||
this.activeImage.attr('src', smallImageUrl);
|
||||
this.activeImage.data('zoom-image', largeImageUrl);
|
||||
|
||||
/* reinitialize zoom */
|
||||
this.elevateZoom();
|
||||
|
|
@ -49,10 +52,11 @@
|
|||
methods: {
|
||||
'elevateZoom': function () {
|
||||
this.activeImage.ezPlus({
|
||||
zoomLevel: 0.5,
|
||||
cursor: 'pointer',
|
||||
scrollZoom: true,
|
||||
zoomWindowWidth: 400,
|
||||
zoomWindowHeight: 400,
|
||||
zoomWindowWidth: 250,
|
||||
zoomWindowHeight: 250,
|
||||
});
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@
|
|||
this.$http.delete(`${this.$root.baseUrl}/cart/remove/${productId}`)
|
||||
.then(response => {
|
||||
this.cartItems = this.cartItems.filter(item => item.id != productId);
|
||||
this.$root.miniCartKey++;
|
||||
|
||||
window.showAlert(`alert-${response.data.status}`, response.data.label, response.data.message);
|
||||
})
|
||||
|
|
@ -122,7 +123,7 @@
|
|||
},
|
||||
|
||||
checkMinimumOrder: function (e) {
|
||||
if (! this.isMinimumOrderCompleted) {
|
||||
if (! Boolean(this.isMinimumOrderCompleted)) {
|
||||
e.preventDefault();
|
||||
window.showAlert(`alert-warning`, 'Warning', this.minimumOrderMessage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<template v-else-if="productCollections.length > 0">
|
||||
<card-list-header
|
||||
:heading="isCategory ? categoryDetails.name : productTitle"
|
||||
:view-all="isCategory ? `${this.baseUrl}/${categoryDetails.slug}` : ''">
|
||||
:view-all="isCategory ? `${this.baseUrl}/${categoryDetails.url_path}` : ''">
|
||||
</card-list-header>
|
||||
|
||||
<div class="row" :class="localeDirection">
|
||||
|
|
|
|||
|
|
@ -2450,14 +2450,22 @@
|
|||
width: 800px;
|
||||
}
|
||||
|
||||
|
||||
/* compare products */
|
||||
.compare-products {
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 20px;
|
||||
word-break: break-word;
|
||||
margin-left: 0 !important;
|
||||
margin-right: 10px !important;
|
||||
|
||||
.active {
|
||||
cursor: grabbing;
|
||||
cursor: -webkit-grabbing;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
tr {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
@ -2520,6 +2528,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* hide scrollbar for chrome, safari and opera */
|
||||
.compare-products::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* hide scrollbar for ie, edge and firefox */
|
||||
.compare-products {
|
||||
/* ie and edge */
|
||||
-ms-overflow-style: none;
|
||||
|
||||
/* firefox */
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
//CSS for loader
|
||||
.cp-spinner {
|
||||
width: 48px;
|
||||
|
|
|
|||
|
|
@ -4,19 +4,6 @@
|
|||
padding-left: 0 !important;
|
||||
padding-right: 0 !important;
|
||||
|
||||
.magnifier {
|
||||
> img {
|
||||
max-width: 100%;
|
||||
min-height: 450px;
|
||||
max-height: 530px;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
// width: 100%;
|
||||
// height: 100%;
|
||||
}
|
||||
|
||||
.right {
|
||||
@extend .fs16;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
checkout-text="{{ __('shop::app.minicart.checkout') }}"
|
||||
checkout-url="{{ route('shop.checkout.onepage.index') }}"
|
||||
subtotal-text="{{ __('shop::app.checkout.cart.cart-subtotal') }}"
|
||||
is-minimum-order-completed="{{ Cart::checkMinimumOrder() }}"
|
||||
is-minimum-order-completed="{{ (bool) Cart::checkMinimumOrder() }}"
|
||||
minimum-order-message="{{ __('shop::app.checkout.cart.minimum-order-message', ['amount' => core()->currency($minimumOrderAmount)]) }}">
|
||||
</mini-cart>
|
||||
</div>
|
||||
|
|
@ -165,6 +165,8 @@
|
|||
|
||||
mounted: function () {
|
||||
this.getComparedProducts();
|
||||
|
||||
this.activateSlider();
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
@ -192,10 +194,6 @@
|
|||
.then(response => {
|
||||
this.isProductListLoaded = true;
|
||||
|
||||
if (response.data.products.length > 3) {
|
||||
$('.compare-products').css('overflow-x', 'scroll');
|
||||
}
|
||||
|
||||
this.products = response.data.products;
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
@ -286,6 +284,47 @@
|
|||
}
|
||||
|
||||
return attributeOptions;
|
||||
},
|
||||
|
||||
activateSlider: function () {
|
||||
/* main slider */
|
||||
const slider = document.querySelector('.compare-products');
|
||||
|
||||
let startX;
|
||||
let scrollLeft;
|
||||
|
||||
/* check for mouse down */
|
||||
let isMouseDown = false;
|
||||
|
||||
slider.addEventListener('mousedown', (e) => {
|
||||
isMouseDown = true;
|
||||
slider.classList.add('active');
|
||||
|
||||
startX = e.pageX - slider.offsetLeft;
|
||||
scrollLeft = slider.scrollLeft;
|
||||
});
|
||||
|
||||
slider.addEventListener('mouseleave', () => {
|
||||
isMouseDown = false;
|
||||
slider.classList.remove('active');
|
||||
});
|
||||
|
||||
slider.addEventListener('mouseup', () => {
|
||||
isMouseDown = false;
|
||||
slider.classList.remove('active');
|
||||
});
|
||||
|
||||
slider.addEventListener('mousemove', (e) => {
|
||||
if (! isMouseDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
const x = e.pageX - slider.offsetLeft;
|
||||
const walk = (x - startX) * 3;
|
||||
slider.scrollLeft = scrollLeft - walk;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@
|
|||
style="width: 100%"
|
||||
@endif>
|
||||
|
||||
<shimmer-component v-if="isLoading && !isMobile()" shimmer-count="4"></shimmer-component>
|
||||
<shimmer-component v-if="isLoading" shimmer-count="4"></shimmer-component>
|
||||
|
||||
<template v-else-if="products.length > 0">
|
||||
@if ($toolbarHelper->getCurrentMode() == 'grid')
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
add-class="product-gallery"
|
||||
:slides-count="thumbs.length">
|
||||
|
||||
<slide :slot="`slide-${index}`" v-for="(thumb, index) in thumbs">
|
||||
<slide :slot="`slide-${index}`" v-for="(thumb, index) in thumbs" :key="index">
|
||||
<li
|
||||
@mouseover="changeImage({
|
||||
largeImageUrl: thumb.large_image_url,
|
||||
|
|
@ -133,7 +133,8 @@
|
|||
this.currentOriginalImageUrl = originalImageUrl;
|
||||
|
||||
this.$root.$emit('changeMagnifiedImage', {
|
||||
smallImageUrl: this.currentOriginalImageUrl
|
||||
smallImageUrl: this.currentOriginalImageUrl,
|
||||
largeImageUrl: this.currentLargeImageUrl
|
||||
});
|
||||
|
||||
let productImage = $('.vc-small-product-image');
|
||||
|
|
|
|||
Loading…
Reference in New Issue