Merge pull request #3 from bagisto/master

update
This commit is contained in:
hexu 2020-04-08 20:43:49 +08:00 committed by GitHub
commit 81c6a1b538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 599 additions and 271 deletions

View File

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

56
composer.lock generated
View File

@ -3914,16 +3914,16 @@
},
{
"name": "symfony/http-foundation",
"version": "v4.4.5",
"version": "v4.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "7e41b4fcad4619535f45f8bfa7744c4f384e1648"
"reference": "62f92509c9abfd1f73e17b8cf1b72c0bdac6611b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/7e41b4fcad4619535f45f8bfa7744c4f384e1648",
"reference": "7e41b4fcad4619535f45f8bfa7744c4f384e1648",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/62f92509c9abfd1f73e17b8cf1b72c0bdac6611b",
"reference": "62f92509c9abfd1f73e17b8cf1b72c0bdac6611b",
"shasum": ""
},
"require": {
@ -3965,7 +3965,7 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2020-02-13T19:40:01+00:00"
"time": "2020-03-30T14:07:33+00:00"
},
{
"name": "symfony/http-kernel",
@ -4059,16 +4059,16 @@
},
{
"name": "symfony/mime",
"version": "v5.0.5",
"version": "v5.0.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "9b3e5b5e58c56bbd76628c952d2b78556d305f3c"
"reference": "481b7d6da88922fb1e0d86a943987722b08f3955"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/9b3e5b5e58c56bbd76628c952d2b78556d305f3c",
"reference": "9b3e5b5e58c56bbd76628c952d2b78556d305f3c",
"url": "https://api.github.com/repos/symfony/mime/zipball/481b7d6da88922fb1e0d86a943987722b08f3955",
"reference": "481b7d6da88922fb1e0d86a943987722b08f3955",
"shasum": ""
},
"require": {
@ -4117,7 +4117,7 @@
"mime",
"mime-type"
],
"time": "2020-02-04T09:41:09+00:00"
"time": "2020-03-27T16:56:45+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -4238,16 +4238,16 @@
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.14.0",
"version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "6842f1a39cf7d580655688069a03dd7cd83d244a"
"reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6842f1a39cf7d580655688069a03dd7cd83d244a",
"reference": "6842f1a39cf7d580655688069a03dd7cd83d244a",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
"reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
"shasum": ""
},
"require": {
@ -4261,7 +4261,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.14-dev"
"dev-master": "1.15-dev"
}
},
"autoload": {
@ -4296,20 +4296,20 @@
"portable",
"shim"
],
"time": "2020-01-17T12:01:36+00:00"
"time": "2020-03-09T19:04:49+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.14.0",
"version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2"
"reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2",
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
"reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
"shasum": ""
},
"require": {
@ -4321,7 +4321,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.14-dev"
"dev-master": "1.15-dev"
}
},
"autoload": {
@ -4355,7 +4355,7 @@
"portable",
"shim"
],
"time": "2020-01-13T11:15:53+00:00"
"time": "2020-03-09T19:04:49+00:00"
},
{
"name": "symfony/polyfill-php56",
@ -4415,16 +4415,16 @@
},
{
"name": "symfony/polyfill-php72",
"version": "v1.14.0",
"version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf"
"reference": "37b0976c78b94856543260ce09b460a7bc852747"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf",
"reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747",
"reference": "37b0976c78b94856543260ce09b460a7bc852747",
"shasum": ""
},
"require": {
@ -4433,7 +4433,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.14-dev"
"dev-master": "1.15-dev"
}
},
"autoload": {
@ -4466,7 +4466,7 @@
"portable",
"shim"
],
"time": "2020-01-13T11:15:53+00:00"
"time": "2020-02-27T09:26:54+00:00"
},
{
"name": "symfony/polyfill-php73",

View File

@ -45,9 +45,10 @@ class ProductController extends Controller
*/
public function get($id)
{
return new ProductResource(
$this->productRepository->findOrFail($id)
);
$product = $this->productRepository->findOrFail($id);
$options = $this->productRepository->findOrFail($id)->getTypeInstance()->getProductOptions($product);
return $options;
}
/**

View File

@ -148,14 +148,14 @@
<td>
<div class="control-group" :class="[errors.has(variantInputName + '[price]') ? 'has-error' : '']">
<input type="number" v-validate="'required|min_value:0.0001'" v-model="variant.price" :name="[variantInputName + '[price]']" class="control" data-vv-as="&quot;{{ __('admin::app.catalog.products.price') }}&quot;" step="any"/>
<input type="number" v-validate="'required'" v-model="variant.price" :name="[variantInputName + '[price]']" class="control" data-vv-as="&quot;{{ __('admin::app.catalog.products.price') }}&quot;" step="any"/>
<span class="control-error" v-if="errors.has(variantInputName + '[price]')">@{{ errors.first(variantInputName + '[price]') }}</span>
</div>
</td>
<td>
<div class="control-group" :class="[errors.has(variantInputName + '[weight]') ? 'has-error' : '']">
<input type="number" v-validate="'required|min_value:0.0001'" v-model="variant.weight" :name="[variantInputName + '[weight]']" class="control" data-vv-as="&quot;{{ __('admin::app.catalog.products.weight') }}&quot;" step="any"/>
<input type="number" v-validate="'required'" v-model="variant.weight" :name="[variantInputName + '[weight]']" class="control" data-vv-as="&quot;{{ __('admin::app.catalog.products.weight') }}&quot;" step="any"/>
<span class="control-error" v-if="errors.has(variantInputName + '[weight]')">@{{ errors.first(variantInputName + '[weight]') }}</span>
</div>
</td>

View File

@ -6,7 +6,12 @@
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.sliders.create') }}" @submit.prevent="onSubmit" enctype="multipart/form-data">
<form
method="POST"
@submit.prevent="onSubmit"
enctype="multipart/form-data"
action="{{ route('admin.sliders.create') }}">
<div class="page-header">
<div class="page-title">
<h1>

View File

@ -165,11 +165,11 @@ class RentalSlot extends Booking
$requestedToDate = Carbon::createFromTimeString($cartItem['additional']['booking']['date_to'] . " 23:59:59");
$availableFrom = ! $bookingProduct->available_every_week && $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_from)
? Carbon::createFromTimeString($bookingProduct->available_from->format('Y-m-d') . ' 00:00:00')
: Carbon::createFromTimeString($currentTime->format('Y-m-d 00:00:00'));
$availableTo = ! $bookingProduct->available_every_week && $bookingProduct->available_from
? Carbon::createFromTimeString($bookingProduct->available_to)
? Carbon::createFromTimeString($bookingProduct->available_to->format('Y-m-d') . ' 23:59:59')
: Carbon::createFromTimeString('2080-01-01 00:00:00');
if ($requestedFromDate < $availableFrom

View File

@ -471,40 +471,20 @@ class Core
return $formatter->getSymbol(\NumberFormatter::CURRENCY_SYMBOL);
}
/**
* Format and convert price with currency symbol
*
* @param float $price
* @param string $currencyCode
* @return string
*/
/**
* Format and convert price with currency symbol
*
* @param float $price
* @return string
*/
public function formatPrice($price, $currencyCode)
{
$code = $this->getCurrentCurrency()->code;
if (is_null($price)) {
if (is_null($price))
$price = 0;
} else {
if ($code != $currencyCode) {
$price = $this->convertPrice($price, $code, $currencyCode);
}
}
$formater = new \NumberFormatter(app()->getLocale(), \NumberFormatter::CURRENCY);
$formatter = new \NumberFormatter( app()->getLocale(), \NumberFormatter::CURRENCY );
$symbol = $this->getCurrentCurrency()->symbol;
if ($symbol) {
if ($this->currencySymbol($currencyCode) == $symbol) {
return $formater->formatCurrency($price, $currencyCode);
} else {
$formater->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $symbol);
return $formater->format($price); // $this->convertPrice($price, $code)
}
} else {
return $formater->formatCurrency($price, $currencyCode);
}
return $formatter->formatCurrency($price, $currencyCode);
}
/**

View File

@ -6,12 +6,9 @@ use Webkul\Core\Models\Locale;
/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(Locale::class, function (Faker $faker, array $attributes) {
$languageCode = $faker->languageCode;
$locale = Locale::query()->firstWhere('code', $languageCode);
if ($locale !== null) {
return $locale->id;
}
do {
$languageCode = $faker->languageCode;
} while (Locale::query()->where('code', $languageCode)->exists());
return [
'code' => $languageCode,
@ -22,4 +19,4 @@ $factory->define(Locale::class, function (Faker $faker, array $attributes) {
$factory->state(Category::class, 'rtl', [
'direction' => 'rtl',
]);
]);

View File

@ -100,4 +100,34 @@ class BundleOption extends AbstractProduct
return $products;
}
/**
* Get formed data from bundle option product
*
* @return array
*/
public function getProductOptions($product)
{
$products = [];
$products[$product->id] = [
'id' => $product->id,
'qty' => $product->qty,
'price' => $product->product->getTypeInstance()->getProductPrices(),
'name' => $product->product->name,
'product_id' => $product->product_id,
'is_default' => $product->is_default,
'sort_order' => $product->sort_order,
];
usort ($products, function($a, $b) {
if ($a['sort_order'] == $b['sort_order']) {
return 0;
}
return ($a['sort_order'] < $b['sort_order']) ? -1 : 1;
});
return $products;
}
}

View File

@ -113,6 +113,11 @@ abstract class AbstractType
*/
protected $isChildrenCalculated = false;
/**
* product options
*/
protected $productOptions = [];
/**
* Create a new product type instance.
*
@ -694,4 +699,10 @@ abstract class AbstractType
$item->save();
}
//get product options
public function getProductOptions()
{
return $this->productOptions;
}
}

View File

@ -69,6 +69,11 @@ class Bundle extends AbstractType
*/
protected $isChildrenCalculated = true;
/**
* Product Options
*/
protected $productOptions = [];
/**
* Create a new product type instance.
*
@ -633,4 +638,15 @@ class Bundle extends AbstractType
$item->save();
}
/**
* get product options
*/
public function getProductOptions($product = "")
{
$bundleOption = app('Webkul\Product\Helpers\BundleOption');
$options = $bundleOption->getProductOptions($product);
return $options;
}
}

View File

@ -49,6 +49,11 @@ class Configurable extends AbstractType
*/
protected $hasVariants = true;
/**
* product options
*/
protected $productOptions = [];
/**
* @param array $data
* @return \Webkul\Product\Contracts\Product
@ -546,4 +551,13 @@ class Configurable extends AbstractType
$item->save();
}
//product options
public function getProductOptions($product = "")
{
$configurableOption = app('Webkul\Product\Helpers\ConfigurableOption');
$options = $configurableOption->getConfigurationConfig($product);
return $options;
}
}

View File

@ -55,6 +55,11 @@ class Downloadable extends AbstractType
*/
protected $isStockable = false;
/**
* getProductOptions
*/
protected $getProductOptions = [];
/**
* Create a new product type instance.
*

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

View File

@ -26,16 +26,21 @@ return [
'name' => 'shop::app.layouts.wishlist',
'route' =>'customer.wishlist.index',
'sort' => 4,
], [
'key' => 'account.compare',
'name' => 'velocity::app.customer.compare.text',
'route' =>'velocity.customer.product.compare',
'sort' => 5,
], [
'key' => 'account.orders',
'name' => 'shop::app.layouts.orders',
'route' =>'customer.orders.index',
'sort' => 5,
'sort' => 6,
], [
'key' => 'account.downloadables',
'name' => 'shop::app.layouts.downloadable-products',
'route' =>'customer.downloadable_products.index',
'sort' => 6,
'sort' => 7,
]
];

View File

@ -289,6 +289,18 @@
this.disable_button = true;
if (this.allAddress.length > 0) {
let address = this.allAddress.forEach(address => {
if (address.id == this.address.billing.address_id) {
this.address.billing.address1 = [address.address1];
}
if (address.id == this.address.shipping.address_id) {
this.address.shipping.address1 = [address.address1];
}
});
}
this.$http.post("{{ route('shop.checkout.save-address') }}", this.address)
.then(function(response) {
this_this.disable_button = false;

View File

@ -8,5 +8,7 @@
@include('shop::products.wishlist')
@include('shop::products.compare')
@include('shop::products.compare', [
'productId' => $product->id
])
</div>

View File

@ -1,11 +1,101 @@
{{-- @inject ('wishListHelper', 'Webkul\Customer\Helpers\Wishlist')
<compare-component product-id="{{ $productId }}"></compare-component>
@auth('customer')
{!! view_render_event('bagisto.shop.products.wishlist.before') !!}
@push('scripts')
<a @if ($wishListHelper->getWishlistProduct($product)) class="add-to-wishlist already" @else class="add-to-wishlist" @endif href="{{ route('customer.wishlist.add', $product->product_id) }}" id="wishlist-changer">
<span class="icon wishlist-icon"></span>
</a>
<script type="text/x-template" id="compare-component-template">
<a class="unset compare-icon text-right" @click="addProductToCompare" style="cursor: pointer">
<img src="{{ asset('themes/default/assets/images/compare_arrows.png') }}" />
</a>
</script>
{!! view_render_event('bagisto.shop.products.wishlist.after') !!}
@endauth --}}
<script>
Vue.component('compare-component', {
props: ['productId'],
template: '#compare-component-template',
data: function () {
return {
'baseUrl': "{{ url()->to('/') }}",
'customer': '{{ auth()->guard('customer')->user() ? "true" : "false" }}' == "true",
}
},
methods: {
'addProductToCompare': function () {
if (this.customer == "true" || this.customer == true) {
this.$http.put(
`${this.baseUrl}/comparison`, {
productId: this.productId,
}
).then(response => {
window.flashMessages = [{
'type': `alert-${response.data.status}`,
'message': response.data.message
}];
this.$root.addFlashMessages()
}).catch(error => {
window.flashMessages = [{
'type': `alert-danger`,
'message': "{{ __('velocity::app.error.something_went_wrong') }}"
}];
this.$root.addFlashMessages()
});
} else {
let updatedItems = [this.productId];
let existingItems = this.getStorageValue('compared_product');
if (existingItems) {
if (existingItems.indexOf(this.productId) == -1) {
updatedItems = existingItems.concat(updatedItems);
this.setStorageValue('compared_product', updatedItems);
window.flashMessages = [{
'type': `alert-success`,
'message': "{{ __('velocity::app.customer.compare.added') }}"
}];
this.$root.addFlashMessages()
} else {
window.flashMessages = [{
'type': `alert-success`,
'message': "{{ __('velocity::app.customer.compare.already_added') }}"
}];
this.$root.addFlashMessages()
}
} else {
this.setStorageValue('compared_product', updatedItems);
window.flashMessages = [{
'type': `alert-success`,
'message': "{{ __('velocity::app.customer.compare.added') }}"
}];
this.$root.addFlashMessages()
}
}
},
'getStorageValue': function (key) {
let value = window.localStorage.getItem(key);
if (value) {
value = JSON.parse(value);
}
return value;
},
'setStorageValue': function (key, value) {
window.localStorage.setItem(key, JSON.stringify(value));
return true;
},
}
});
</script>
@endpush

View File

@ -7,7 +7,8 @@ class Tax
/**
* @var int
*/
public const TAX_PRECISION = 4;
private const TAX_RATE_PRECISION = 4;
private const TAX_AMOUNT_PRECISION = 2;
/**
* Returns an array with tax rates and tax amount
@ -20,7 +21,7 @@ class Tax
$taxes = [];
foreach ($that->items as $item) {
$taxRate = (string) round((float) $item->tax_percent, self::TAX_PRECISION);
$taxRate = (string) round((float) $item->tax_percent, self::TAX_RATE_PRECISION);
if (! array_key_exists($taxRate, $taxes)) {
$taxes[$taxRate] = 0;
@ -29,6 +30,11 @@ class Tax
$taxes[$taxRate] += $asBase ? $item->base_tax_amount : $item->tax_amount;
}
// finally round tax amounts now (to reduce rounding differences)
foreach ($taxes as $taxRate => $taxAmount) {
$taxes[$taxRate] = round($taxAmount, self::TAX_AMOUNT_PRECISION);
}
return $taxes;
}
@ -45,7 +51,7 @@ class Tax
$result = 0;
foreach ($taxes as $taxRate => $taxAmount) {
$result += round($taxAmount, 2);
$result += $taxAmount;
}
return $result;

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,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=8238d4a34ce254a81437",
"/css/ui.css": "/css/ui.css?id=78f86756674b5f637c8b"
"/js/ui.js": "/js/ui.js?id=5c5ae91d95c2c0668124",
"/css/ui.css": "/css/ui.css?id=8c35163268c09336c2bc"
}

View File

@ -67,10 +67,20 @@
var this_this = this;
if(this.multiple) {
if(this.images.length) {
if (this.images.length) {
this.images.forEach(function(image) {
this_this.items.push(image)
this_this.imageCount++;
});
} else if (this.images.length == undefined && typeof this.images == 'object') {
var images = Object.keys(this.images).map(key => {
return this.images[key];
});
images.forEach(function(image) {
this_this.items.push(image)
this_this.imageCount++;
});
} else {

View File

@ -645,8 +645,10 @@ h5 {
display: inline-block;
vertical-align: middle;
margin-left: -34px;
margin-top: 2px;
pointer-events: none;
left: 70%;
position: absolute;
top: 35px;
}
}

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=b795a54f5795ed77fa28",
"/js/velocity.js": "/js/velocity.js?id=08fbd43328947b542230",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=612d35e452446366eef7",
"/css/velocity.css": "/css/velocity.css?id=a68c6d04ce36e1455e1e"
"/css/velocity.css": "/css/velocity.css?id=5d5625586d1faefa5201"
}

View File

@ -120,33 +120,49 @@ class ConfigurationController extends Controller
$saveImage = [];
$saveData = $advertisement;
foreach ($data as $imageId => $image) {
$file = 'images.' . $index . '.' . $imageId;
$dir = 'velocity/images';
if (Str::contains($imageId, 'image_')) {
if (request()->hasFile($file) && $image) {
$filter_index = substr($imageId, 6, 1);
if ( isset($data[$filter_index]) ) {
$size = array_key_last($saveData[$index]);
$saveImage[$size + 1] = request()->file($file)->store($dir);
} else {
$saveImage[substr($imageId, 6, 1)] = request()->file($file)->store($dir);
foreach ($data as $imageId => $image) {
if ($image != "") {
$file = 'images.' . $index . '.' . $imageId;
$dir = 'velocity/images';
if (Str::contains($imageId, 'image_')) {
if (request()->hasFile($file) && $image) {
$filter_index = substr($imageId, 6, 1);
if ( isset($data[$filter_index]) ) {
$size = array_key_last($saveData[$index]);
$saveImage[$size + 1] = request()->file($file)->store($dir);
} else {
$saveImage[substr($imageId, 6, 1)] = request()->file($file)->store($dir);
}
}
} else {
if ( isset($advertisement[$index][$imageId]) && $advertisement[$index][$imageId] && !request()->hasFile($file)) {
$saveImage[$imageId] = $advertisement[$index][$imageId];
unset($advertisement[$index][$imageId]);
}
if (request()->hasFile($file) && isset($advertisement[$index][$imageId])) {
Storage::delete($advertisement[$index][$imageId]);
$saveImage[$imageId] = request()->file($file)->store($dir);
}
}
} else {
if ( isset($advertisement[$index][$imageId]) && $advertisement[$index][$imageId] && !request()->hasFile($file)) {
$saveImage[$imageId] = $advertisement[$index][$imageId];
if ($saveData) {
$subIndex = substr($imageId, -1);
unset($advertisement[$index][$imageId]);
}
if (isset($advertisement[$index][$subIndex])) {
$saveImage[$subIndex] = $advertisement[$index][$subIndex];
if (request()->hasFile($file) && isset($advertisement[$index][$imageId])) {
Storage::delete($advertisement[$index][$imageId]);
$saveImage[$imageId] = request()->file($file)->store($dir);
if (sizeof($advertisement[$index]) == 1) {
unset($advertisement[$index]);
} else {
unset($advertisement[$index][$subIndex]);
}
}
}
}
}

View File

@ -34,11 +34,13 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
'view' => 'shop::guest.compare.index'
]);
Route::get('/customer/account/comparison', 'ComparisonController@getComparisonList')
->name('velocity.customer.product.compare')
->defaults('_config', [
'view' => 'shop::customers.account.compare.index'
]);
Route::group(['middleware' => ['customer']], function () {
Route::get('/customer/account/comparison', 'ComparisonController@getComparisonList')
->name('velocity.customer.product.compare')
->defaults('_config', [
'view' => 'shop::customers.account.compare.index'
]);
});
Route::put('/comparison', 'ComparisonController@addCompareProduct')
->name('customer.product.add.compare');

View File

@ -1,16 +1,18 @@
<template>
<div class="modal-container" v-if="isModalOpen">
<div class="modal-header">
<slot name="header">
Default header
</slot>
<i class="icon remove-icon" @click="closeModal"></i>
</div>
<div class="modal-parent scrollable" v-if="isModalOpen">
<div class="modal-container">
<div class="modal-header">
<slot name="header">
Default header
</slot>
<i class="icon remove-icon" @click="closeModal"></i>
</div>
<div class="modal-body">
<slot name="body">
Default body
</slot>
<div class="modal-body">
<slot name="body">
Default body
</slot>
</div>
</div>
</div>
</template>
@ -23,12 +25,8 @@
return {}
},
created () {
this.closeModal();
},
computed: {
isModalOpen () {
isModalOpen: function () {
this.addClassToBody();
return this.isOpen;
@ -36,12 +34,13 @@
},
methods: {
closeModal () {
this.$root.$set(this.$root.modalIds, this.id, true);
closeModal: function () {
this.$root.$set(this.$root.modalIds, this.id, false);
},
addClassToBody () {
addClassToBody: function () {
var body = document.querySelector("body");
if(this.isOpen) {
body.classList.add("modal-open");
} else {

View File

@ -10,7 +10,7 @@
methods: {
addProductToCompare: function () {
if (this.customer == "true") {
if (this.customer == "true" || this.customer == true) {
this.$http.put(
`${this.$root.baseUrl}/comparison`, {
productId: this.productId,

View File

@ -249,9 +249,12 @@ body {
> div:last-child {
height: 32px;
}
* {
// height: 100%;
> div {
.default {
padding: 5px;
font-size: 14px;
}
}
@ -281,7 +284,6 @@ body {
}
}
.dropdown-menu {
border-top: 3px solid $border-primary;
border-radius: 0px;

View File

@ -174,23 +174,25 @@
}
.modal-container {
background: #ffffff;
left: 50%;
top: 100px;
z-index: 11;
width: 600px;
max-width: 80%;
left: 50%;
margin-left: -300px;
max-height: 80%;
position: fixed;
z-index: 11;
font-size: 14px;
overflow-y: auto;
margin-left: -300px;
background: #ffffff;
animation: jelly 0.5s ease-in-out;
animation: fade-in-white 0.3s ease-in-out;
@include border-radius(5px);
@include box-shadow(
0px 15px 25px 0px rgba(0, 0, 0, 0.03),
0px 20px 45px 5px rgba(0, 0, 0, 0.2)
);
animation: fade-in-white 0.3s ease-in-out;
animation: jelly 0.5s ease-in-out;
@include border-radius(5px);
overflow-y: auto;
max-height: 80%;
.modal-header {
padding: 20px;
@ -205,6 +207,15 @@
.icon {
float: right;
cursor: pointer;
&.remove-icon {
width: 24px;
right: 20px;
height: 24px;
margin-right: 0;
position: absolute;
background-image: url(/themes/velocity/assets/images/Icon-remove.svg);
}
}
}
@ -491,9 +502,8 @@
.customer-options{
top: 40px;
float: right;
height: 100%;
padding: 20px;
height: 150px;
overflow-y: scroll;
width: 200px !important;
@ -510,6 +520,11 @@
li {
padding: 3px 0;
height: unset !important;
a {
display: block;
padding: 0 20px !important;
}
}
a {
@ -861,7 +876,8 @@
}
input,
select {
select,
textarea {
width: 100%;
resize: none;
font-size: 16px;
@ -873,6 +889,8 @@
input:active,
input:focus,
textarea:active,
textarea:focus,
select:focus,
select:active {
border-color: $theme-color;
@ -1066,6 +1084,57 @@
padding: 6px 12px;
}
}
.accordian .accordian-header {
padding: 10px 0;
font-weight: 600;
}
.image-wrapper {
width: 100%;
margin-top: 10px;
margin-bottom: 20px;
display: inline-block;
.image-item {
width: 200px;
height: 200px;
position: relative;
border-radius: 3px;
margin-right: 20px;
background: #f8f9fa;
margin-bottom: 20px;
display: inline-block;
background-position: 50%;
background-repeat: no-repeat;
background-image: url(/vendor/webkul/ui/assets/images/placeholder-icon.svg);
.remove-image {
left: 0;
bottom: 0;
width: 100%;
color: #fff;
padding: 10px;
cursor: pointer;
margin-bottom: 0;
text-align: center;
position: absolute;
margin-right: 20px;
border-radius: 0 0 4px 4px;
text-shadow: 0 1px 2px rgba(0,0,0,.24);
background-image: linear-gradient(-180deg,rgba(0,0,0,.08),rgba(0,0,0,.24));
}
input {
display: none;
}
img.preview {
width: 100%;
height: 100%;
}
}
}
}
.account-items-list {
@ -1272,18 +1341,15 @@
i {
color: $black-color;
}
i:hover::before {
// content: "\E93D";
}
}
.checkout-process {
padding: 40px 20px;
.col-7 {
> div {
width: 100%;
.col-lg-7 {
.coupon-container,
> div:not(:first-child) {
margin-top: 20px;
}
}
@ -2311,6 +2377,10 @@
margin-left: 0 !important;
margin-right: 10px !important;
tr {
width: 100%;
}
td {
padding: 15px;
min-width: 250px;

View File

@ -211,7 +211,7 @@ return [
'login' => 'Login',
'become-user' => 'Become User',
'user-registration' => 'User Registration',
'form-sginup-text' => 'If you are new to our store, we glab to have you as member.',
'form-sginup-text' => 'If you are new to our store, we glad to have you as member.',
],
'forget-password' => [
'login' => 'Login',

View File

@ -37,13 +37,13 @@
<label class="switch">
<input
type="checkbox"
class="control"
id="slides"
name="slides"
type="checkbox"
class="control"
data-vv-as="&quot;slides&quot;"
{{ $metaData && $metaData->slider ? 'checked' : ''}} />
<span class="slider round"></span>
</label>
</div>
@ -111,30 +111,60 @@
<div class="control-group">
<label>{{ __('velocity::app.admin.meta-data.advertisement-four') }}</label>
@if(! isset($metaData->advertisement[4]))
@php
$images = [
4 => [],
3 => [],
2 => [],
];
$advertisement = json_decode($metaData->get('advertisement')->all()[0]->advertisement, true);
@endphp
@if(! isset($advertisement[4]))
<image-wrapper
:button-label="'{{ __('velocity::app.admin.meta-data.add-image-btn-title') }}'"
input-name="images[4]">
input-name="images[4]"
:button-label="'{{ __('velocity::app.admin.meta-data.add-image-btn-title') }}'">
</image-wrapper>
@else
@foreach ($advertisement[4] as $index => $image)
@php
$images[4][] = [
'id' => 'image_' . $index,
'url' => asset('/storage/' . $image),
];
@endphp
@endforeach
<image-wrapper
:button-label="'{{ __('velocity::app.admin.meta-data.add-image-btn-title') }}'"
input-name="images[4]" :images='@json($metaData->advertisement[4])'>
:multiple="true"
input-name="images[4]"
:images='@json($images[4])'
:button-label="'{{ __('velocity::app.admin.meta-data.add-image-btn-title') }}'">
</image-wrapper>
@endif
</div>
<div class="control-group">
<label>{{ __('velocity::app.admin.meta-data.advertisement-three') }}</label>
@if(! isset($metaData->advertisement[3]))
@if(! isset($advertisement[3]))
<image-wrapper
:button-label="'{{ __('velocity::app.admin.meta-data.add-image-btn-title') }}'"
input-name="images[3]">
</image-wrapper>
@else
@foreach ($advertisement[3] as $index => $image)
@php
$images[3][] = [
'id' => 'image_' . $index,
'url' => asset('/storage/' . $image),
];
@endphp
@endforeach
<image-wrapper
:button-label="'{{ __('velocity::app.admin.meta-data.add-image-btn-title') }}'"
input-name="images[3]" :images='@json($metaData->advertisement[3])'>
input-name="images[3]"
:images='@json($images[3])'
:button-label="'{{ __('velocity::app.admin.meta-data.add-image-btn-title') }}'">
</image-wrapper>
@endif
</div>
@ -142,15 +172,25 @@
<div class="control-group">
<label>{{ __('velocity::app.admin.meta-data.advertisement-two') }}</label>
@if(! isset($metaData->advertisement[2]))
@if(! isset($advertisement[2]))
<image-wrapper
:button-label="'{{ __('velocity::app.admin.meta-data.add-image-btn-title') }}'"
input-name="images[2]">
</image-wrapper>
@else
@foreach ($advertisement[2] as $index => $image)
@php
$images[2][] = [
'id' => 'image_' . $index,
'url' => asset('/storage/' . $image),
];
@endphp
@endforeach
<image-wrapper
:button-label="'{{ __('velocity::app.admin.meta-data.add-image-btn-title') }}'"
input-name="images[2]" :images='@json($metaData->advertisement[2])'>
input-name="images[2]"
:images='@json($images[2])'
:button-label="'{{ __('velocity::app.admin.meta-data.add-image-btn-title') }}'">
</image-wrapper>
@endif
</div>

View File

@ -93,10 +93,10 @@
var customerAddress = '';
var shippingMethods = '';
var shippingTemplateRenderFns = [];
var paymentTemplateRenderFns = [];
var reviewTemplateRenderFns = [];
var paymentTemplateRenderFns = [];
var summaryTemplateRenderFns = [];
var shippingTemplateRenderFns = [];
@auth('customer')
@if(auth('customer')->user()->addresses)
@ -111,7 +111,7 @@
template: '#checkout-template',
inject: ['$validator'],
data: function() {
data: function () {
return {
allAddress: {},
current_step: 1,
@ -153,10 +153,10 @@
}
},
created: function() {
created: function () {
this.getOrderSummary();
if(! customerAddress) {
if (! customerAddress) {
this.new_shipping_address = true;
this.new_billing_address = true;
} else {
@ -184,21 +184,21 @@
},
methods: {
navigateToStep: function(step) {
navigateToStep: function (step) {
if (step <= this.completed_step) {
this.current_step = step
this.completed_step = step - 1;
}
},
haveStates: function(addressType) {
haveStates: function (addressType) {
if (this.countryStates[this.address[addressType].country] && this.countryStates[this.address[addressType].country].length)
return true;
return false;
},
validateForm: function(scope) {
validateForm: function (scope) {
var isManualValidationFail = false;
if (scope == 'address-form') {
@ -286,7 +286,7 @@
return isManualValidationFail;
},
isCustomerExist: function() {
isCustomerExist: function () {
this.$validator.attach('email', 'required|email');
var this_this = this;
@ -308,26 +308,22 @@
})
},
loginCustomer: function() {
var this_this = this;
this_this.$http.post("{{ route('customer.checkout.login') }}", {
email: this_this.address.billing.email,
password: this_this.address.billing.password
loginCustomer: function () {
this.$http.post("{{ route('customer.checkout.login') }}", {
email: this.address.billing.email,
password: this.address.billing.password
})
.then(function(response) {
.then(response => {
if (response.data.success) {
window.location.href = "{{ route('shop.checkout.onepage.index') }}";
} else {
window.flashMessages = [{'type': 'alert-error', 'message': response.data.error }];
this_this.$root.addFlashMessages()
window.showAlert(`alert-danger`, this.__('shop.general.alert.danger'), response.data.error);
}
})
.catch(function (error) {})
},
getOrderSummary () {
getOrderSummary: function () {
this.$http.get("{{ route('shop.checkout.summary') }}")
.then(response => {
summaryHtml = Vue.compile(response.data.html)
@ -338,9 +334,21 @@
.catch(function (error) {})
},
saveAddress: function() {
saveAddress: function () {
this.disable_button = true;
if (this.allAddress.length > 0) {
let address = this.allAddress.forEach(address => {
if (address.id == this.address.billing.address_id) {
this.address.billing.address1 = [address.address1];
}
if (address.id == this.address.shipping.address_id) {
this.address.shipping.address1 = [address.address1];
}
});
}
this.$http.post("{{ route('shop.checkout.save-address') }}", this.address)
.then(response => {
this.disable_button = false;
@ -372,7 +380,7 @@
})
},
saveShipping: function() {
saveShipping: function () {
this.disable_button = true;
this.$http.post("{{ route('shop.checkout.save-shipping') }}", {'shipping_method': this.selected_shipping_method})
@ -403,7 +411,7 @@
})
},
savePayment: function() {
savePayment: function () {
this.disable_button = true;
if (this.isCheckPayment) {
@ -431,7 +439,7 @@
}
},
placeOrder: function() {
placeOrder: function () {
if (this.isPlaceOrderEnabled) {
this.disable_button = false;
this.isPlaceOrderEnabled = false;
@ -449,16 +457,14 @@
.catch(error => {
this.disable_button = true;
window.flashMessages = [{'type': 'alert-error', 'message': "{{ __('shop::app.common.error') }}" }];
this.$root.addFlashMessages();
window.showAlert(`alert-danger`, this.__('shop.general.alert.danger'), "{{ __('shop::app.common.error') }}");
})
} else {
this.disable_button = true;
}
},
handleErrorResponse: function(response, scope) {
handleErrorResponse: function (response, scope) {
if (response.status == 422) {
serverErrors = response.data.errors;
this.$root.addServerErrors(scope)
@ -469,34 +475,34 @@
}
},
shippingMethodSelected: function(shippingMethod) {
shippingMethodSelected: function (shippingMethod) {
this.selected_shipping_method = shippingMethod;
},
paymentMethodSelected: function(paymentMethod) {
paymentMethodSelected: function (paymentMethod) {
this.selected_payment_method = paymentMethod;
},
newBillingAddress: function() {
newBillingAddress: function () {
this.new_billing_address = true;
this.isPlaceOrderEnabled = false;
this.address.billing.address_id = null;
},
newShippingAddress: function() {
newShippingAddress: function () {
this.new_shipping_address = true;
this.isPlaceOrderEnabled = false;
this.address.shipping.address_id = null;
},
backToSavedBillingAddress: function() {
backToSavedBillingAddress: function () {
this.new_billing_address = false;
setTimeout(() => {
this.validateForm('address-form');
}, 0);
},
backToSavedShippingAddress: function() {
backToSavedShippingAddress: function () {
this.new_shipping_address = false;
setTimeout(() => {
this.validateForm('address-form');
@ -508,7 +514,7 @@
Vue.component('shipping-section', {
inject: ['$validator'],
data: function() {
data: function () {
return {
templateRender: null,
@ -520,7 +526,7 @@
staticRenderFns: shippingTemplateRenderFns,
mounted: function() {
mounted: function () {
for (method in shippingMethods) {
if (this.first_iteration) {
@ -542,7 +548,7 @@
eventBus.$emit('after-checkout-shipping-section-added');
},
render: function(h) {
render: function (h) {
return h('div', [
(this.templateRender ?
this.templateRender() :
@ -551,7 +557,7 @@
},
methods: {
methodSelected: function() {
methodSelected: function () {
this.$parent.validateForm('shipping-form');
this.$emit('onShippingMethodSelected', this.selected_shipping_method)
@ -564,7 +570,7 @@
Vue.component('payment-section', {
inject: ['$validator'],
data: function() {
data: function () {
return {
templateRender: null,
@ -578,7 +584,7 @@
staticRenderFns: paymentTemplateRenderFns,
mounted: function() {
mounted: function () {
for (method in paymentMethods) {
if (this.first_iteration) {
this.payment.method = paymentMethods[method]['method'];
@ -595,7 +601,7 @@
eventBus.$emit('after-checkout-payment-section-added');
},
render: function(h) {
render: function (h) {
return h('div', [
(this.templateRender ?
this.templateRender() :
@ -604,7 +610,7 @@
},
methods: {
methodSelected: function() {
methodSelected: function () {
this.$parent.validateForm('payment-form');
this.$emit('onPaymentMethodSelected', this.payment)
@ -632,7 +638,7 @@
);
},
mounted: function() {
mounted: function () {
this.templateRender = reviewHtml.render;
for (var i in reviewHtml.staticRenderFns) {
@ -655,7 +661,7 @@
}
},
data: function() {
data: function () {
return {
changeCount: 0,
coupon_code: null,
@ -665,7 +671,7 @@
}
},
mounted: function() {
mounted: function () {
this.templateRender = summaryHtml.render;
for (var i in summaryHtml.staticRenderFns) {
@ -675,7 +681,7 @@
this.$forceUpdate();
},
render: function(h) {
render: function (h) {
return h('div', [
(this.templateRender ?
this.templateRender() :
@ -684,12 +690,12 @@
},
methods: {
onSubmit: function() {
onSubmit: function () {
var this_this = this;
const emptyCouponErrorText = "Please enter a coupon code";
},
changeCoupon: function() {
changeCoupon: function () {
if (this.couponChanged == true && this.changeCount == 0) {
this.changeCount++;
@ -700,10 +706,6 @@
this.changeCount = 0;
}
},
removeCoupon: function () {
var this_this = this;
}
}
});
})()

View File

@ -272,11 +272,6 @@
</span>
</div>
{{-- for customer login checkout --}}
@if (! $isCustomer)
@include('shop::checkout.onepage.customer-checkout')
@endif
<div :class="`col-12 form-field ${errors.has('address-form.billing[first_name]') ? 'has-error' : ''}`">
<label for="billing[first_name]" class="mandatory">
{{ __('shop::app.checkout.onepage.first-name') }}
@ -338,6 +333,11 @@
</span>
</div>
{{-- for customer login checkout --}}
@if (! $isCustomer)
@include('shop::checkout.onepage.customer-checkout')
@endif
<div :class="`col-12 form-field ${errors.has('address-form.billing[address1][]') ? 'has-error' : ''}`" style="margin-bottom: 0;">
<label for="billing_address_0" class="mandatory">
{{ __('shop::app.checkout.onepage.address1') }}

View File

@ -2,9 +2,11 @@
<div class="form-container">
<accordian :title="'{{ __('shop::app.checkout.payment-methods') }}'" :active="true">
<div class="form-header mb-30" slot="header">
<h3 class="fw6 display-inbl">
{{ __('shop::app.checkout.onepage.payment-methods') }}
</h3>
<i class="rango-arrow"></i>
</div>
@ -17,13 +19,13 @@
<div>
<label class="radio-container">
<input
v-validate="'required'"
type="radio"
id="{{ $payment['method'] }}"
name="payment[method]"
value="{{ $payment['method'] }}"
v-validate="'required'"
v-model="payment.method"
@change="methodSelected()"
id="{{ $payment['method'] }}"
value="{{ $payment['method'] }}"
data-vv-as="&quot;{{ __('shop::app.checkout.onepage.payment-method') }}&quot;" />
<span class="checkmark"></span>

View File

@ -10,4 +10,27 @@
@yield('page-detail-wrapper')
</div>
</div>
@endsection
@endsection
@push('scripts')
<script>
$(document).ready(function() {
window.updateHeight = () => {
let sidebarHeight = $('.customer-sidebar').css('height');
let contentHeight = $('.account-layout').css('height');
sidebarHeight = parseInt(sidebarHeight.substring(0, sidebarHeight.length - 2));
contentHeight = parseInt(contentHeight.substring(0, contentHeight.length - 2));
let height = sidebarHeight > contentHeight ? sidebarHeight + 30 : contentHeight;
height = height + "px";
$('.account-content').css('height', height);
}
window.updateHeight();
$('.accordian-header').click(window.updateHeight);
});
</script>
@endpush

View File

@ -18,11 +18,7 @@
$subMenuCollection['orders'] = $menuItem['children']['orders'];
$subMenuCollection['downloadables'] = $menuItem['children']['downloadables'];
$subMenuCollection['wishlist'] = $menuItem['children']['wishlist'];
$subMenuCollection['compare'] = [
'key' => 'account.compare',
'name' => 'velocity::app.customer.compare.text',
'url' => route('velocity.customer.product.compare'),
];
$subMenuCollection['compare'] = $menuItem['children']['compare'];
$subMenuCollection['reviews'] = $menuItem['children']['reviews'];
$subMenuCollection['address'] = $menuItem['children']['address'];
} catch (\Exception $exception) {

View File

@ -5,25 +5,10 @@
@endsection
@push('css')
<style type="text/css">
<style>
.account-head {
height: 50px;
}
.remove-icon {
right: 15px;
font-size: 22px;
height: 24px;
text-align: center;
position: absolute;
border-radius: 50%;
color: #333;
width: 24px;
padding: 0px;
top: 10px;
}
.remove-icon:before {
content: "x";
}
</style>
@endpush

View File

@ -57,6 +57,7 @@
<img
class="image-wrapper"
:src="product['{{ $attribute['code'] }}']"
onload="window.updateHeight ? window.updateHeight() : ''"
:onerror="`this.src='${$root.baseUrl}/vendor/webkul/ui/assets/images/product/large-product-placeholder.png'`" />
</a>
@break

View File

@ -66,7 +66,12 @@
@section('body-header')
@include('shop::layouts.top-nav.index')
@include('shop::layouts.header.index')
{!! view_render_event('bagisto.shop.layout.header.before') !!}
@include('shop::layouts.header.index')
{!! view_render_event('bagisto.shop.layout.header.after') !!}
<div class="main-content-wrapper col-12 no-padding">
@php

View File

@ -28,10 +28,9 @@
@if (count(core()->getCurrentChannel()->locales) == 1)
disabled="disabled"
@endif>
@foreach (core()->getCurrentChannel()->locales as $locale)
@if (isset($serachQuery))
@dd(app()->getLocale());
<option
value="?{{ $serachQuery }}&locale={{ $locale->code }}"
{{ $locale->code == app()->getLocale() ? 'selected' : '' }}>

View File

@ -72,11 +72,11 @@ class TaxCest
$this->scenario = [
'object' => Cart::getCart(),
'expectedTaxRates' => [
(string)round((float)$tax1->tax_rate, \Webkul\Tax\Helpers\Tax::TAX_PRECISION)
=> round(11 * $product1->price * $tax1->tax_rate / 100, 4),
(string)round((float)$tax1->tax_rate, 4)
=> round(11 * $product1->price * $tax1->tax_rate / 100, 2),
(string)round((float)$tax2->tax_rate, \Webkul\Tax\Helpers\Tax::TAX_PRECISION)
=> round(7 * $product2->price * $tax2->tax_rate / 100, 4),
(string)round((float)$tax2->tax_rate, 4)
=> round(7 * $product2->price * $tax2->tax_rate / 100, 2),
],
'expectedTaxTotal' =>
round(