Merge pull request #2450 from shubhwebkul/velocity-updated
misc. updates
This commit is contained in:
commit
92d50b76bc
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=7f746af03035ad1a9a1f",
|
"/js/velocity.js": "/js/velocity.js?id=384363a24374735154d8",
|
||||||
"/css/velocity-admin.css": "/css/velocity-admin.css?id=612d35e452446366eef7",
|
"/css/velocity-admin.css": "/css/velocity-admin.css?id=612d35e452446366eef7",
|
||||||
"/css/velocity.css": "/css/velocity.css?id=aa8d76055810af176fc3"
|
"/css/velocity.css": "/css/velocity.css?id=ad57fd83b1d077b91c24"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -206,5 +206,20 @@ class Helper extends Review
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function formatCartItem($item)
|
||||||
|
{
|
||||||
|
$product = $item->product;
|
||||||
|
$images = $product->getTypeInstance()->getBaseImage($item);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'images' => $images,
|
||||||
|
'itemId' => $item->id,
|
||||||
|
'name' => $item->name,
|
||||||
|
'url_key' => $product->url_key,
|
||||||
|
'quantity' => $item->quantity,
|
||||||
|
'baseTotal' => core()->currency($item->base_total),
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
namespace Webkul\Velocity\Http\Controllers\Shop;
|
namespace Webkul\Velocity\Http\Controllers\Shop;
|
||||||
|
|
||||||
use Webkul\Velocity\Helpers\Helper;
|
use Cart;
|
||||||
use Webkul\Velocity\Http\Shop\Controllers;
|
use Webkul\Velocity\Http\Shop\Controllers;
|
||||||
|
use Webkul\Checkout\Contracts\Cart as CartModel;
|
||||||
use Webkul\Product\Repositories\SearchRepository;
|
use Webkul\Product\Repositories\SearchRepository;
|
||||||
use Webkul\Product\Repositories\ProductRepository;
|
use Webkul\Product\Repositories\ProductRepository;
|
||||||
use Webkul\Velocity\Repositories\Product\ProductRepository as VelocityProductRepository;
|
use Webkul\Velocity\Repositories\Product\ProductRepository as VelocityProductRepository;
|
||||||
|
|
@ -231,4 +232,71 @@ use Webkul\Velocity\Repositories\Product\ProductRepository as VelocityProductRep
|
||||||
])->render(),
|
])->render(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for guests user to add the product in the cart.
|
||||||
|
*
|
||||||
|
* @return Mixed
|
||||||
|
*/
|
||||||
|
public function addProductToCart()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$cart = Cart::getCart();
|
||||||
|
$formattedBeforeItems = [];
|
||||||
|
$id = request()->get('product_id');
|
||||||
|
$velocityHelper = app('Webkul\Velocity\Helpers\Helper');
|
||||||
|
|
||||||
|
if ($cart) {
|
||||||
|
$beforeItems = $cart->items;
|
||||||
|
|
||||||
|
foreach ($beforeItems as $item) {
|
||||||
|
array_push($formattedBeforeItems, $velocityHelper->formatCartItem($item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cart = Cart::addProduct($id, request()->all());
|
||||||
|
|
||||||
|
if (is_array($cart) && isset($cart['warning'])) {
|
||||||
|
$response = [
|
||||||
|
'status' => 'warning',
|
||||||
|
'message' => $cart['warning'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cart instanceof CartModel) {
|
||||||
|
$items = $cart->items;
|
||||||
|
$formattedItems = [];
|
||||||
|
|
||||||
|
foreach ($items as $item) {
|
||||||
|
array_push($formattedItems, $velocityHelper->formatCartItem($item));
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
'status' => 'success',
|
||||||
|
'totalCartItems' => sizeof($items),
|
||||||
|
'addedItems' => array_slice($formattedItems, sizeof($formattedBeforeItems)),
|
||||||
|
'message' => trans('shop::app.checkout.cart.item.success'),
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($customer = auth()->guard('customer')->user())
|
||||||
|
$this->wishlistRepository->deleteWhere(['product_id' => $id, 'customer_id' => $customer->id]);
|
||||||
|
|
||||||
|
if (request()->get('is_buy_now'))
|
||||||
|
return redirect()->route('shop.checkout.onepage.index');
|
||||||
|
}
|
||||||
|
} catch(\Exception $exception) {
|
||||||
|
$product = $this->productRepository->find($id);
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
'status' => 'false',
|
||||||
|
'message' => trans($exception->getMessage()),
|
||||||
|
'redirectionRoute' => route('shop.productOrCategory.index', $product->url_key),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response ?? [
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => trans('velocity::app.error.something-went-wrong'),
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,7 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
|
||||||
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('/fancy-category-details/{slug}', 'ShopController@fetchFancyCategoryDetails')->name('velocity.fancy.category.details');
|
||||||
|
|
||||||
|
Route::post('/cart/add', 'ShopController@addProductToCart')->name('velocity.cart.add.product');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
<template>
|
||||||
|
<form method="POST" @submit.prevent="addToCart">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
:disabled="isButtonEnable == 'false'"
|
||||||
|
:class="`btn btn-add-to-cart ${addClassToBtn}`">
|
||||||
|
|
||||||
|
<i class="material-icons text-down-3" v-if="showCartIcon">shopping_cart</i>
|
||||||
|
|
||||||
|
<span class="fs14 fw6 text-uppercase text-up-4" v-text="btnText"></span>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
export default {
|
||||||
|
props: [
|
||||||
|
'form',
|
||||||
|
'btnText',
|
||||||
|
'isEnable',
|
||||||
|
'csrfToken',
|
||||||
|
'productId',
|
||||||
|
'showCartIcon',
|
||||||
|
'addClassToBtn',
|
||||||
|
],
|
||||||
|
|
||||||
|
data: function () {
|
||||||
|
return {
|
||||||
|
'qtyText': this.__('checkout.qty'),
|
||||||
|
'isButtonEnable': this.isEnable,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
'addToCart': function () {
|
||||||
|
this.isButtonEnable = false;
|
||||||
|
let url = `${this.$root.baseUrl}/cart/add`;
|
||||||
|
|
||||||
|
this.$http.post(url, {
|
||||||
|
'quantity': 1,
|
||||||
|
'_token': this.csrfToken,
|
||||||
|
'product_id': this.productId,
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
this.isButtonEnable = true;
|
||||||
|
|
||||||
|
if (response.data.status) {
|
||||||
|
response.data.addedItems.forEach(item => {
|
||||||
|
let cartItemHTML = `<div class="row small-card-container">
|
||||||
|
<div class="col-3 product-image-container mr15">
|
||||||
|
<a href="${this.$root.baseUrl}/checkout/cart/remove/${item.itemId}">
|
||||||
|
<span class="rango-close"></span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a
|
||||||
|
href="${this.$root.baseUrl}/${item.url_key}"
|
||||||
|
class="unset">
|
||||||
|
|
||||||
|
<div class="product-image"
|
||||||
|
style="background-image: url('${item.images['small_image_url']}');">
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-9 no-padding card-body align-vertical-top">
|
||||||
|
<div class="no-padding">
|
||||||
|
<div class="fs16 text-nowrap fw6">${item.name}</div>
|
||||||
|
<div class="fs18 card-current-price fw6">
|
||||||
|
<div class="display-inbl">
|
||||||
|
<label class="fw5">${this.qtyText}</label>
|
||||||
|
|
||||||
|
<input type="text" disabled value="${item.quantity}" class="ml5" />
|
||||||
|
</div>
|
||||||
|
<span class="card-total-price fw6">${item.baseTotal}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
$('#cart-modal-content .mini-cart-container').append(cartItemHTML);
|
||||||
|
$('.mini-cart-container .badge').text(response.data.totalCartItems);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log("something went wrong");
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -32,6 +32,7 @@ window.Carousel = VueCarousel;
|
||||||
// UI components
|
// UI components
|
||||||
Vue.component("vue-slider", require("vue-slider-component"));
|
Vue.component("vue-slider", require("vue-slider-component"));
|
||||||
Vue.component('modal-component', require('./UI/components/modal'));
|
Vue.component('modal-component', require('./UI/components/modal'));
|
||||||
|
Vue.component("add-to-cart", require("./UI/components/add-to-cart"));
|
||||||
Vue.component('quantity-btn', require('./UI/components/quantity-btn'));
|
Vue.component('quantity-btn', require('./UI/components/quantity-btn'));
|
||||||
Vue.component('sidebar-component', require('./UI/components/sidebar'));
|
Vue.component('sidebar-component', require('./UI/components/sidebar'));
|
||||||
Vue.component("product-card", require("./UI/components/product-card"));
|
Vue.component("product-card", require("./UI/components/product-card"));
|
||||||
|
|
|
||||||
|
|
@ -1005,6 +1005,25 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.profile-page-content {
|
||||||
|
.table {
|
||||||
|
padding: 0;
|
||||||
|
width: 800px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table > table {
|
||||||
|
width:100%;
|
||||||
|
color: #5E5E5E;
|
||||||
|
border: 1px solid rgba(0,0,0,.125);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table td {
|
||||||
|
border: unset;
|
||||||
|
padding: 6px 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.account-items-list {
|
.account-items-list {
|
||||||
|
|
@ -1268,7 +1287,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
margin: 20px 0;
|
margin: 20px 0 30px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.applied-coupon-details {
|
.applied-coupon-details {
|
||||||
|
|
@ -1364,7 +1383,7 @@
|
||||||
.payment-form,
|
.payment-form,
|
||||||
.review-checkout-conainer {
|
.review-checkout-conainer {
|
||||||
h3 {
|
h3 {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shipping-methods,
|
.shipping-methods,
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ return [
|
||||||
'error' => [
|
'error' => [
|
||||||
'go-to-home' => 'الذهاب إلى المنزل',
|
'go-to-home' => 'الذهاب إلى المنزل',
|
||||||
'page-lost-short' => 'الصفحة فقدت المحتوى',
|
'page-lost-short' => 'الصفحة فقدت المحتوى',
|
||||||
|
'something-went-wrong' => 'هناك خطأ ما',
|
||||||
'page-lost-description' => "الصفحة التي تبحث عنها غير متوفرة. حاول البحث مرة أخرى أو استخدم زر العودة للخلف أدناه.",
|
'page-lost-description' => "الصفحة التي تبحث عنها غير متوفرة. حاول البحث مرة أخرى أو استخدم زر العودة للخلف أدناه.",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,7 @@ return [
|
||||||
'error' => [
|
'error' => [
|
||||||
'go-to-home' => 'Go to home',
|
'go-to-home' => 'Go to home',
|
||||||
'page-lost-short' => 'Page lost content',
|
'page-lost-short' => 'Page lost content',
|
||||||
|
'something-went-wrong' => 'something went wrong',
|
||||||
'page-lost-description' => "The page you're looking for isn't available. Try to search again or use the Go Back button below.",
|
'page-lost-description' => "The page you're looking for isn't available. Try to search again or use the Go Back button below.",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ return [
|
||||||
|
|
||||||
'error' => [
|
'error' => [
|
||||||
'go-to-home' => 'Vá para casa',
|
'go-to-home' => 'Vá para casa',
|
||||||
|
'something-went-wrong' => 'algo deu errado',
|
||||||
'page-lost-short' => 'Conteúdo perdido da página',
|
'page-lost-short' => 'Conteúdo perdido da página',
|
||||||
'page-lost-description' => "A página que você está procurando não está disponível. Tente pesquisar novamente ou use o botão Voltar atrás abaixo.",
|
'page-lost-description' => "A página que você está procurando não está disponível. Tente pesquisar novamente ou use o botão Voltar atrás abaixo.",
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@
|
||||||
:title="'{{ __('shop::app.checkout.onepage.shipping-address') }}'">
|
:title="'{{ __('shop::app.checkout.onepage.shipping-address') }}'">
|
||||||
|
|
||||||
<div class="form-header mb-30" slot="header">
|
<div class="form-header mb-30" slot="header">
|
||||||
<h3 class="fw6 display-inbl mb-0">
|
<h3 class="fw6 display-inbl">
|
||||||
{{ __('shop::app.checkout.onepage.shipping-address') }}
|
{{ __('shop::app.checkout.onepage.shipping-address') }}
|
||||||
</h3>
|
</h3>
|
||||||
<i class="rango-arrow"></i>
|
<i class="rango-arrow"></i>
|
||||||
|
|
@ -219,7 +219,7 @@
|
||||||
:title="'{{ __('shop::app.checkout.onepage.shipping-address') }}'">
|
:title="'{{ __('shop::app.checkout.onepage.shipping-address') }}'">
|
||||||
|
|
||||||
<div class="form-header" slot="header">
|
<div class="form-header" slot="header">
|
||||||
<h3 class="fw6 display-inbl mb-0">
|
<h3 class="fw6 display-inbl">
|
||||||
{{ __('shop::app.checkout.onepage.shipping-address') }}
|
{{ __('shop::app.checkout.onepage.shipping-address') }}
|
||||||
</h3>
|
</h3>
|
||||||
<i class="rango-arrow"></i>
|
<i class="rango-arrow"></i>
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
class="control"
|
class="control"
|
||||||
|
style="width: unset;"
|
||||||
v-validate="'required'"
|
v-validate="'required'"
|
||||||
id="shipping[first_name]"
|
id="shipping[first_name]"
|
||||||
name="shipping[first_name]"
|
name="shipping[first_name]"
|
||||||
|
|
|
||||||
|
|
@ -9,20 +9,6 @@
|
||||||
.account-head {
|
.account-head {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
}
|
}
|
||||||
.table {
|
|
||||||
width: 70%;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
.table > table {
|
|
||||||
color: #5E5E5E;
|
|
||||||
width:100%;
|
|
||||||
border: 1px solid rgba(0,0,0,.125);
|
|
||||||
}
|
|
||||||
.table td {
|
|
||||||
padding: 5px;
|
|
||||||
border: unset;
|
|
||||||
display: table-cell !important;
|
|
||||||
}
|
|
||||||
.remove-icon {
|
.remove-icon {
|
||||||
right: 15px;
|
right: 15px;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
|
|
@ -43,7 +29,7 @@
|
||||||
|
|
||||||
|
|
||||||
@section('page-detail-wrapper')
|
@section('page-detail-wrapper')
|
||||||
<div class="account-head">
|
<div class="account-head mb-0">
|
||||||
<span class="back-icon">
|
<span class="back-icon">
|
||||||
<a href="{{ route('customer.account.index') }}">
|
<a href="{{ route('customer.account.index') }}">
|
||||||
<i class="icon icon-menu-back"></i>
|
<i class="icon icon-menu-back"></i>
|
||||||
|
|
@ -64,7 +50,7 @@
|
||||||
|
|
||||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.before', ['customer' => $customer]) !!}
|
{!! view_render_event('bagisto.shop.customers.account.profile.view.before', ['customer' => $customer]) !!}
|
||||||
|
|
||||||
<div class="account-table-content">
|
<div class="account-table-content profile-page-content">
|
||||||
<div class="table">
|
<div class="table">
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,16 @@
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
{{-- <add-to-cart
|
||||||
|
form="true"
|
||||||
|
csrf-token='{{ csrf_token() }}'
|
||||||
|
product-id="{{ $product->product_id }}"
|
||||||
|
add-class-to-btn="{{ $addToCartBtnClass ?? '' }}"
|
||||||
|
is-enable={{ ! $product->isSaleable() ? 'false' : 'true' }}
|
||||||
|
show-cart-icon={{ !(isset($showCartIcon) && !$showCartIcon) }}
|
||||||
|
btn-text="{{ $btnText ?? __('shop::app.products.add-to-cart') }}">
|
||||||
|
</add-to-cart> --}}
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue