Merge pull request #2696 from shubhwebkul/velocity-updated
misc. bug fixes
This commit is contained in:
commit
edee5c2f16
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
|
||||
namespace Webkul\Theme;
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ class ThemeViewFinder extends FileViewFinder
|
|||
{
|
||||
// Extract the $view and the $namespace parts
|
||||
list($namespace, $view) = $this->parseNamespaceSegments($name);
|
||||
|
||||
|
||||
if ($namespace != 'admin') {
|
||||
$paths = $this->addThemeNamespacePaths($namespace);
|
||||
|
||||
|
|
@ -64,14 +64,14 @@ class ThemeViewFinder extends FileViewFinder
|
|||
/**
|
||||
* Override replaceNamespace() to add path for custom error pages "resources/themes/theme_name/views/errors/..."
|
||||
*
|
||||
* @param string $namespace
|
||||
* @param string $namespace
|
||||
* @param string|array $hints
|
||||
* @return void
|
||||
*/
|
||||
public function replaceNamespace($namespace, $hints)
|
||||
{
|
||||
$this->hints[$namespace] = (array) $hints;
|
||||
|
||||
|
||||
// Overide Error Pages
|
||||
if ($namespace == 'errors' || $namespace == 'mails') {
|
||||
$searchPaths = array_diff($this->paths, Themes::getLaravelViewPaths());
|
||||
|
|
|
|||
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=eb965248ceaa0e1d9f5a",
|
||||
"/js/velocity.js": "/js/velocity.js?id=2ae4efd13e4e5a1b4055",
|
||||
"/css/velocity-admin.css": "/css/velocity-admin.css?id=612d35e452446366eef7",
|
||||
"/css/velocity.css": "/css/velocity.css?id=1eb4121f60ae933bb0c9"
|
||||
"/css/velocity.css": "/css/velocity.css?id=3b5f1d7a695ef3820846"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ use Webkul\Velocity\Repositories\VelocityMetadataRepository;
|
|||
class Helper extends Review
|
||||
{
|
||||
/**
|
||||
* productModel object
|
||||
*
|
||||
* @var \Webkul\Product\Contracts\Product
|
||||
*/
|
||||
* productModel object
|
||||
*
|
||||
* @var \Webkul\Product\Contracts\Product
|
||||
*/
|
||||
protected $productModel;
|
||||
|
||||
/**
|
||||
|
|
@ -42,7 +42,7 @@ class Helper extends Review
|
|||
*/
|
||||
protected $productFlatRepository;
|
||||
|
||||
/**
|
||||
/**
|
||||
* productModel object
|
||||
*
|
||||
* @var \Webkul\Attribute\Repositories\AttributeOptionRepository
|
||||
|
|
@ -66,11 +66,12 @@ class Helper extends Review
|
|||
/**
|
||||
* Create a helper instamce
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product $productModel
|
||||
* @param \Webkul\Velocity\Repositories\OrderBrandsRepository $orderBrands
|
||||
* @param \Webkul\Attribute\Repositories\AttributeOptionRepository $attributeOptionRepository
|
||||
* @param \Webkul\Product\Repositories\ProductReviewRepository $productReviewRepository
|
||||
* @param \Webkul\Velocity\Repositories\VelocityMetadataRepository $velocityMetadataRepository
|
||||
* @param \Webkul\Product\Contracts\Product $productModel
|
||||
* @param \Webkul\Velocity\Repositories\OrderBrandsRepository $orderBrands
|
||||
* @param \Webkul\Attribute\Repositories\AttributeOptionRepository $attributeOptionRepository
|
||||
* @param \Webkul\Product\Repositories\ProductReviewRepository $productReviewRepository
|
||||
* @param \Webkul\Velocity\Repositories\VelocityMetadataRepository $velocityMetadataRepository
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
@ -89,7 +90,7 @@ class Helper extends Review
|
|||
$this->productRepository = $productRepository;
|
||||
|
||||
$this->productFlatRepository = $productFlatRepository;
|
||||
|
||||
|
||||
$this->orderBrandsRepository = $orderBrandsRepository;
|
||||
|
||||
$this->productReviewRepository = $productReviewRepository;
|
||||
|
|
@ -98,7 +99,8 @@ class Helper extends Review
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \Webkul\Sales\Contracts\Order
|
||||
* @param \Webkul\Sales\Contracts\Order $order
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function topBrand($order)
|
||||
|
|
@ -109,8 +111,8 @@ class Helper extends Review
|
|||
$products[] = $orderItem->product;
|
||||
|
||||
$this->orderBrandsRepository->create([
|
||||
'order_id' => $orderItem->order_id,
|
||||
'order_item_id' => $orderItem->id,
|
||||
'order_id' => $orderItem->order_id,
|
||||
'product_id' => $orderItem->product_id,
|
||||
'brand' => $products[$key]->brand,
|
||||
]);
|
||||
|
|
@ -172,6 +174,7 @@ class Helper extends Review
|
|||
* Returns the count rating of the product
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product $product
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCountRating($product)
|
||||
|
|
@ -229,10 +232,11 @@ class Helper extends Review
|
|||
*/
|
||||
public function getShopRecentReviews($reviewCount = 4)
|
||||
{
|
||||
$reviews = $this->productReviewRepository->getModel()
|
||||
->orderBy('id', 'desc')
|
||||
->where('status', 'approved')
|
||||
->take($reviewCount)->get();
|
||||
$reviews = $this->productReviewRepository
|
||||
->getModel()
|
||||
->orderBy('id', 'desc')
|
||||
->where('status', 'approved')
|
||||
->take($reviewCount)->get();
|
||||
|
||||
return $reviews;
|
||||
}
|
||||
|
|
@ -267,8 +271,8 @@ class Helper extends Review
|
|||
'images' => $images,
|
||||
'itemId' => $item->id,
|
||||
'name' => $item->name,
|
||||
'url_key' => $product->url_key,
|
||||
'quantity' => $item->quantity,
|
||||
'url_key' => $product->url_key,
|
||||
'baseTotal' => core()->currency($item->base_total),
|
||||
];
|
||||
}
|
||||
|
|
@ -278,7 +282,7 @@ class Helper extends Review
|
|||
* @param bool $list
|
||||
* @return array
|
||||
*/
|
||||
public function formatProduct($product, $list = false)
|
||||
public function formatProduct($product, $list = false, $metaInformation = [])
|
||||
{
|
||||
$reviewHelper = app('Webkul\Product\Helpers\Review');
|
||||
$productImageHelper = app('Webkul\Product\Helpers\ProductImage');
|
||||
|
|
@ -317,6 +321,12 @@ class Helper extends Review
|
|||
'showCompare' => true,
|
||||
'product' => $product,
|
||||
'addWishlistClass' => ! (isset($list) && $list) ? '' : '',
|
||||
'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(),
|
||||
];
|
||||
|
|
@ -330,7 +340,7 @@ class Helper extends Review
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fetchProductCollection($items, $separator='&')
|
||||
public function fetchProductCollection($items, $moveToCart = false, $separator='&')
|
||||
{
|
||||
$productCollection = [];
|
||||
$productIds = explode($separator, $items);
|
||||
|
|
@ -343,7 +353,10 @@ class Helper extends Review
|
|||
$product = $this->productRepository->findOneWhere(['id' => $productFlat->product_id]);
|
||||
|
||||
if ($product) {
|
||||
$formattedProduct = $this->formatProduct($productFlat);
|
||||
$formattedProduct = $this->formatProduct($productFlat, false, [
|
||||
'moveToCart' => $moveToCart,
|
||||
'btnText' => $moveToCart ? trans('shop::app.customer.account.wishlist.move-to-cart') : null,
|
||||
]);
|
||||
|
||||
$productMetaDetails = [];
|
||||
$productMetaDetails['slug'] = $product->url_key;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class ShopController extends Controller
|
|||
|
||||
if ($product) {
|
||||
$productReviewHelper = app('Webkul\Product\Helpers\Review');
|
||||
|
||||
|
||||
$galleryImages = $this->productImageHelper->getProductBaseImage($product);
|
||||
|
||||
$response = [
|
||||
|
|
@ -92,7 +92,7 @@ class ShopController extends Controller
|
|||
$productDetails = [];
|
||||
|
||||
$productDetails = array_merge($productDetails, $this->velocityHelper->formatProduct($product));
|
||||
|
||||
|
||||
array_push($customizedProducts, $productDetails);
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +217,9 @@ class ShopController extends Controller
|
|||
{
|
||||
// for product details
|
||||
if ($items = request()->get('items')) {
|
||||
$productCollection = $this->velocityHelper->fetchProductCollection($items);
|
||||
$moveToCart = request()->get('moveToCart');
|
||||
|
||||
$productCollection = $this->velocityHelper->fetchProductCollection($items, $moveToCart);
|
||||
|
||||
$response = [
|
||||
'status' => 'success',
|
||||
|
|
|
|||
|
|
@ -20,8 +20,10 @@
|
|||
'isEnable',
|
||||
'csrfToken',
|
||||
'productId',
|
||||
'moveToCart',
|
||||
'showCartIcon',
|
||||
'addClassToBtn',
|
||||
'productFlatId',
|
||||
],
|
||||
|
||||
data: function () {
|
||||
|
|
@ -47,6 +49,15 @@
|
|||
if (response.data.status == 'success') {
|
||||
this.$root.miniCartKey++;
|
||||
|
||||
if (this.moveToCart == "true") {
|
||||
let existingItems = this.getStorageValue('wishlist_product');
|
||||
|
||||
let updatedItems = existingItems.filter(item => item != this.productFlatId);
|
||||
|
||||
this.$root.headerItemsCount++;
|
||||
this.setStorageValue('wishlist_product', updatedItems);
|
||||
}
|
||||
|
||||
window.showAlert(`alert-success`, this.__('shop.general.alert.success'), response.data.message);
|
||||
} else {
|
||||
window.showAlert(`alert-${response.data.status}`, response.data.label ? response.data.label : this.__('shop.general.alert.error'), response.data.message);
|
||||
|
|
@ -59,7 +70,7 @@
|
|||
.catch(error => {
|
||||
console.log(this.__('error.something_went_wrong'));
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -87,8 +87,6 @@
|
|||
return {
|
||||
'addToCart': 0,
|
||||
'addToCartHtml': '',
|
||||
'message' : "Hello there",
|
||||
'showTestClass': 'sdfsdf',
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@
|
|||
mounted: function () {
|
||||
$('.compare-icon').click(this.closeQuickView);
|
||||
$('.wishlist-icon').click(this.closeQuickView);
|
||||
$('.add-to-cart-btn').click(this.closeQuickView);
|
||||
$('.add-to-cart-btn').click(() => setTimeout(this.closeQuickView, 0));
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -2272,6 +2272,9 @@
|
|||
|
||||
|
||||
.compare-products {
|
||||
// overflow-x: scroll;
|
||||
// padding-bottom: 30px;
|
||||
|
||||
.col,
|
||||
.col-2 {
|
||||
padding-left: 0;
|
||||
|
|
|
|||
|
|
@ -718,6 +718,10 @@ body::after {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.description-text {
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
if (items != "") {
|
||||
this.$http
|
||||
.get(`${this.$root.baseUrl}/detailed-products`, {
|
||||
params: { items }
|
||||
params: { moveToCart: true, items }
|
||||
})
|
||||
.then(response => {
|
||||
this.isProductListLoaded = true;
|
||||
|
|
@ -101,8 +101,9 @@
|
|||
this.isProductListLoaded = true;
|
||||
console.log(this.__('error.something_went_wrong'));
|
||||
});
|
||||
} else {
|
||||
this.isProductListLoaded = true;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
'removeProduct': function (productId) {
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@
|
|||
<div class="add-to-cart-btn pl0">
|
||||
@if (isset($form) && !$form)
|
||||
<button
|
||||
type="button"
|
||||
@click="onSubmit"
|
||||
type="submit"
|
||||
{{ ! $product->isSaleable() ? 'disabled' : '' }}
|
||||
class="btn btn-add-to-cart {{ $addToCartBtnClass ?? '' }}">
|
||||
|
||||
|
|
@ -34,7 +33,7 @@
|
|||
<i class="material-icons text-down-3">shopping_cart</i>
|
||||
@endif
|
||||
|
||||
<span class="fs14 fw6 text-uppercase text-up-4">
|
||||
<span type="submit" class="fs14 fw6 text-uppercase text-up-4">
|
||||
{{ __('shop::app.products.add-to-cart') }}
|
||||
</span>
|
||||
</button>
|
||||
|
|
@ -65,7 +64,9 @@
|
|||
<add-to-cart
|
||||
form="true"
|
||||
csrf-token='{{ csrf_token() }}'
|
||||
product-flat-id="{{ $product->id }}"
|
||||
product-id="{{ $product->product_id }}"
|
||||
move-to-cart="{{ $moveToCart ?? false }}"
|
||||
add-class-to-btn="{{ $addToCartBtnClass ?? '' }}"
|
||||
is-enable={{ ! $product->isSaleable() ? 'false' : 'true' }}
|
||||
show-cart-icon={{ !(isset($showCartIcon) && !$showCartIcon) }}
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@
|
|||
<form
|
||||
method="POST"
|
||||
id="product-form"
|
||||
@click="onSubmit($event)"
|
||||
action="{{ route('cart.add', $product->product_id) }}">
|
||||
|
||||
<input type="hidden" name="is_buy_now" v-model="is_buy_now">
|
||||
|
|
@ -193,11 +194,11 @@
|
|||
</form>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
Vue.component('product-view', {
|
||||
inject: ['$validator'],
|
||||
template: '#product-view-template',
|
||||
data: function() {
|
||||
data: function () {
|
||||
return {
|
||||
slot: true,
|
||||
is_buy_now: 0,
|
||||
|
|
@ -209,6 +210,7 @@
|
|||
|
||||
let currentProductId = '{{ $product->url_key }}';
|
||||
let existingViewed = window.localStorage.getItem('recentlyViewed');
|
||||
|
||||
if (! existingViewed) {
|
||||
existingViewed = [];
|
||||
} else {
|
||||
|
|
@ -238,15 +240,15 @@
|
|||
},
|
||||
|
||||
methods: {
|
||||
onSubmit: function(e) {
|
||||
if (e.target.getAttribute('type') != 'submit')
|
||||
onSubmit: function(event) {
|
||||
if (event.target.getAttribute('type') != 'submit')
|
||||
return;
|
||||
|
||||
e.preventDefault();
|
||||
event.preventDefault();
|
||||
|
||||
this.$validator.validateAll().then(result => {
|
||||
if (result) {
|
||||
this.is_buy_now = e.target.classList.contains('buynow') ? 1 : 0;
|
||||
this.is_buy_now = event.target.classList.contains('buynow') ? 1 : 0;
|
||||
|
||||
setTimeout(function() {
|
||||
document.getElementById('product-form').submit();
|
||||
|
|
@ -291,7 +293,6 @@
|
|||
]
|
||||
});
|
||||
}, 0);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue