Merge branch 'master' of https://github.com/bagisto/bagisto into sarga-v1

 Conflicts:
	composer.json
	composer.lock
	packages/Webkul/Product/src/Listeners/ProductFlat.php
	packages/Webkul/Velocity/src/Http/Controllers/Shop/ShopController.php
This commit is contained in:
merdan 2022-07-25 16:09:17 +05:00
commit ae72375120
264 changed files with 2745 additions and 1356 deletions

View File

@ -8,7 +8,7 @@ jobs:
strategy: strategy:
matrix: matrix:
operating-system: [ubuntu-latest] operating-system: [ubuntu-latest]
php-versions: ['8.0', '8.1'] php-versions: ['8.1']
name: PHP ${{ matrix.php-versions }} test on ${{ matrix.operating-system }} name: PHP ${{ matrix.php-versions }} test on ${{ matrix.operating-system }}
services: services:

View File

@ -14,6 +14,7 @@ class Kernel extends HttpKernel
* @var array * @var array
*/ */
protected $middleware = [ protected $middleware = [
\Illuminate\Http\Middleware\HandleCors::class,
\Webkul\Core\Http\Middleware\CheckForMaintenanceMode::class, \Webkul\Core\Http\Middleware\CheckForMaintenanceMode::class,
\App\Http\Middleware\EncryptCookies::class, \App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,

View File

@ -8,15 +8,14 @@
"license": "MIT", "license": "MIT",
"type": "project", "type": "project",
"require": { "require": {
"php": "^8.0.2", "php": "^8.1",
"astrotomic/laravel-translatable": "^11.0.0", "astrotomic/laravel-translatable": "^11.0.0",
"babenkoivan/elastic-scout-driver": "^2.0", "babenkoivan/elastic-scout-driver": "^2.0",
"bagisto/legacy-api": "^1.0", "bagisto/legacy-api": "^1.0",
"bagisto/rest-api": "dev-master", "bagisto/rest-api": "dev-master",
"bagistobrasil/bagisto-product-social-share": "^0.1.2", "bagistobrasil/bagisto-product-social-share": "^0.1.2",
"barryvdh/laravel-debugbar": "^3.1", "barryvdh/laravel-debugbar": "^3.1",
"barryvdh/laravel-dompdf": "^1.0.0", "barryvdh/laravel-dompdf": "^2.0.0",
"beyondcode/laravel-websockets": "^1.13",
"diglactic/laravel-breadcrumbs": "^7.0", "diglactic/laravel-breadcrumbs": "^7.0",
"doctrine/dbal": "^2.9", "doctrine/dbal": "^2.9",
"enshrined/svg-sanitize": "^0.15.0", "enshrined/svg-sanitize": "^0.15.0",
@ -112,8 +111,7 @@
"Sarga\\API\\": "packages/Sarga/API", "Sarga\\API\\": "packages/Sarga/API",
"Sarga\\Admin\\": "packages/Sarga/Admin/src", "Sarga\\Admin\\": "packages/Sarga/Admin/src",
"Sarga\\Brand\\": "packages/Sarga/Brand/src", "Sarga\\Brand\\": "packages/Sarga/Brand/src",
"Sarga\\Payment\\": "packages/Sarga/Payment", "Sarga\\Payment\\": "packages/Sarga/Payment"
"Webkul\\suggestion\\": "packages/Webkul/suggestion/src"
} }
}, },
"autoload-dev": { "autoload-dev": {

View File

@ -1,5 +1,7 @@
<?php <?php
use Illuminate\Support\Facades\Facade;
return [ return [
/* /*
@ -304,64 +306,20 @@ return [
| |
*/ */
'aliases' => [ 'aliases' => Facade::defaultAliases()->merge([
/**
* Laravel
*
* Place your aliases in alphabetical order.
*/
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
/**
* Bagisto
*
* Place your aliases in alphabetical order.
*/
'Captcha' => Webkul\Customer\Facades\Captcha::class, 'Captcha' => Webkul\Customer\Facades\Captcha::class,
'Cart' => Webkul\Checkout\Facades\Cart::class, 'Cart' => Webkul\Checkout\Facades\Cart::class,
'Concord' => Konekt\Concord\Facades\Concord::class, 'Concord' => Konekt\Concord\Facades\Concord::class,
'Core' => Webkul\Core\Facades\Core::class, 'Core' => Webkul\Core\Facades\Core::class,
'Datagrid' => Webkul\Ui\DataGrid\Facades\DataGrid::class, 'Datagrid' => Webkul\Ui\DataGrid\Facades\DataGrid::class,
'DbView' => Flynsarmy\DbBladeCompiler\Facades\DbView::class, 'DbView' => Flynsarmy\DbBladeCompiler\Facades\DbView::class,
'Debugbar' => Barryvdh\Debugbar\Facade::class, 'Debugbar' => Barryvdh\Debugbar\Facades\Debugbar::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class, 'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'Helper' => Konekt\Concord\Facades\Helper::class, 'Helper' => Konekt\Concord\Facades\Helper::class,
'Image' => Intervention\Image\Facades\Image::class, 'Image' => Intervention\Image\Facades\Image::class,
'PDF' => Barryvdh\DomPDF\Facade::class, 'PDF' => Barryvdh\DomPDF\Facade::class,
'ProductImage' => Webkul\Product\Facades\ProductImage::class, 'ProductImage' => Webkul\Product\Facades\ProductImage::class,
'ProductVideo' => Webkul\Product\Facades\ProductVideo::class, 'ProductVideo' => Webkul\Product\Facades\ProductVideo::class,
], 'Redis' => Illuminate\Support\Facades\Redis::class,
])->toArray(),
]; ];

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="#9497B8" stroke-width="2"/>
<path d="M9 9L15 15" stroke="#9497B8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M15 9L9 15" stroke="#9497B8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 471 B

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Pusher JavaScript Library v7.0.6 * Pusher JavaScript Library v7.2.0
* https://pusher.com/ * https://pusher.com/
* *
* Copyright 2020, Pusher * Copyright 2020, Pusher
@ -18,8 +18,8 @@
*/ */
/*! /*!
* Vue.js v2.6.14 * Vue.js v2.7.7
* (c) 2014-2021 Evan You * (c) 2014-2022 Evan You
* Released under the MIT License. * Released under the MIT License.
*/ */
@ -37,6 +37,8 @@
* Date: 2021-03-02T17:08Z * Date: 2021-03-02T17:08Z
*/ */
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/** /**
* @license * @license
* Lodash <https://lodash.com/> * Lodash <https://lodash.com/>

View File

@ -1,4 +1,4 @@
{ {
"/js/admin.js": "/js/admin.js?id=fecd2e4463e43c5595a5", "/js/admin.js": "/js/admin.js?id=342ead48e2eb8d7dc7a3",
"/css/admin.css": "/css/admin.css?id=e4ebf1879c19e72942f5" "/css/admin.css": "/css/admin.css?id=bd6f253e4db4d12d1a57"
} }

View File

@ -173,7 +173,7 @@ class CartRuleDataGrid extends DataGrid
'closure' => function ($value) { 'closure' => function ($value) {
if ($value->status == 1) { if ($value->status == 1) {
return trans('admin::app.datagrid.active'); return trans('admin::app.datagrid.active');
} else if ($value->status == 0) { } elseif ($value->status == 0) {
return trans('admin::app.datagrid.inactive'); return trans('admin::app.datagrid.inactive');
} else { } else {
return trans('admin::app.datagrid.draft'); return trans('admin::app.datagrid.draft');

View File

@ -70,9 +70,9 @@ class EmailTemplateDataGrid extends DataGrid
'closure' => function ($value) { 'closure' => function ($value) {
if ($value->status == 'active') { if ($value->status == 'active') {
return trans('admin::app.datagrid.active'); return trans('admin::app.datagrid.active');
} else if ($value->status == 'inactive') { } elseif ($value->status == 'inactive') {
return trans('admin::app.datagrid.inactive'); return trans('admin::app.datagrid.inactive');
} else if ($value->status == 'draft') { } elseif ($value->status == 'draft') {
return trans('admin::app.datagrid.draft'); return trans('admin::app.datagrid.draft');
} }
}, },

View File

@ -97,10 +97,29 @@ class ConfigurationController extends Controller
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Webkul\Admin\Http\Requests\ConfigurationForm $request * @param \Webkul\Admin\Http\Requests\ConfigurationForm $request
* @return \Illuminate\Http\Response * @return \Illuminate\Http\RedirectResponse
*/ */
public function store(ConfigurationForm $request) public function store(ConfigurationForm $request)
{ {
$data = $request->request->all();
if (isset($data['sales']['carriers'])) {
$atLeastOneCarrierEnabled = false;
foreach ($data['sales']['carriers'] as $carrier) {
if ($carrier['active']) {
$atLeastOneCarrierEnabled = true;
break;
}
}
if (! $atLeastOneCarrierEnabled) {
session()->flash('error', trans('admin::app.configuration.enable-atleast-one-shipping'));
return redirect()->back();
}
}
$this->coreConfigRepository->create($request->except(['_token', 'admin_locale'])); $this->coreConfigRepository->create($request->except(['_token', 'admin_locale']));
session()->flash('success', trans('admin::app.configuration.save-message')); session()->flash('success', trans('admin::app.configuration.save-message'));

View File

@ -115,7 +115,7 @@ class RefundController extends Controller
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Refund'])); session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Refund']));
return redirect()->route($this->_config['redirect'], $orderId); return redirect()->route($this->_config['redirect']);
} }
/** /**

View File

@ -26,7 +26,8 @@ class ConfigurationForm extends FormRequest
{ {
$this->rules = []; $this->rules = [];
if (request()->has('catalog.products.storefront.products_per_page') if (
request()->has('catalog.products.storefront.products_per_page')
&& ! empty(request()->input('catalog.products.storefront.products_per_page')) && ! empty(request()->input('catalog.products.storefront.products_per_page'))
) { ) {
$this->rules = [ $this->rules = [
@ -34,7 +35,8 @@ class ConfigurationForm extends FormRequest
]; ];
} }
if (request()->has('general.design.admin_logo.logo_image') if (
request()->has('general.design.admin_logo.logo_image')
&& ! request()->input('general.design.admin_logo.logo_image.delete') && ! request()->input('general.design.admin_logo.logo_image.delete')
) { ) {
$this->rules = array_merge($this->rules, [ $this->rules = array_merge($this->rules, [
@ -42,7 +44,8 @@ class ConfigurationForm extends FormRequest
]); ]);
} }
if (request()->has('general.design.admin_logo.favicon') if (
request()->has('general.design.admin_logo.favicon')
&& ! request()->input('general.design.admin_logo.favicon.delete') && ! request()->input('general.design.admin_logo.favicon.delete')
) { ) {
$this->rules = array_merge($this->rules, [ $this->rules = array_merge($this->rules, [
@ -50,7 +53,8 @@ class ConfigurationForm extends FormRequest
]); ]);
} }
if (request()->has('sales.invoice_setttings.invoice_slip_design.logo') if (
request()->has('sales.invoice_setttings.invoice_slip_design.logo')
&& ! request()->input('sales.invoice_setttings.invoice_slip_design.logo.delete') && ! request()->input('sales.invoice_setttings.invoice_slip_design.logo.delete')
) { ) {
$this->rules = array_merge($this->rules, [ $this->rules = array_merge($this->rules, [

View File

@ -94,10 +94,16 @@ class AdminServiceProvider extends ServiceProvider
continue; continue;
} }
if ($index + 1 < count(config('menu.admin')) && $permissionType != 'all') { if (
$index + 1 < count(config('menu.admin'))
&& $permissionType != 'all'
) {
$permission = config('menu.admin')[$index + 1]; $permission = config('menu.admin')[$index + 1];
if (substr_count($permission['key'], '.') == 2 && substr_count($item['key'], '.') == 1) { if (
substr_count($permission['key'], '.') == 2
&& substr_count($item['key'], '.') == 1
) {
foreach ($allowedPermissions as $key => $value) { foreach ($allowedPermissions as $key => $value) {
if ($item['key'] == $value) { if ($item['key'] == $value) {
$neededItem = $allowedPermissions[$key + 1]; $neededItem = $allowedPermissions[$key + 1];

View File

@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="#9497B8" stroke-width="2"/>
<path d="M9 9L15 15" stroke="#9497B8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M15 9L9 15" stroke="#9497B8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 471 B

View File

@ -452,6 +452,19 @@
.control { .control {
border: 1px solid $dark-mode-switch-border; border: 1px solid $dark-mode-switch-border;
} }
input[type=date] {
background-position-x: 95%;
background-position-y: center;
background-image: url(../images/Icon-remove.svg);
background-size: 18px 30px;
background-repeat: no-repeat;
&::-webkit-inner-spin-button,
&::-webkit-calendar-picker-indicator {
-webkit-appearance: none;
opacity: 0;
}
}
} }
.grid-container { .grid-container {

View File

@ -740,6 +740,7 @@ return [
'yes' => 'نعم.', 'yes' => 'نعم.',
'no' => 'لا.', 'no' => 'لا.',
'delete' => 'احذف', 'delete' => 'احذف',
'enable-atleast-one-shipping' => 'تفعيل طريقة شحن واحدة على الأقل.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'فئات الضرائب', 'title' => 'فئات الضرائب',

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes', 'yes' => 'Yes',
'no' => 'No', 'no' => 'No',
'delete' => 'Delete', 'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Tax Categories', 'title' => 'Tax Categories',

View File

@ -732,6 +732,7 @@ return [
'yes' => 'Ja', 'yes' => 'Ja',
'no' => 'Nein', 'no' => 'Nein',
'delete' => 'Löschen', 'delete' => 'Löschen',
'enable-atleast-one-shipping' => 'Aktivieren Sie mindestens eine Versandart.',
'tax-categories' => 'tax-categories' =>
[ [
'title' => 'Steuerkategorien', 'title' => 'Steuerkategorien',

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes', 'yes' => 'Yes',
'no' => 'No', 'no' => 'No',
'delete' => 'Delete', 'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Tax Categories', 'title' => 'Tax Categories',

View File

@ -742,6 +742,7 @@ return [
'yes' => 'Sí', 'yes' => 'Sí',
'no' => 'No', 'no' => 'No',
'delete' => 'Borrar', 'delete' => 'Borrar',
'enable-atleast-one-shipping' => 'Habilite al menos un método de envío.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Categorías de impuestos', 'title' => 'Categorías de impuestos',

View File

@ -725,6 +725,7 @@ return [
'yes' => 'بله', 'yes' => 'بله',
'no' => 'خیر', 'no' => 'خیر',
'delete' => 'حذف', 'delete' => 'حذف',
'enable-atleast-one-shipping' => 'حداقل یک روش حمل و نقل را فعال کنید.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'دسته بندی های مالیات', 'title' => 'دسته بندی های مالیات',

View File

@ -7,7 +7,7 @@ return [
'create' => 'Créer', 'create' => 'Créer',
'update' => 'Mettre à jour', 'update' => 'Mettre à jour',
'delete' => 'Effacer', 'delete' => 'Effacer',
'failed' => 'Manqué', 'failed' => 'Erreur',
'store' => 'Magasin', 'store' => 'Magasin',
'image' => 'Image', 'image' => 'Image',
'no result' => 'Pas de résultat', 'no result' => 'Pas de résultat',
@ -35,7 +35,7 @@ return [
'category' => 'Catégorie', 'category' => 'Catégorie',
'common' => [ 'common' => [
'no-result-found' => 'Nous n\'avons pu trouver aucun enregistrement.', 'no-result-found' => 'Nous n\'avons pu trouver aucun résultat',
'country' => 'Pays', 'country' => 'Pays',
'state' => 'État', 'state' => 'État',
'true' => 'Vrai', 'true' => 'Vrai',
@ -49,16 +49,16 @@ return [
'visit-shop' => 'Visiter la boutique', 'visit-shop' => 'Visiter la boutique',
'dashboard' => 'Tableau de bord', 'dashboard' => 'Tableau de bord',
'sales' => 'Ventes', 'sales' => 'Ventes',
'orders' => 'Ordres', 'orders' => 'Commandes',
'shipments' => 'Expéditions', 'shipments' => 'Expéditions',
'invoices' => 'Factures', 'invoices' => 'Factures',
'refunds' => 'Remboursements', 'refunds' => 'Remboursements',
'catalog' => 'Catalogue', 'catalog' => 'Catalogue',
'products' => 'Des produits', 'products' => 'Produits',
'categories' => 'Catégories', 'categories' => 'Catégories',
'attributes' => 'Les attributs', 'attributes' => 'Ättributs',
'attribute-families' => 'Familles d\'attributs', 'attribute-families' => 'Familles d\'attributs',
'customers' => 'Les clients', 'customers' => 'Clients',
'groups' => 'Groupes', 'groups' => 'Groupes',
'reviews' => 'Commentaires', 'reviews' => 'Commentaires',
'configure' => 'Configurer', 'configure' => 'Configurer',
@ -69,11 +69,11 @@ return [
'inventory-sources' => 'Sources d\'inventaire', 'inventory-sources' => 'Sources d\'inventaire',
'channels' => 'Canaux', 'channels' => 'Canaux',
'users' => 'Utilisateurs', 'users' => 'Utilisateurs',
'roles' => 'Les rôles', 'roles' => 'Rôles',
'sliders' => 'Curseurs', 'sliders' => 'Panneaux défilants',
'taxes' => 'Impôts', 'taxes' => 'Impôts',
'tax-categories' => 'Catégories de taxes', 'tax-categories' => 'Catégories de taxes',
'tax-rates' => 'Les taux d\'imposition', 'tax-rates' => 'Taux d\'imposition',
'marketing' => 'Commercialisation', 'marketing' => 'Commercialisation',
'promotions' => 'Promotions', 'promotions' => 'Promotions',
'email-marketing' => 'Publicité par e-mail', 'email-marketing' => 'Publicité par e-mail',
@ -93,19 +93,19 @@ return [
'dashboard' => 'Tableau de bord', 'dashboard' => 'Tableau de bord',
'sales' => 'Ventes', 'sales' => 'Ventes',
'cancel' => 'Annuler', 'cancel' => 'Annuler',
'orders' => 'Ordres', 'orders' => 'Commandes',
'shipments' => 'Expéditions', 'shipments' => 'Expéditions',
'invoices' => 'Factures', 'invoices' => 'Factures',
'refunds' => 'Remboursements', 'refunds' => 'Remboursements',
'catalog' => 'Catalogue', 'catalog' => 'Catalogue',
'products' => 'Des produits', 'products' => 'Produits',
'copy' => 'Copie', 'copy' => 'Copie',
'categories' => 'Catégories', 'categories' => 'Catégories',
'attributes' => 'Les attributs', 'attributes' => 'Attributs',
'attribute-families' => 'Familles d\'attributs', 'attribute-families' => 'Familles d\'attributs',
'customers' => 'Les clients', 'customers' => 'Clients',
'addresses' => 'Adresses', 'addresses' => 'Adresses',
'note' => 'Noter', 'note' => 'Notes',
'groups' => 'Groupes', 'groups' => 'Groupes',
'reviews' => 'Commentaires', 'reviews' => 'Commentaires',
'configure' => 'Configurer', 'configure' => 'Configurer',
@ -116,8 +116,8 @@ return [
'inventory-sources' => 'Sources d\'inventaire', 'inventory-sources' => 'Sources d\'inventaire',
'channels' => 'Canaux', 'channels' => 'Canaux',
'users' => 'Utilisateurs', 'users' => 'Utilisateurs',
'roles' => 'Les rôles', 'roles' => 'Rôles',
'sliders' => 'Curseurs', 'sliders' => 'Panneaux défilants',
'taxes' => 'Impôts', 'taxes' => 'Impôts',
'tax-categories' => 'Catégories de taxes', 'tax-categories' => 'Catégories de taxes',
'tax-rates' => 'Les taux d\'imposition', 'tax-rates' => 'Les taux d\'imposition',
@ -125,12 +125,12 @@ return [
'edit' => 'Éditer', 'edit' => 'Éditer',
'create' => 'Ajouter', 'create' => 'Ajouter',
'delete' => 'Effacer', 'delete' => 'Effacer',
'mass-delete' => 'Suppression en masse', 'mass-delete' => 'Suppression multiple',
'mass-update' => 'Mise à jour de masse', 'mass-update' => 'Mise à jour multiple',
'marketing' => 'Commercialisation', 'marketing' => 'Commercialisation',
'promotions' => 'Promotions', 'promotions' => 'Promotions',
'cart-rules' => 'Règles du panier', 'cart-rules' => 'Paramètres du panier',
'catalog-rules' => 'Règles du catalogue', 'catalog-rules' => 'Paramètres du catalogue',
'email-marketing' => 'Publicité par e-mail', 'email-marketing' => 'Publicité par e-mail',
'email-templates' => 'Modèles d\'e-mails', 'email-templates' => 'Modèles d\'e-mails',
'campaigns' => 'Campagnes', 'campaigns' => 'Campagnes',
@ -146,8 +146,8 @@ return [
'to' => 'À', 'to' => 'À',
'total-customers' => 'Clients totaux', 'total-customers' => 'Clients totaux',
'total-orders' => 'Total des commandes', 'total-orders' => 'Total des commandes',
'total-sale' => 'Vente totale', 'total-sale' => 'Ventes totales',
'average-sale' => 'Vente de commande moyenne', 'average-sale' => 'Prix moyen d\'une commande',
'total-unpaid-invoices' => 'Total des factures impayées', 'total-unpaid-invoices' => 'Total des factures impayées',
'increased' => ':progress%', 'increased' => ':progress%',
'decreased' => ':progress%', 'decreased' => ':progress%',
@ -165,7 +165,7 @@ return [
'datagrid' => [ 'datagrid' => [
'mass-ops' => [ 'mass-ops' => [
'method-error' => 'Erreur! Mauvaise méthode détectée, veuillez vérifier la configuration de l\'action de masse', 'method-error' => 'Une erreur est survenue. Mauvaise configuration détectée, veuillez vérifier la configuration de l\'action multiple',
'delete-success' => 'Sélectionné :resource a été supprimée avec succès', 'delete-success' => 'Sélectionné :resource a été supprimée avec succès',
'partial-action' => 'Certaines actions n\'ont pas été effectuées en raison de contraintes système restreintes sur :resource', 'partial-action' => 'Certaines actions n\'ont pas été effectuées en raison de contraintes système restreintes sur :resource',
'update-success' => 'Sélectionné :resource a été mise à jour avec succès', 'update-success' => 'Sélectionné :resource a été mise à jour avec succès',
@ -186,17 +186,17 @@ return [
'per-locale' => 'Basé sur les paramètres régionaux', 'per-locale' => 'Basé sur les paramètres régionaux',
'per-channel' => 'Basé sur le canal', 'per-channel' => 'Basé sur le canal',
'position' => 'Positionner', 'position' => 'Positionner',
'locale' => 'Lieu', 'locale' => 'Langue',
'hostname' => 'Nom d\'hôte', 'hostname' => 'Nom d\'hôte',
'email' => 'E-mail', 'email' => 'E-mail',
'group' => 'Grouper', 'group' => 'Groupe',
'phone' => 'Téléphoner', 'phone' => 'Téléphone',
'gender' => 'Genre', 'gender' => 'Genre',
'title' => 'Titre', 'title' => 'Titre',
'layout' => 'Mise en page', 'layout' => 'Mise en page',
'url-key' => 'Clé URL', 'url-key' => 'Clé URL',
'comment' => 'Commenter', 'comment' => 'Commenter',
'product-name' => 'Produit', 'product-name' => 'Nom du produit',
'currency-name' => 'Nom de la devise', 'currency-name' => 'Nom de la devise',
'exch-rate' => 'Taux de change', 'exch-rate' => 'Taux de change',
'priority' => 'Priorité', 'priority' => 'Priorité',
@ -206,8 +206,8 @@ return [
'order-date' => 'Date de commande', 'order-date' => 'Date de commande',
'channel-name' => 'Nom du canal', 'channel-name' => 'Nom du canal',
'billed-to' => 'Facturé à', 'billed-to' => 'Facturé à',
'shipped-to' => 'Expédiés à', 'shipped-to' => 'Expédié à',
'order-id' => 'numéro de commande', 'order-id' => 'Numéro de commande',
'invoice-id' => 'Numéro de facture', 'invoice-id' => 'Numéro de facture',
'invoice-date' => 'Date de la facture', 'invoice-date' => 'Date de la facture',
'total-qty' => 'Quantité totale', 'total-qty' => 'Quantité totale',
@ -222,13 +222,13 @@ return [
'identifier' => 'Identifiant', 'identifier' => 'Identifiant',
'state' => 'État', 'state' => 'État',
'country' => 'Pays', 'country' => 'Pays',
'tax-rate' => 'Taux', 'tax-rate' => 'Taxes',
'role' => 'Rôle', 'role' => 'Rôle',
'sub-total' => 'Sous-total', 'sub-total' => 'Sous-total',
'no-of-products' => 'Nombre de produits', 'no-of-products' => 'Nombre de produits',
'attribute-family' => 'Famille d\'attributs', 'attribute-family' => 'Famille d\'attributs',
'starts-from' => 'Commence à partir de', 'starts-from' => 'Commence à partir de',
'ends-till' => 'Se termine jusqu\'à', 'ends-till' => 'Se termine à',
'per-cust' => 'Par client', 'per-cust' => 'Par client',
'usage-throttle' => 'Temps d\'utilisation', 'usage-throttle' => 'Temps d\'utilisation',
'for-guest' => 'Pour les invités', 'for-guest' => 'Pour les invités',
@ -236,7 +236,7 @@ return [
'refund-date' => 'date de remboursement', 'refund-date' => 'date de remboursement',
'refunded' => 'Remboursé', 'refunded' => 'Remboursé',
'start' => 'Démarrer', 'start' => 'Démarrer',
'end' => 'Finir', 'end' => 'Terminer',
'active' => 'actif', 'active' => 'actif',
'inactive' => 'Inactif', 'inactive' => 'Inactif',
'draft' => 'Brouillon', 'draft' => 'Brouillon',
@ -246,7 +246,7 @@ return [
'pending' => 'En attente', 'pending' => 'En attente',
'disapproved' => 'Refusé', 'disapproved' => 'Refusé',
'coupon-code' => 'Code de réduction', 'coupon-code' => 'Code de réduction',
'times-used' => 'Temps utilisés', 'times-used' => 'Utilisé',
'created-date' => 'Date de création', 'created-date' => 'Date de création',
'expiration-date' => 'Date d\'expiration', 'expiration-date' => 'Date d\'expiration',
'edit' => 'Éditer', 'edit' => 'Éditer',
@ -254,10 +254,10 @@ return [
'view' => 'Vue', 'view' => 'Vue',
'rtl' => 'RTL', 'rtl' => 'RTL',
'ltr' => 'LTR', 'ltr' => 'LTR',
'update-status' => 'État de mise à jour', 'update-status' => 'Statut de mise à jour',
'subject' => 'Matière', 'subject' => 'Sujet',
'date' => 'Date', 'date' => 'Date',
'transaction-id' => 'identifiant de transaction', 'transaction-id' => 'Identifiant de transaction',
'transaction-date' => 'Date de la transaction', 'transaction-date' => 'Date de la transaction',
'file-name' => 'File Name', 'file-name' => 'File Name',
'path' => 'Path', 'path' => 'Path',
@ -268,9 +268,9 @@ return [
'title' => 'Mon compte', 'title' => 'Mon compte',
'save-btn-title' => 'Sauvegarder', 'save-btn-title' => 'Sauvegarder',
'general' => 'Général', 'general' => 'Général',
'upload-image-info' => 'Upload a Profile Image (100px x 100px) in PNG or JPG Format', 'upload-image-info' => 'Uploadez une image de profil (100px x 100px) en PNG ou JPG.',
'remove-image' => 'Remove Image', 'remove-image' => 'Supprimer l\'image',
'image-upload-message' => 'Only images (.jpeg, .jpg, .png, ..) are allowed.', 'image-upload-message' => 'Seulement les images (.jpeg, .jpg, .png, ..) sont autorisées.',
'name' => 'Nom', 'name' => 'Nom',
'email' => 'E-mail', 'email' => 'E-mail',
'password' => 'Mot de passe', 'password' => 'Mot de passe',
@ -286,7 +286,7 @@ return [
'email' => 'Email enregistré', 'email' => 'Email enregistré',
'password' => 'Mot de passe', 'password' => 'Mot de passe',
'confirm-password' => 'Confirmez le mot de passe', 'confirm-password' => 'Confirmez le mot de passe',
'back-link-title' => 'Retour à la connexion', 'back-link-title' => 'Retour à l\'écran de connexion',
'submit-btn-title' => 'Envoyer un e-mail de réinitialisation du mot de passe', 'submit-btn-title' => 'Envoyer un e-mail de réinitialisation du mot de passe',
'passwords' => [ 'passwords' => [
'throttled' => 'Avertissement : Vous avez récemment demandé la réinitialisation de votre mot de passe, veuillez vérifier votre messagerie.', 'throttled' => 'Avertissement : Vous avez récemment demandé la réinitialisation de votre mot de passe, veuillez vérifier votre messagerie.',
@ -294,16 +294,16 @@ return [
], ],
'reset-password' => [ 'reset-password' => [
'title' => 'réinitialiser le mot de passe', 'title' => 'Réinitialiser le mot de passe',
'email' => 'Email enregistré', 'email' => 'Email enregistré',
'password' => 'Mot de passe', 'password' => 'Mot de passe',
'confirm-password' => 'Confirmez le mot de passe', 'confirm-password' => 'Confirmez le mot de passe',
'back-link-title' => 'Retour à la connexion', 'back-link-title' => 'Retour à la connexion',
'submit-btn-title' => 'réinitialiser le mot de passe', 'submit-btn-title' => 'Réinitialiser le mot de passe',
], ],
'roles' => [ 'roles' => [
'title' => 'Les rôles', 'title' => 'Rôles',
'add-role-title' => 'Ajouter un rôle', 'add-role-title' => 'Ajouter un rôle',
'edit-role-title' => 'Modifier le rôle', 'edit-role-title' => 'Modifier le rôle',
'save-btn-title' => 'Enregistrer le rôle', 'save-btn-title' => 'Enregistrer le rôle',
@ -326,20 +326,20 @@ return [
'name' => 'Nom', 'name' => 'Nom',
'password' => 'Mot de passe', 'password' => 'Mot de passe',
'confirm-password' => 'Confirmez le mot de passe', 'confirm-password' => 'Confirmez le mot de passe',
'status-and-role' => 'Statut et rôle', 'status-and-role' => 'Statut et autorisations',
'role' => 'Rôle', 'role' => 'Rôle',
'status' => 'Statut', 'status' => 'Statut d\'activation',
'account-is-active' => 'Le compte est actif', 'account-is-active' => 'Le compte est actif',
'current-password' => 'Saisissez le mot de passe actuel', 'current-password' => 'Saisissez le mot de passe actuel',
'confirm-delete' => 'Confirmer la suppression de ce compte', 'confirm-delete' => 'Confirmer la suppression de ce compte',
'confirm-delete-title' => 'Confirmer le mot de passe avant de supprimer', 'confirm-delete-title' => 'Confirmer le mot de passe avant de supprimer',
'delete-last' => 'Au moins un administrateur est requis.', 'delete-last' => 'Au moins un administrateur est requis.',
'delete-success' => 'Succès! Utilisateur supprimé', 'delete-success' => 'Utilisateur supprimé avec succès',
'incorrect-password' => 'Le mot de passe que vous avez entré est incorrect', 'incorrect-password' => 'Le mot de passe que vous avez entré est incorrect',
'password-match' => 'Le mot de passe actuel ne correspond pas.', 'password-match' => 'Le mot de passe actuel ne correspond pas.',
'account-save' => 'Les modifications du compte ont été enregistrées avec succès.', 'account-save' => 'Les modifications du compte ont été enregistrées avec succès.',
'login-error' => 'Veuillez vérifier vos informations d\'identification et réessayer.', 'login-error' => 'Veuillez vérifier vos informations d\'identification et réessayer.',
'activate-warning' => 'Votre compte n\'est pas encore activé, veuillez contacter l\'administrateur.', 'activate-warning' => 'Votre compte n\'est pas encore activé, veuillez contacter un administrateur.',
], ],
'sessions' => [ 'sessions' => [
@ -347,14 +347,14 @@ return [
'email' => 'E-mail', 'email' => 'E-mail',
'password' => 'Mot de passe', 'password' => 'Mot de passe',
'forget-password-link-title' => 'Mot de passe oublié ?', 'forget-password-link-title' => 'Mot de passe oublié ?',
'remember-me' => 'Souviens-toi de moi', 'remember-me' => 'Se souvenir de moi',
'submit-btn-title' => 'S\'identifier', 'submit-btn-title' => 'S\'identifier',
], ],
], ],
'sales' => [ 'sales' => [
'orders' => [ 'orders' => [
'title' => 'Ordres', 'title' => 'Commandes',
'view-title' => 'N° de commande :order_id', 'view-title' => 'N° de commande :order_id',
'cancel-btn-title' => 'Annuler', 'cancel-btn-title' => 'Annuler',
'shipment-btn-title' => 'Bateau', 'shipment-btn-title' => 'Bateau',
@ -399,12 +399,12 @@ return [
'item-canceled' => 'Annulé (:qty_cancelled]', 'item-canceled' => 'Annulé (:qty_cancelled]',
'item-refunded' => 'Remboursé (:qty_refunded]', 'item-refunded' => 'Remboursé (:qty_refunded]',
'price' => 'Prix', 'price' => 'Prix',
'total' => 'Le total', 'total' => 'Total',
'subtotal' => 'Total', 'subtotal' => 'Total',
'shipping-handling' => 'Expédition et manutention', 'shipping-handling' => 'Expédition et manutention',
'discount' => 'Rabais', 'discount' => 'Rabais',
'tax' => 'Impôt', 'tax' => 'Imposition',
'tax-percent' => 'Pourcentage d\'impôt', 'tax-percent' => 'Pourcentage d\'imposition',
'tax-amount' => 'Montant de la taxe', 'tax-amount' => 'Montant de la taxe',
'discount-amount' => 'Montant de la remise', 'discount-amount' => 'Montant de la remise',
'grand-total' => 'Total', 'grand-total' => 'Total',
@ -436,9 +436,9 @@ return [
'action' => 'action', 'action' => 'action',
'add-title' => 'Créer une facture', 'add-title' => 'Créer une facture',
'save-btn-title' => 'Enregistrer la facture', 'save-btn-title' => 'Enregistrer la facture',
'send-duplicate-invoice' => 'Send Duplicate Invoice', 'send-duplicate-invoice' => 'Envoyez un duplicata',
'send' => 'Send', 'send' => 'Envoyer',
'invoice-sent' => 'Invoice sent successfully!', 'invoice-sent' => 'Facture envoyée avec succès!',
'qty' => 'Qté', 'qty' => 'Qté',
'qty-ordered' => 'Qté commandée', 'qty-ordered' => 'Qté commandée',
'qty-to-invoice' => 'Quantité à facturer', 'qty-to-invoice' => 'Quantité à facturer',
@ -516,22 +516,22 @@ return [
'view-title' => 'N° de transaction :transaction_id', 'view-title' => 'N° de transaction :transaction_id',
'transaction-data' => 'Données de transaction', 'transaction-data' => 'Données de transaction',
'order-id' => 'numéro de commande', 'order-id' => 'numéro de commande',
'invoice-id' => 'Identifiant de la facture', 'invoice-id' => 'Numéro de facture',
'status' => 'Statut', 'status' => 'Statut',
'created-at' => 'Créé à', 'created-at' => 'Créé à',
'transaction-details' => 'détails de la transaction', 'transaction-details' => 'détails de la transaction',
'response' => [ 'response' => [
'invoice-missing' => 'Cet identifiant de facture n\'existe pas', 'invoice-missing' => 'Ce numéro de facture n\'existe pas',
'transaction-saved' => 'La transaction a été enregistrée', 'transaction-saved' => 'La transaction a été enregistrée',
'already-paid' => 'Cette facture a déjà été payée', 'already-paid' => 'Cette facture a déjà été payée',
'transaction-amount-exceeds' => 'The specified amount of this transaction exceeds the total amount of the invoice.', 'transaction-amount-exceeds' => 'Le montant de cette transaction dépasse le montant total de la facture.',
], ],
], ],
], ],
'catalog' => [ 'catalog' => [
'products' => [ 'products' => [
'title' => 'Des produits', 'title' => 'Produits',
'add-product-btn-title' => 'Ajouter un produit', 'add-product-btn-title' => 'Ajouter un produit',
'add-title' => 'Ajouter un produit', 'add-title' => 'Ajouter un produit',
'edit-title' => 'Modifier le produit', 'edit-title' => 'Modifier le produit',
@ -539,12 +539,12 @@ return [
'general' => 'Général', 'general' => 'Général',
'product-type' => 'type de produit', 'product-type' => 'type de produit',
'type' => [ 'type' => [
'simple' => 'Facile', 'simple' => 'Simple',
'booking' => 'réservation', 'booking' => 'Réservation',
'bundle' => 'empaqueter', 'bundle' => 'Bundle',
'downloadable' => 'téléchargeable', 'downloadable' => 'téléchargeable',
'grouped' => 'groupé', 'grouped' => 'groupé',
'virtual' => 'virtuelle', 'virtual' => 'Produit virtuel',
'configurable' => 'configurable', 'configurable' => 'configurable',
], ],
@ -745,6 +745,7 @@ return [
'yes' => 'Oui', 'yes' => 'Oui',
'no' => 'Non', 'no' => 'Non',
'delete' => 'Effacer', 'delete' => 'Effacer',
'enable-atleast-one-shipping' => 'Activez au moins une méthode d\'expédition.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Catégories de taxes', 'title' => 'Catégories de taxes',
@ -1105,7 +1106,7 @@ return [
'orders' => [ 'orders' => [
'list' => 'liste des commandes de :customer_name', 'list' => 'liste des commandes de :customer_name',
'title' => 'Ordres', 'title' => 'Commandes',
], ],
], ],

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes', 'yes' => 'Yes',
'no' => 'No', 'no' => 'No',
'delete' => 'Delete', 'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Tax Categories', 'title' => 'Tax Categories',

View File

@ -742,6 +742,7 @@ return [
'yes' => 'हां', 'yes' => 'हां',
'no' => 'नहीं', 'no' => 'नहीं',
'delete' => 'हटाएं', 'delete' => 'हटाएं',
'enable-atleast-one-shipping' => 'कम से कम एक शिपिंग विधि सक्षम करें।',
'tax-categories' => [ 'tax-categories' => [
'title' => 'कर श्रेणियाँ', 'title' => 'कर श्रेणियाँ',

View File

@ -730,6 +730,7 @@ return [
'yes' => 'Sì', 'yes' => 'Sì',
'no' => 'No', 'no' => 'No',
'delete' => 'Elimina', 'delete' => 'Elimina',
'enable-atleast-one-shipping' => 'Abilita almeno un metodo di spedizione.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Categorie IVA', 'title' => 'Categorie IVA',

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes', 'yes' => 'Yes',
'no' => 'No', 'no' => 'No',
'delete' => 'Delete', 'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Tax Categories', 'title' => 'Tax Categories',

View File

@ -724,6 +724,7 @@ return [
'yes' => 'Ja', 'yes' => 'Ja',
'no' => 'Nee', 'no' => 'Nee',
'delete' => 'Verwijder', 'delete' => 'Verwijder',
'enable-atleast-one-shipping' => 'Schakel ten minste één verzendmethode in.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'BTW categorieën', 'title' => 'BTW categorieën',

View File

@ -725,6 +725,7 @@ return [
'yes' => 'Tak', 'yes' => 'Tak',
'no' => 'Nie', 'no' => 'Nie',
'delete' => 'Usuń', 'delete' => 'Usuń',
'enable-atleast-one-shipping' => 'Włącz co najmniej jedną metodę wysyłki.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Kategorie podatkowe', 'title' => 'Kategorie podatkowe',

View File

@ -723,6 +723,7 @@ return [
'yes' => 'Sim', 'yes' => 'Sim',
'no' => 'Não', 'no' => 'Não',
'delete' => 'Deletar', 'delete' => 'Deletar',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Categorias de Imposto', 'title' => 'Categorias de Imposto',

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes', 'yes' => 'Yes',
'no' => 'No', 'no' => 'No',
'delete' => 'Delete', 'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Включите хотя бы один способ доставки.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Tax Categories', 'title' => 'Tax Categories',

View File

@ -745,6 +745,7 @@ return [
'yes' => 'Yes', 'yes' => 'Yes',
'no' => 'No', 'no' => 'No',
'delete' => 'Delete', 'delete' => 'Delete',
'enable-atleast-one-shipping' => 'Enable atleast one shipping method.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Tax Categories', 'title' => 'Tax Categories',

View File

@ -730,6 +730,7 @@ return [
'yes' => 'Evet', 'yes' => 'Evet',
'no' => 'Hayır', 'no' => 'Hayır',
'delete' => 'Sil', 'delete' => 'Sil',
'enable-atleast-one-shipping' => 'En az bir gönderim yöntemini etkinleştirin.',
'tax-categories' => [ 'tax-categories' => [
'title' => 'Vergi Kategorileri', 'title' => 'Vergi Kategorileri',

View File

@ -725,6 +725,7 @@ return [
'yes' => 'Yes', 'yes' => 'Yes',
'no' => 'No', 'no' => 'No',
'delete' => '删除', 'delete' => '删除',
'enable-atleast-one-shipping' => '啟用至少一種運輸方式',
'tax-categories' => [ 'tax-categories' => [
'title' => '税分类', 'title' => '税分类',

View File

@ -215,21 +215,21 @@
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.controls.after', ['category' => $category]) !!} {!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.controls.after', ['category' => $category]) !!}
</div> </div>
</accordian> </accordian>
<accordian title="{{ __('admin::app.catalog.categories.products') }}" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.products.controls.before', ['category' => $category]) !!}
<datagrid-plus src="{{ route('admin.catalog.categories.products', $category->id) }}"></datagrid-plus>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.products.controls.before', ['category' => $category]) !!}
</div>
</accordian>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.after', ['category' => $category]) !!} {!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.after', ['category' => $category]) !!}
</div> </div>
</div> </div>
</form> </form>
<div class="page-content">
<accordian title="{{ __('admin::app.catalog.categories.products') }}" :active="true">
<div slot="body">
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.products.controls.before', ['category' => $category]) !!}
<datagrid-plus src="{{ route('admin.catalog.categories.products', $category->id) }}"></datagrid-plus>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.products.controls.before', ['category' => $category]) !!}
</div>
</accordian>
</div>
</div> </div>
@stop @stop

View File

@ -12,6 +12,7 @@
foreach ($product->inventories as $inventory) { foreach ($product->inventories as $inventory) {
if ($inventory->inventory_source_id == $inventorySource->id) { if ($inventory->inventory_source_id == $inventorySource->id) {
$qty = $inventory->qty; $qty = $inventory->qty;
break; break;
} }
} }

View File

@ -101,7 +101,10 @@
@foreach ($customAttributes as $attribute) @foreach ($customAttributes as $attribute)
<?php <?php
if ($attribute->code == 'guest_checkout' && ! core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout')) { if (
$attribute->code == 'guest_checkout'
&& ! core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout')
) {
continue; continue;
} }
if($attribute->code=='brand'){ if($attribute->code=='brand'){
@ -119,12 +122,14 @@
} }
if ($attribute->type == 'file') { if ($attribute->type == 'file') {
$retVal = (core()->getConfigData('catalog.products.attribute.file_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.file_attribute_upload_size') : '2048' ; $retVal = (core()->getConfigData('catalog.products.attribute.file_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.file_attribute_upload_size') : '2048';
array_push($validations, 'size:' . $retVal); array_push($validations, 'size:' . $retVal);
} }
if ($attribute->type == 'image') { if ($attribute->type == 'image') {
$retVal = (core()->getConfigData('catalog.products.attribute.image_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.image_attribute_upload_size') : '2048' ; $retVal = (core()->getConfigData('catalog.products.attribute.image_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.image_attribute_upload_size') : '2048';
array_push($validations, 'size:' . $retVal . '|mimes:bmp,jpeg,jpg,png,webp'); array_push($validations, 'size:' . $retVal . '|mimes:bmp,jpeg,jpg,png,webp');
} }
@ -167,8 +172,8 @@
@include ($typeView) @include ($typeView)
<span class="control-error" <span class="control-error"
@if ($attribute->type == 'multiselect') v-if="errors.has('{{ $attribute->code }}[]')" @if ($attribute->type == 'multiselect') v-if="errors.has('{{ $attribute->code }}[]')"
@else v-if="errors.has('{{ $attribute->code }}')" @endif> @else v-if="errors.has('{{ $attribute->code }}')" @endif>
@if ($attribute->type == 'multiselect') @if ($attribute->type == 'multiselect')
@{{ errors.first('{!! $attribute->code !!}[]') }} @{{ errors.first('{!! $attribute->code !!}[]') }}
@else @else

View File

@ -5,7 +5,6 @@
class="control" class="control"
id="{{ $attribute->code }}" id="{{ $attribute->code }}"
{{-- To Do (@devansh-webkul): Need to handle from the backend. --}}
@if ($attribute->code === 'sku') @if ($attribute->code === 'sku')
v-validate="{ required: true, regex: /^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$/ }" v-validate="{ required: true, regex: /^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$/ }"
@else @else
@ -13,5 +12,7 @@
@endif @endif
data-vv-as="&quot;{{ $attribute->admin_name }}&quot;" data-vv-as="&quot;{{ $attribute->admin_name }}&quot;"
{{ in_array($attribute->code, ['url_key']) ? 'v-slugify' : '' }} {{ in_array($attribute->code, ['url_key']) ? 'v-slugify' : '' }}
{{ $attribute->code == 'name' && ! $product[$attribute->code] ? 'v-slugify-target=\'url_key\'' : '' }}> {{ $attribute->code == 'name' && ! $product->url_key ? 'v-slugify-target=\'url_key\'' : '' }}
>

View File

@ -66,7 +66,10 @@
<span class="control-error" v-if="errors.has('address1[]')">@{{ errors.first('address1[]') }}</span> <span class="control-error" v-if="errors.has('address1[]')">@{{ errors.first('address1[]') }}</span>
</div> </div>
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1) @if (
core()->getConfigData('customer.settings.address.street_lines')
&& core()->getConfigData('customer.settings.address.street_lines') > 1
)
<div class="control-group" style="margin-top: -25px;"> <div class="control-group" style="margin-top: -25px;">
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++) @for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
<input type="text" class="control" name="address1[{{ $i }}]" id="address_{{ $i }}"> <input type="text" class="control" name="address1[{{ $i }}]" id="address_{{ $i }}">

View File

@ -69,7 +69,10 @@
<span class="control-error" v-if="errors.has('address1[]')">@{{ errors.first('address1[]') }}</span> <span class="control-error" v-if="errors.has('address1[]')">@{{ errors.first('address1[]') }}</span>
</div> </div>
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1) @if (
core()->getConfigData('customer.settings.address.street_lines')
&& core()->getConfigData('customer.settings.address.street_lines') > 1
)
<div class="control-group" style="margin-top: -25px;"> <div class="control-group" style="margin-top: -25px;">
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++) @for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
<input type="text" class="control" name="address1[{{ $i }}]" id="address_{{ $i }}" value="{{ isset($addresses[$i]) ? $addresses[$i] : '' }}"> <input type="text" class="control" name="address1[{{ $i }}]" id="address_{{ $i }}" value="{{ isset($addresses[$i]) ? $addresses[$i] : '' }}">

View File

@ -67,8 +67,9 @@
methods: { methods: {
haveStates: function () { haveStates: function () {
if (this.countryStates[this.country] && this.countryStates[this.country].length) if (this.countryStates[this.country] && this.countryStates[this.country].length) {
return true; return true;
}
return false; return false;
}, },

View File

@ -134,12 +134,11 @@
if (toggle) { if (toggle) {
toggle.addEventListener("click", () => { toggle.addEventListener("click", () => {
if (nav.classList.contains("is-active")) { if (nav.classList.contains("is-active")) {
nav.classList.remove("is-active"); nav.classList.remove("is-active");
} } else {
else { nav.classList.add("is-active");
nav.classList.add("is-active"); }
}
}); });
nav.addEventListener("blur", () => { nav.addEventListener("blur", () => {

View File

@ -123,16 +123,18 @@
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group" :class="[errors.has('uses_per_coupon') ? 'has-error' : '']">
<label for="uses_per_coupon">{{ __('admin::app.promotions.cart-rules.uses-per-coupon') }}</label> <label for="uses_per_coupon">{{ __('admin::app.promotions.cart-rules.uses-per-coupon') }}</label>
<input class="control" id="uses_per_coupon" name="uses_per_coupon" value="{{ old('uses_per_coupon') }}"/> <input v-validate="'numeric'" class="control" id="uses_per_coupon" name="uses_per_coupon" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.uses-per-coupon') }}&quot;" value="{{ old('uses_per_coupon') }}"/>
<span class="control-error" v-if="errors.has('uses_per_coupon')">@{{ errors.first('uses_per_coupon') }}</span>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group" :class="[errors.has('usage_per_customer') ? 'has-error' : '']">
<label for="usage_per_customer">{{ __('admin::app.promotions.cart-rules.uses-per-customer') }}</label> <label for="usage_per_customer">{{ __('admin::app.promotions.cart-rules.uses-per-customer') }}</label>
<input class="control" id="usage_per_customer" name="usage_per_customer" value="{{ old('usage_per_customer') }}"/> <input v-validate="'numeric'" class="control" id="usage_per_customer" name="usage_per_customer" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.uses-per-customer') }}&quot;" value="{{ old('usage_per_customer') }}"/>
<span class="control-info">{{ __('admin::app.promotions.cart-rules.uses-per-customer-control-info') }}</span> <span class="control-info">{{ __('admin::app.promotions.cart-rules.uses-per-customer-control-info') }}</span>
<span class="control-error" v-if="errors.has('usage_per_customer')">@{{ errors.first('usage_per_customer') }}</span>
</div> </div>
<div class="control-group date"> <div class="control-group date">

View File

@ -135,19 +135,22 @@
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group" :class="[errors.has('uses_per_coupon') ? 'has-error' : '']">
<label for="uses_per_coupon">{{ __('admin::app.promotions.cart-rules.uses-per-coupon') }}</label> <label for="uses_per_coupon">{{ __('admin::app.promotions.cart-rules.uses-per-coupon') }}</label>
<input class="control" id="uses_per_coupon" name="uses_per_coupon" value="{{ old('uses_per_coupon') ?: $cartRule->uses_per_coupon }}"/> <input v-validate="'numeric'" class="control" id="uses_per_coupon" name="uses_per_coupon" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.uses-per-coupon') }}&quot;" value="{{ old('uses_per_coupon') ?: $cartRule->uses_per_coupon }}"/>
<span class="control-error" v-if="errors.has('uses_per_coupon')">@{{ errors.first('uses_per_coupon') }}</span>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group" :class="[errors.has('usage_per_customer') ? 'has-error' : '']">
<label for="usage_per_customer">{{ __('admin::app.promotions.cart-rules.uses-per-customer') }}</label> <label for="usage_per_customer">{{ __('admin::app.promotions.cart-rules.uses-per-customer') }}</label>
<input class="control" id="usage_per_customer" name="usage_per_customer" value="{{ old('usage_per_customer') ?: $cartRule->usage_per_customer }}"/> <input v-validate="'numeric'" class="control" id="usage_per_customer" name="usage_per_customer" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.uses-per-customer') }}&quot;" value="{{ old('usage_per_customer') ?: $cartRule->usage_per_customer }}"/>
<span class="control-info">{{ __('admin::app.promotions.cart-rules.uses-per-customer-control-info') }}</span> <span class="control-info">{{ __('admin::app.promotions.cart-rules.uses-per-customer-control-info') }}</span>
<span class="control-error" v-if="errors.has('usage_per_customer')">@{{ errors.first('usage_per_customer') }}</span>
</div> </div>
<div class="control-group date"> <div class="control-group date">

View File

@ -218,8 +218,9 @@
</div> </div>
<div v-else> <div v-else>
<div class="control-group" v-if="matchedAttribute.type == 'text' || matchedAttribute.type == 'price' || matchedAttribute.type == 'decimal' || matchedAttribute.type == 'integer'"> <div class="control-group" :class="[errors.has('value') ? 'has-error' : '']" v-if="matchedAttribute.type == 'text' || matchedAttribute.type == 'price' || matchedAttribute.type == 'decimal' || matchedAttribute.type == 'integer'">
<input class="control" :name="['conditions[' + index + '][value]']" v-model="condition.value"/> <input v-validate="matchedAttribute.type == 'price' ? 'decimal:2' : '' || matchedAttribute.type == 'decimal' ? 'decimal:2' : '' || matchedAttribute.type == 'integer' ? 'decimal:2' : '' || matchedAttribute.type == 'text' ? 'alpha_num' : ''" class="control" :name="['conditions[' + index + '][value]']" v-model="condition.value" name="value"/>
<span class="control-error" v-if="errors.has('value')" v-text="errors.first('value')"></span>
</div> </div>
<div class="control-group date" v-if="matchedAttribute.type == 'date'"> <div class="control-group date" v-if="matchedAttribute.type == 'date'">

View File

@ -111,7 +111,10 @@
</div> </div>
</accordian> </accordian>
@if ($order->billing_address || $order->shipping_address) @if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true"> <accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body"> <div slot="body">
<div class="sale"> <div class="sale">

View File

@ -139,7 +139,10 @@
</div> </div>
</accordian> </accordian>
@if ($order->billing_address || $order->shipping_address) @if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true"> <accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body"> <div slot="body">
<div class="sale"> <div class="sale">

View File

@ -25,13 +25,19 @@
<div class="page-action"> <div class="page-action">
{!! view_render_event('sales.order.page_action.before', ['order' => $order]) !!} {!! view_render_event('sales.order.page_action.before', ['order' => $order]) !!}
@if ($order->canCancel() && bouncer()->hasPermission('sales.orders.cancel')) @if (
$order->canCancel()
&& bouncer()->hasPermission('sales.orders.cancel')
)
<a href="{{ route('admin.sales.orders.cancel', $order->id) }}" class="btn btn-lg btn-primary" v-alert:message="'{{ __('admin::app.sales.orders.cancel-confirm-msg') }}'"> <a href="{{ route('admin.sales.orders.cancel', $order->id) }}" class="btn btn-lg btn-primary" v-alert:message="'{{ __('admin::app.sales.orders.cancel-confirm-msg') }}'">
{{ __('admin::app.sales.orders.cancel-btn-title') }} {{ __('admin::app.sales.orders.cancel-btn-title') }}
</a> </a>
@endif @endif
@if ($order->canInvoice() && $order->payment->method !== 'paypal_standard') @if (
$order->canInvoice()
&& $order->payment->method !== 'paypal_standard'
)
<a href="{{ route('admin.sales.invoices.create', $order->id) }}" class="btn btn-lg btn-primary"> <a href="{{ route('admin.sales.invoices.create', $order->id) }}" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.orders.invoice-btn-title') }} {{ __('admin::app.sales.orders.invoice-btn-title') }}
</a> </a>
@ -139,7 +145,10 @@
{!! view_render_event('sales.order.customer_email.after', ['order' => $order]) !!} {!! view_render_event('sales.order.customer_email.after', ['order' => $order]) !!}
@if (! is_null($order->customer) && ! is_null($order->customer->group)) @if (
! is_null($order->customer)
&& ! is_null($order->customer->group)
)
<div class="row"> <div class="row">
<span class="title"> <span class="title">
{{ __('admin::app.customers.customers.customer_group') }} {{ __('admin::app.customers.customers.customer_group') }}
@ -159,7 +168,10 @@
</div> </div>
</accordian> </accordian>
@if ($order->billing_address || $order->shipping_address) @if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true"> <accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body"> <div slot="body">
<div class="sale"> <div class="sale">

View File

@ -110,7 +110,10 @@
</div> </div>
</accordian> </accordian>
@if ($order->billing_address || $order->shipping_address) @if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true"> <accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body"> <div slot="body">

View File

@ -107,7 +107,10 @@
</div> </div>
</accordian> </accordian>
@if ($order->billing_address || $order->shipping_address) @if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true"> <accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body"> <div slot="body">
<div class="sale"> <div class="sale">

View File

@ -1,241 +1,244 @@
@extends('admin::layouts.master') @extends('admin::layouts.master')
@section('page_title') @section('page_title')
{{ __('admin::app.sales.shipments.add-title') }} {{ __('admin::app.sales.shipments.add-title') }}
@stop @stop
@section('content-wrapper') @section('content-wrapper')
<div class="content full-page"> <div class="content full-page">
<form method="POST" action="{{ route('admin.sales.shipments.store', $order->id) }}" @submit.prevent="onSubmit"> <form method="POST" action="{{ route('admin.sales.shipments.store', $order->id) }}" @submit.prevent="onSubmit">
@csrf() @csrf()
<div class="page-header"> <div class="page-header">
<div class="page-title"> <div class="page-title">
<h1> <h1>
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.shipments.index') }}'"></i> <i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.shipments.index') }}'"></i>
{{ __('admin::app.sales.shipments.add-title') }} {{ __('admin::app.sales.shipments.add-title') }}
</h1> </h1>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.shipments.save-btn-title') }}
</button>
</div>
</div> </div>
<div class="page-content"> <div class="page-action">
<div class="sale-container"> <button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.shipments.save-btn-title') }}
<accordian title="{{ __('admin::app.sales.orders.order-and-account') }}" :active="true"> </button>
<div slot="body">
<div class="sale">
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.order-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.shipments.order-id') }}
</span>
<span class="value">
<a href="{{ route('admin.sales.orders.view', $order->id) }}">#{{ $order->increment_id }}</a>
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.order-date') }}
</span>
<span class="value">
{{ $order->created_at }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.order-status') }}
</span>
<span class="value">
{{ $order->status_label }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.channel') }}
</span>
<span class="value">
{{ $order->channel_name }}
</span>
</div>
</div>
</div>
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.account-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.customer-name') }}
</span>
<span class="value">
{{ $order->customer_full_name }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.email') }}
</span>
<span class="value">
{{ $order->customer_email }}
</span>
</div>
</div>
</div>
</div>
</div>
</accordian>
@if ($order->billing_address || $order->shipping_address)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body">
<div class="sale">
@if ($order->billing_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.billing-address') }}</span>
</div>
<div class="section-content">
@include ('admin::sales.address', ['address' => $order->billing_address])
</div>
</div>
@endif
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>
</div>
<div class="section-content">
@include ('admin::sales.address', ['address' => $order->shipping_address])
</div>
</div>
@endif
</div>
</div>
</accordian>
@endif
<accordian title="{{ __('admin::app.sales.orders.payment-and-shipping') }}" :active="true">
<div slot="body">
<div class="sale">
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.payment-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.payment-method') }}
</span>
<span class="value">
{{ core()->getConfigData('sales.paymentmethods.' . $order->payment->method . '.title') }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.currency') }}
</span>
<span class="value">
{{ $order->order_currency_code }}
</span>
</div>
</div>
</div>
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.shipping-method') }}
</span>
<span class="value">
{{ $order->shipping_title }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.shipping-price') }}
</span>
<span class="value">
{{ core()->formatBasePrice($order->base_shipping_amount) }}
</span>
</div>
<div class="control-group" style="margin-top: 40px">
<label for="shipment[carrier_title]">{{ __('admin::app.sales.shipments.carrier-title') }}</label>
<input type="text" class="control" id="shipment[carrier_title]" name="shipment[carrier_title]"/>
</div>
<div class="control-group">
<label for="shipment[track_number]">{{ __('admin::app.sales.shipments.tracking-number') }}</label>
<input type="text" class="control" id="shipment[track_number]" name="shipment[track_number]"/>
</div>
</div>
</div>
</div>
</div>
</accordian>
<accordian title="{{ __('admin::app.sales.orders.products-ordered') }}" :active="true">
<div slot="body">
<order-item-list></order-item-list>
</div>
</accordian>
</div>
</div> </div>
</form> </div>
</div>
<div class="page-content">
<div class="sale-container">
<accordian title="{{ __('admin::app.sales.orders.order-and-account') }}" :active="true">
<div slot="body">
<div class="sale">
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.order-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.shipments.order-id') }}
</span>
<span class="value">
<a href="{{ route('admin.sales.orders.view', $order->id) }}">#{{ $order->increment_id }}</a>
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.order-date') }}
</span>
<span class="value">
{{ $order->created_at }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.order-status') }}
</span>
<span class="value">
{{ $order->status_label }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.channel') }}
</span>
<span class="value">
{{ $order->channel_name }}
</span>
</div>
</div>
</div>
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.account-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.customer-name') }}
</span>
<span class="value">
{{ $order->customer_full_name }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.email') }}
</span>
<span class="value">
{{ $order->customer_email }}
</span>
</div>
</div>
</div>
</div>
</div>
</accordian>
@if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body">
<div class="sale">
@if ($order->billing_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.billing-address') }}</span>
</div>
<div class="section-content">
@include ('admin::sales.address', ['address' => $order->billing_address])
</div>
</div>
@endif
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>
</div>
<div class="section-content">
@include ('admin::sales.address', ['address' => $order->shipping_address])
</div>
</div>
@endif
</div>
</div>
</accordian>
@endif
<accordian title="{{ __('admin::app.sales.orders.payment-and-shipping') }}" :active="true">
<div slot="body">
<div class="sale">
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.payment-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.payment-method') }}
</span>
<span class="value">
{{ core()->getConfigData('sales.paymentmethods.' . $order->payment->method . '.title') }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.currency') }}
</span>
<span class="value">
{{ $order->order_currency_code }}
</span>
</div>
</div>
</div>
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-info') }}</span>
</div>
<div class="section-content">
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.shipping-method') }}
</span>
<span class="value">
{{ $order->shipping_title }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('admin::app.sales.orders.shipping-price') }}
</span>
<span class="value">
{{ core()->formatBasePrice($order->base_shipping_amount) }}
</span>
</div>
<div class="control-group" style="margin-top: 40px">
<label for="shipment[carrier_title]">{{ __('admin::app.sales.shipments.carrier-title') }}</label>
<input type="text" class="control" id="shipment[carrier_title]" name="shipment[carrier_title]" />
</div>
<div class="control-group">
<label for="shipment[track_number]">{{ __('admin::app.sales.shipments.tracking-number') }}</label>
<input type="text" class="control" id="shipment[track_number]" name="shipment[track_number]" />
</div>
</div>
</div>
</div>
</div>
</accordian>
<accordian title="{{ __('admin::app.sales.orders.products-ordered') }}" :active="true">
<div slot="body">
<order-item-list></order-item-list>
</div>
</accordian>
</div>
</div>
</form>
</div>
@stop @stop
@push('scripts') @push('scripts')
<script type="text/x-template" id="order-item-list-template"> <script type="text/x-template" id="order-item-list-template">
<div> <div>
<div class="control-group" :class="[errors.has('shipment[source]') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('shipment[source]') ? 'has-error' : '']">
<label for="shipment[source]" class="required">{{ __('admin::app.sales.shipments.source') }}</label> <label for="shipment[source]" class="required">{{ __('admin::app.sales.shipments.source') }}</label>
@ -270,7 +273,10 @@
<tbody> <tbody>
@foreach ($order->items as $item) @foreach ($order->items as $item)
@if ($item->qty_to_ship > 0 && $item->product) @if (
$item->qty_to_ship > 0
&& $item->product
)
<tr> <tr>
<td>{{ $item->getTypeInstance()->getOrderedItem($item)->sku }}</td> <td>{{ $item->getTypeInstance()->getOrderedItem($item)->sku }}</td>
<td> <td>
@ -324,7 +330,7 @@
<div class="control-group" :class="[errors.has('{{ $inputName }}') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('{{ $inputName }}') ? 'has-error' : '']">
<input type="text" v-validate="'required|numeric|min_value:0|max_value:{{$sourceQty}}'" class="control" id="{{ $inputName }}" name="{{ $inputName }}" value="{{ $item->qty_to_ship }}" data-vv-as="&quot;{{ __('admin::app.sales.shipments.qty-to-ship') }}&quot;" :disabled="source != '{{ $inventorySource->id }}'"/> <input type="text" v-validate="'required|numeric|min_value:0|max_value:{{$item->qty_ordered}}'" class="control" id="{{ $inputName }}" name="{{ $inputName }}" value="{{ $item->qty_to_ship }}" data-vv-as="&quot;{{ __('admin::app.sales.shipments.qty-to-ship') }}&quot;" :disabled="source != '{{ $inventorySource->id }}'"/>
<span class="control-error" v-if="errors.has('{{ $inputName }}')"> <span class="control-error" v-if="errors.has('{{ $inputName }}')">
@verbatim @verbatim
@ -349,19 +355,19 @@
</div> </div>
</script> </script>
<script> <script>
Vue.component('order-item-list', { Vue.component('order-item-list', {
template: '#order-item-list-template', template: '#order-item-list-template',
inject: ['$validator'], inject: ['$validator'],
data: function() { data: function() {
return { return {
source: "" source: ""
}
} }
}); }
</script> });
</script>
@endpush @endpush

View File

@ -106,7 +106,10 @@
</div> </div>
</accordian> </accordian>
@if ($order->billing_address || $order->shipping_address) @if (
$order->billing_address
|| $order->shipping_address
)
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true"> <accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
<div slot="body"> <div slot="body">
<div class="sale"> <div class="sale">
@ -199,7 +202,10 @@
</span> </span>
</div> </div>
@if ($shipment->inventory_source || $shipment->inventory_source_name) @if (
$shipment->inventory_source
|| $shipment->inventory_source_name
)
<div class="row"> <div class="row">
<span class="title"> <span class="title">
{{ __('admin::app.sales.shipments.inventory-source') }} {{ __('admin::app.sales.shipments.inventory-source') }}

View File

@ -66,7 +66,10 @@
<div class="control-group"> <div class="control-group">
<label>{{ __('velocity::app.admin.general.locale_logo') }}</label> <label>{{ __('velocity::app.admin.general.locale_logo') }}</label>
@if (isset($locale) && $locale->locale_image) @if (
isset($locale)
&& $locale->locale_image
)
<image-wrapper <image-wrapper
input-name="locale_image" input-name="locale_image"
:multiple="false" :multiple="false"

View File

@ -89,7 +89,7 @@ Route::group(['middleware' => ['web', 'admin'], 'prefix' => config('app.admin_ur
])->name('admin.sales.refunds.create'); ])->name('admin.sales.refunds.create');
Route::post('/refunds/create/{order_id}', [RefundController::class, 'store'])->defaults('_config', [ Route::post('/refunds/create/{order_id}', [RefundController::class, 'store'])->defaults('_config', [
'redirect' => 'admin.sales.orders.view', 'redirect' => 'admin.sales.refunds.index',
])->name('admin.sales.refunds.store'); ])->name('admin.sales.refunds.store');
Route::post('/refunds/update-qty/{order_id}', [RefundController::class, 'updateQty'])->defaults('_config', [ Route::post('/refunds/update-qty/{order_id}', [RefundController::class, 'updateQty'])->defaults('_config', [

View File

@ -87,7 +87,11 @@ class ProductCategoryUniqueSlug implements Rule
*/ */
protected function isSlugExistsInCategories($slug) protected function isSlugExistsInCategories($slug)
{ {
if ($this->tableName && $this->id && $this->tableName === 'category_translations') { if (
$this->tableName
&& $this->id
&& $this->tableName === 'category_translations'
) {
return CategoryTranslationProxy::modelClass()::where('category_id', '<>', $this->id) return CategoryTranslationProxy::modelClass()::where('category_id', '<>', $this->id)
->where('slug', $slug) ->where('slug', $slug)
->limit(1) ->limit(1)
@ -109,7 +113,11 @@ class ProductCategoryUniqueSlug implements Rule
*/ */
protected function isSlugExistsInProducts($slug) protected function isSlugExistsInProducts($slug)
{ {
if ($this->tableName && $this->id && $this->tableName === 'product_flat') { if (
$this->tableName
&& $this->id
&& $this->tableName === 'product_flat'
) {
return ProductFlatProxy::modelClass()::where('product_id', '<>', $this->id) return ProductFlatProxy::modelClass()::where('product_id', '<>', $this->id)
->where('url_key', $slug) ->where('url_key', $slug)
->limit(1) ->limit(1)

View File

@ -37,7 +37,10 @@ class AttributeOption extends TranslatableModel implements AttributeOptionContra
*/ */
public function swatch_value_url() public function swatch_value_url()
{ {
if ($this->swatch_value && $this->attribute->swatch_type == 'image') { if (
$this->swatch_value
&& $this->attribute->swatch_type == 'image'
) {
return url('cache/small/' . $this->swatch_value); return url('cache/small/' . $this->swatch_value);
} }

View File

@ -152,7 +152,10 @@ class AttributeFamilyRepository extends Repository
$trimmed = []; $trimmed = [];
foreach ($attributeFamilies as $key => $attributeFamily) { foreach ($attributeFamilies as $key => $attributeFamily) {
if ($attributeFamily->name != null || $attributeFamily->name != "") { if (
$attributeFamily->name != null
|| $attributeFamily->name != ""
) {
$trimmed[$key] = [ $trimmed[$key] = [
'id' => $attributeFamily->id, 'id' => $attributeFamily->id,
'code' => $attributeFamily->code, 'code' => $attributeFamily->code,

View File

@ -52,7 +52,10 @@ class AttributeOptionRepository extends Repository
*/ */
public function uploadSwatchImage($data, $optionId) public function uploadSwatchImage($data, $optionId)
{ {
if (! isset($data['swatch_value']) || ! $data['swatch_value']) { if (
! isset($data['swatch_value'])
|| ! $data['swatch_value']
) {
return; return;
} }

View File

@ -51,7 +51,10 @@ class AttributeRepository extends Repository
$attribute = $this->model->create($data); $attribute = $this->model->create($data);
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox']) && count($options)) { if (
in_array($attribute->type, ['select', 'multiselect', 'checkbox'])
&& count($options)
) {
foreach ($options as $optionInputs) { foreach ($options as $optionInputs) {
$this->attributeOptionRepository->create(array_merge([ $this->attributeOptionRepository->create(array_merge([
'attribute_id' => $attribute->id, 'attribute_id' => $attribute->id,
@ -169,7 +172,10 @@ class AttributeRepository extends Repository
{ {
$attributeColumns = ['id', 'code', 'value_per_channel', 'value_per_locale', 'type', 'is_filterable']; $attributeColumns = ['id', 'code', 'value_per_channel', 'value_per_locale', 'type', 'is_filterable'];
if (! is_array($codes) && ! $codes) if (
! is_array($codes)
&& ! $codes
)
return $this->findWhereIn('code', [ return $this->findWhereIn('code', [
'name', 'name',
'description', 'description',
@ -206,6 +212,23 @@ class AttributeRepository extends Repository
return $attributes[$code] = $this->findOneByField('code', $code); return $attributes[$code] = $this->findOneByField('code', $code);
} }
/**
* Get attribute by id.
*
* @param integer $id
* @return \Webkul\Attribute\Contracts\Attribute
*/
public function getAttributeById($id)
{
static $attributes = [];
if (array_key_exists($id, $attributes)) {
return $attributes[$id];
}
return $attributes[$id] = $this->find($id);
}
/** /**
* Get family attributes. * Get family attributes.
* *

File diff suppressed because one or more lines are too long

View File

@ -173,7 +173,10 @@ class Booking
$date = clone $currentTime; $date = clone $currentTime;
$date->addDays($i); $date->addDays($i);
if ($date >= $availableFrom && $date <= $availableTo) { if (
$date >= $availableFrom
&& $date <= $availableTo
) {
$days[$i] = $date->format('l'); $days[$i] = $date->format('l');
} }
} }
@ -235,7 +238,10 @@ class Booking
{ {
$bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id); $bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id);
if (! is_array($bookingProductSlot->slots) || ! count($bookingProductSlot->slots)) { if (
! is_array($bookingProductSlot->slots)
|| ! count($bookingProductSlot->slots)
) {
return []; return [];
} }
@ -255,7 +261,8 @@ class Booking
? $bookingProductSlot->slots ? $bookingProductSlot->slots
: ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []); : ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []);
if ($requestedDate < $availableFrom if (
$requestedDate < $availableFrom
|| $requestedDate > $availableTo || $requestedDate > $availableTo
) { ) {
return []; return [];
@ -289,17 +296,32 @@ class Booking
$to = clone $tempStartDayTime; $to = clone $tempStartDayTime;
if (($startDayTime <= $from && $from <= $availableTo) if (
&& ($availableTo >= $to && $to >= $startDayTime) ($startDayTime <= $from
&& ($startDayTime <= $from && $from <= $endDayTime) && $from <= $availableTo
&& ($endDayTime >= $to && $to >= $startDayTime) )
&& (
$availableTo >= $to
&& $to >= $startDayTime
)
&& (
$startDayTime <= $from
&& $from <= $endDayTime
)
&& (
$endDayTime >= $to
&& $to >= $startDayTime
)
) { ) {
// Get already ordered qty for this slot // Get already ordered qty for this slot
$orderedQty = 0; $orderedQty = 0;
$qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1; $qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1;
if ($qty && $currentTime <= $from) { if (
$qty
&& $currentTime <= $from
) {
$slots[] = [ $slots[] = [
'from' => $from->format('h:i A'), 'from' => $from->format('h:i A'),
'to' => $to->format('h:i A'), 'to' => $to->format('h:i A'),
@ -324,7 +346,10 @@ class Booking
{ {
$bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartItem['product_id']); $bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartItem['product_id']);
if ($bookingProduct->qty - $this->getBookedQuantity($cartItem) < $cartItem['quantity'] || $this->isSlotExpired($cartItem)) { if (
$bookingProduct->qty - $this->getBookedQuantity($cartItem) < $cartItem['quantity']
|| $this->isSlotExpired($cartItem)
) {
return false; return false;
} }

View File

@ -22,7 +22,10 @@ class DefaultSlot extends Booking
{ {
$bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id); $bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id);
if (! is_array($bookingProductSlot->slots) || ! count($bookingProductSlot->slots)) { if (
! is_array($bookingProductSlot->slots)
|| ! count($bookingProductSlot->slots)
) {
return []; return [];
} }
@ -38,7 +41,8 @@ class DefaultSlot extends Booking
? Carbon::createFromTimeString($bookingProduct->available_to) ? Carbon::createFromTimeString($bookingProduct->available_to)
: Carbon::createFromTimeString('2080-01-01 00:00:00'); : Carbon::createFromTimeString('2080-01-01 00:00:00');
if ($requestedDate < $availableFrom if (
$requestedDate < $availableFrom
|| $requestedDate > $availableTo || $requestedDate > $availableTo
) { ) {
return []; return [];
@ -110,7 +114,10 @@ class DefaultSlot extends Booking
$timeDuration = $bookingProductSlot->slots[$requestedDate->format('w')] ?? []; $timeDuration = $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
if (! count($timeDuration) || ! $timeDuration['status']) { if (
! count($timeDuration)
|| ! $timeDuration['status']
) {
return []; return [];
} }
@ -141,17 +148,33 @@ class DefaultSlot extends Booking
$to = clone $tempStartDayTime; $to = clone $tempStartDayTime;
if (($startDayTime <= $from && $from <= $availableTo) if (
&& ($availableTo >= $to && $to >= $startDayTime) (
&& ($startDayTime <= $from && $from <= $endDayTime) $startDayTime <= $from
&& ($endDayTime >= $to && $to >= $startDayTime) && $from <= $availableTo
)
&& (
$availableTo >= $to
&& $to >= $startDayTime
)
&& (
$startDayTime <= $from
&& $from <= $endDayTime
)
&& (
$endDayTime >= $to
&& $to >= $startDayTime
)
) { ) {
// Get already ordered qty for this slot // Get already ordered qty for this slot
$orderedQty = 0; $orderedQty = 0;
$qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1; $qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1;
if ($qty && $currentTime <= $from) { if (
$qty
&& $currentTime <= $from
) {
$slots[] = [ $slots[] = [
'from' => $from->format('h:i A'), 'from' => $from->format('h:i A'),
'to' => $to->format('h:i A'), 'to' => $to->format('h:i A'),

View File

@ -21,7 +21,10 @@ class RentalSlot extends Booking
{ {
$bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id); $bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id);
if (! is_array($bookingProductSlot->slots) || ! count($bookingProductSlot->slots)) { if (
! is_array($bookingProductSlot->slots)
|| ! count($bookingProductSlot->slots)
) {
return []; return [];
} }
@ -41,7 +44,8 @@ class RentalSlot extends Booking
? $bookingProductSlot->slots ? $bookingProductSlot->slots
: $bookingProductSlot->slots[$requestedDate->format('w')] ?? []; : $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
if ($requestedDate < $availableFrom if (
$requestedDate < $availableFrom
|| $requestedDate > $availableTo || $requestedDate > $availableTo
) { ) {
return []; return [];
@ -66,17 +70,33 @@ class RentalSlot extends Booking
$to = clone $tempStartDayTime; $to = clone $tempStartDayTime;
if (($startDayTime <= $from && $from <= $availableTo) if (
&& ($availableTo >= $to && $to >= $startDayTime) (
&& ($startDayTime <= $from && $from <= $endDayTime) $startDayTime <= $from
&& ($endDayTime >= $to && $to >= $startDayTime) && $from <= $availableTo
)
&& (
$availableTo >= $to
&& $to >= $startDayTime
)
&& (
$startDayTime <= $from
&& $from <= $endDayTime
)
&& (
$endDayTime >= $to
&& $to >= $startDayTime
)
) { ) {
// Get already ordered qty for this slot // Get already ordered qty for this slot
$orderedQty = 0; $orderedQty = 0;
$qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1; $qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1;
if ($qty && $currentTime <= $from) { if (
$qty
&& $currentTime <= $from
) {
if (! isset($slots[$index])) { if (! isset($slots[$index])) {
$slots[$index]['time'] = $startDayTime->format('h:i A') . ' - ' . $endDayTime->format('h:i A'); $slots[$index]['time'] = $startDayTime->format('h:i A') . ' - ' . $endDayTime->format('h:i A');
} }
@ -174,7 +194,8 @@ class RentalSlot extends Booking
? Carbon::createFromTimeString($bookingProduct->available_to->format('Y-m-d') . ' 23:59:59') ? Carbon::createFromTimeString($bookingProduct->available_to->format('Y-m-d') . ' 23:59:59')
: Carbon::createFromTimeString('2080-01-01 00:00:00'); : Carbon::createFromTimeString('2080-01-01 00:00:00');
if ($requestedFromDate < $availableFrom if (
$requestedFromDate < $availableFrom
|| $requestedFromDate > $availableTo || $requestedFromDate > $availableTo
|| $requestedToDate < $availableFrom || $requestedToDate < $availableFrom
|| $requestedToDate > $availableTo || $requestedToDate > $availableTo
@ -242,7 +263,8 @@ class RentalSlot extends Booking
$rentingType = $item->additional['booking']['renting_type'] ?? $bookingProduct->rental_slot->renting_type; $rentingType = $item->additional['booking']['renting_type'] ?? $bookingProduct->rental_slot->renting_type;
if ($rentingType == 'daily') { if ($rentingType == 'daily') {
if (! isset($item->additional['booking']['date_from']) if (
! isset($item->additional['booking']['date_from'])
|| ! isset($item->additional['booking']['date_to']) || ! isset($item->additional['booking']['date_to'])
) { ) {
$result->itemIsInactive(); $result->itemIsInactive();
@ -255,7 +277,8 @@ class RentalSlot extends Booking
$price += $bookingProduct->rental_slot->daily_price * $to->diffInDays($from); $price += $bookingProduct->rental_slot->daily_price * $to->diffInDays($from);
} else { } else {
if (! isset($item->additional['booking']['slot']['from']) if (
! isset($item->additional['booking']['slot']['from'])
|| ! isset($item->additional['booking']['slot']['to']) || ! isset($item->additional['booking']['slot']['to'])
) { ) {
$result->itemIsInactive(); $result->itemIsInactive();

View File

@ -22,7 +22,10 @@ class TableSlot extends Booking
$bookedQty *= $bookingProduct->table_slot->guest_limit; $bookedQty *= $bookingProduct->table_slot->guest_limit;
} }
if ($bookingProduct->qty - $bookedQty < $requestedQty || $this->isSlotExpired($cartItem)) { if (
$bookingProduct->qty - $bookedQty < $requestedQty
|| $this->isSlotExpired($cartItem)
) {
return false; return false;
} }

View File

@ -115,7 +115,10 @@ class BookingProductRepository extends Repository
*/ */
public function formatSlots($data) public function formatSlots($data)
{ {
if (isset($data['same_slot_all_days']) && ! $data['same_slot_all_days']) { if (
isset($data['same_slot_all_days'])
&& ! $data['same_slot_all_days']
) {
for ($i = 0; $i < 7; $i++) { for ($i = 0; $i < 7; $i++) {
if (! isset($data['slots'][$i])) { if (! isset($data['slots'][$i])) {
$data['slots'][$i] = []; $data['slots'][$i] = [];
@ -183,8 +186,15 @@ class BookingProductRepository extends Repository
$isOverLapping = false; $isOverLapping = false;
foreach ($tempSlots as $slot) { foreach ($tempSlots as $slot) {
if (($slot['from'] <= $from && $slot['to'] >= $from) if (
|| ($slot['from'] <= $to && $slot['to'] >= $to) (
$slot['from'] <= $from
&& $slot['to'] >= $from
)
|| (
$slot['from'] <= $to
&& $slot['to'] >= $to
)
) { ) {
$isOverLapping = true; $isOverLapping = true;

View File

@ -37,7 +37,10 @@ class BookingRepository extends Repository
$from = $to = null; $from = $to = null;
if (isset($item->additional['booking']['slot'])) { if (isset($item->additional['booking']['slot'])) {
if (isset($item->additional['booking']['slot']['from']) && isset($item->additional['booking']['slot']['to'])) { if (
isset($item->additional['booking']['slot']['from'])
&& isset($item->additional['booking']['slot']['to'])
) {
$from = $item->additional['booking']['slot']['from']; $from = $item->additional['booking']['slot']['from'];
$to = $item->additional['booking']['slot']['to']; $to = $item->additional['booking']['slot']['to'];
@ -48,7 +51,10 @@ class BookingRepository extends Repository
$to = end($timestamps); $to = end($timestamps);
} }
} elseif (isset($item->additional['booking']['date_from']) && isset($item->additional['booking']['date_to'])) { } elseif (
isset($item->additional['booking']['date_from'])
&& isset($item->additional['booking']['date_to'])
) {
$from = Carbon::createFromTimeString($item->additional['booking']['date_from'] . ' 00:00:00')->getTimestamp(); $from = Carbon::createFromTimeString($item->additional['booking']['date_from'] . ' 00:00:00')->getTimestamp();
$to = Carbon::createFromTimeString($item->additional['booking']['date_to'] . ' 23:59:59')->getTimestamp(); $to = Carbon::createFromTimeString($item->additional['booking']['date_to'] . ' 23:59:59')->getTimestamp();

View File

@ -118,6 +118,17 @@
width: 100%; width: 100%;
float: left; float: left;
span {
position: relative;
.icon {
position: absolute;
right: 30px;
top: 10px !important;
}
}
.control-group:not(.quantity), .form-group:not(.quantity) { .control-group:not(.quantity), .form-group:not(.quantity) {
width: 50%; width: 50%;
float: left; float: left;
@ -259,3 +270,14 @@
} }
} }
} }
body {
&.rtl {
.booking-information {
.cross-icon {
left: 80px !important;
right: inherit !important;
}
}
}
}

View File

@ -241,8 +241,9 @@
if (this.default_booking.booking_type == 'one') { if (this.default_booking.booking_type == 'one') {
this.slots['one'] = this.default_booking.slots ? this.default_booking.slots : []; this.slots['one'] = this.default_booking.slots ? this.default_booking.slots : [];
} else { } else {
if (this.default_booking.slots) if (this.default_booking.slots) {
this.slots['many'] = this.default_booking.slots; this.slots['many'] = this.default_booking.slots;
}
} }
}, },

View File

@ -170,8 +170,9 @@
computed: { computed: {
controlName: function () { controlName: function () {
if (this.ticketItem.id) if (this.ticketItem.id) {
return 'booking[tickets][' + this.ticketItem.id + ']'; return 'booking[tickets][' + this.ticketItem.id + ']';
}
return 'booking[tickets][ticket_' + this.index + ']'; return 'booking[tickets][ticket_' + this.index + ']';
} }

View File

@ -136,8 +136,9 @@
}, },
created: function() { created: function() {
if (! bookingProduct || ! bookingProduct[this.bookingType].slots || ! bookingProduct[this.bookingType].slots) if (! bookingProduct || ! bookingProduct[this.bookingType].slots || ! bookingProduct[this.bookingType].slots) {
return; return;
}
if (bookingProduct[this.bookingType].same_slot_all_days) { if (bookingProduct[this.bookingType].same_slot_all_days) {
this.slots['same_for_week'] = bookingProduct[this.bookingType].slots; this.slots['same_for_week'] = bookingProduct[this.bookingType].slots;
@ -149,8 +150,9 @@
methods: { methods: {
addSlot: function (dayIndex = null) { addSlot: function (dayIndex = null) {
if (dayIndex !== null) { if (dayIndex !== null) {
if (this.slots['different_for_week'][dayIndex] == undefined) if (this.slots['different_for_week'][dayIndex] == undefined) {
this.slots['different_for_week'][dayIndex] = []; this.slots['different_for_week'][dayIndex] = [];
}
var slot = { var slot = {
'from': '', 'from': '',

View File

@ -36,7 +36,10 @@
<td>{{ $day['name'] }}</td> <td>{{ $day['name'] }}</td>
<td> <td>
@if ($day['slots'] && count($day['slots'])) @if (
$day['slots']
&& count($day['slots'])
)
@foreach ($day['slots'] as $slot) @foreach ($day['slots'] as $slot)
{{ $slot['from'] . ' - ' . $slot['to'] }}</br> {{ $slot['from'] . ' - ' . $slot['to'] }}</br>
@endforeach @endforeach

View File

@ -36,7 +36,10 @@
<td>{{ $day['name'] }}</td> <td>{{ $day['name'] }}</td>
<td> <td>
@if ($day['slots'] && count($day['slots'])) @if (
$day['slots']
&& count($day['slots'])
)
@foreach ($day['slots'] as $slot) @foreach ($day['slots'] as $slot)
{{ $slot['from'] . ' - ' . $slot['to'] }}</br> {{ $slot['from'] . ' - ' . $slot['to'] }}</br>
@endforeach @endforeach

View File

@ -36,7 +36,10 @@
<td>{{ $day['name'] }}</td> <td>{{ $day['name'] }}</td>
<td> <td>
@if ($day['slots'] && count($day['slots'])) @if (
$day['slots']
&& count($day['slots'])
)
@foreach ($day['slots'] as $slot) @foreach ($day['slots'] as $slot)
{{ $slot['from'] . ' - ' . $slot['to'] }}</br> {{ $slot['from'] . ' - ' . $slot['to'] }}</br>
@endforeach @endforeach

View File

@ -161,7 +161,10 @@ class Booking extends Virtual
*/ */
public function prepareForCart($data) public function prepareForCart($data)
{ {
if (! isset($data['booking']) || ! count($data['booking'])) { if (
! isset($data['booking'])
|| ! count($data['booking'])
) {
return trans('shop::app.checkout.cart.integrity.missing_options'); return trans('shop::app.checkout.cart.integrity.missing_options');
} }
@ -170,7 +173,10 @@ class Booking extends Virtual
$bookingProduct = $this->getBookingProduct($data['product_id']); $bookingProduct = $this->getBookingProduct($data['product_id']);
if ($bookingProduct->type == 'event') { if ($bookingProduct->type == 'event') {
if (Carbon::now() > $bookingProduct->available_from && Carbon::now() > $bookingProduct->available_to) { if (
Carbon::now() > $bookingProduct->available_from
&& Carbon::now() > $bookingProduct->available_to
) {
return trans('shop::app.checkout.cart.event.expired'); return trans('shop::app.checkout.cart.event.expired');
} }
@ -225,10 +231,12 @@ class Booking extends Virtual
return false; return false;
} }
if (isset($options1['booking'], $options2['booking']) if (
isset($options1['booking'], $options2['booking'])
&& isset($options1['booking']['ticket_id'], $options2['booking']['ticket_id']) && isset($options1['booking']['ticket_id'], $options2['booking']['ticket_id'])
&& $options1['booking']['ticket_id'] === $options2['booking']['ticket_id']) { && $options1['booking']['ticket_id'] === $options2['booking']['ticket_id']
return true; ) {
return true;
} }
return false; return false;

View File

@ -46,20 +46,24 @@ class CartRule
/** /**
* Collect discount on cart * Collect discount on cart
* *
* @param \Webkul\Checkout\Contracts\Cart $cart
* @return void * @return void
*/ */
public function collect() public function collect($cart)
{ {
$cart = Cart::getCart();
$appliedCartRuleIds = []; $appliedCartRuleIds = [];
$this->calculateCartItemTotals($cart->items); $this->calculateCartItemTotals($cart, $cart->items);
foreach ($cart->items as $item) { foreach ($cart->items as $item) {
$itemCartRuleIds = $this->process($item); $itemCartRuleIds = $this->process($cart, $item);
$appliedCartRuleIds = array_merge($appliedCartRuleIds, $itemCartRuleIds); $appliedCartRuleIds = array_merge($appliedCartRuleIds, $itemCartRuleIds);
if ($item->children()->count() && $item->product->getTypeInstance()->isChildrenCalculated()) { if (
$item->children()->count()
&& $item->product->getTypeInstance()->isChildrenCalculated()
) {
$this->divideDiscount($item); $this->divideDiscount($item);
} }
} }
@ -72,7 +76,7 @@ class CartRule
$this->processFreeShippingDiscount($cart); $this->processFreeShippingDiscount($cart);
if (! $this->checkCouponCode()) { if (! $this->checkCouponCode($cart)) {
cart()->removeCouponCode(); cart()->removeCouponCode();
} }
} }
@ -80,20 +84,24 @@ class CartRule
/** /**
* Returns cart rules * Returns cart rules
* *
* @param \Webkul\Checkout\Contracts\Cart $cart
* @return \Illuminate\Support\Collection * @return \Illuminate\Support\Collection
*/ */
public function getCartRules() public function getCartRules($cart)
{ {
$staticCartRules = new class() { $staticCartRules = new class() {
public static $cartRules; public static $cartRules;
public static $cartID; public static $cartID;
}; };
if ($staticCartRules::$cartID === cart()->getCart()->id && $staticCartRules::$cartRules) { if (
$staticCartRules::$cartID === $cart->id
&& $staticCartRules::$cartRules
) {
return $staticCartRules::$cartRules; return $staticCartRules::$cartRules;
} }
$staticCartRules::$cartID = cart()->getCart()->id; $staticCartRules::$cartID = $cart->id;
$customerGroupId = null; $customerGroupId = null;
@ -110,15 +118,15 @@ class CartRule
$cartRules = $this->getCartRuleQuery($customerGroupId, core()->getCurrentChannel()->id); $cartRules = $this->getCartRuleQuery($customerGroupId, core()->getCurrentChannel()->id);
$staticCartRules::$cartRules = $cartRules; $staticCartRules::$cartRules = $cartRules;
return $cartRules; return $cartRules;
} }
/** /**
* Check if cart rule can be applied * Check if cart rule can be applied
* *
* @param $cart * @param \Webkul\Checkout\Contracts\Cart $cart
* @param \Webkul\CartRule\Contracts\CartRule $rule * @param \Webkul\CartRule\Contracts\CartRule $rule
*
* @return bool * @return bool
*/ */
public function canProcessRule($cart, $rule): bool public function canProcessRule($cart, $rule): bool
@ -130,18 +138,30 @@ class CartRule
// reasons (cart_rule_coupon-relation is pre-loaded by self::getCartRuleQuery()) // reasons (cart_rule_coupon-relation is pre-loaded by self::getCartRuleQuery())
$coupon = $rule->cart_rule_coupon()->where('code', $cart->coupon_code)->first(); $coupon = $rule->cart_rule_coupon()->where('code', $cart->coupon_code)->first();
if ($coupon && $coupon->code === $cart->coupon_code) { if (
if ($coupon->usage_limit && $coupon->times_used >= $coupon->usage_limit) { $coupon
&& $coupon->code === $cart->coupon_code
) {
if (
$coupon->usage_limit
&& $coupon->times_used >= $coupon->usage_limit
) {
return false; return false;
} }
if ($cart->customer_id && $coupon->usage_per_customer) { if (
$cart->customer_id
&& $coupon->usage_per_customer
) {
$couponUsage = $this->cartRuleCouponUsageRepository->findOneWhere([ $couponUsage = $this->cartRuleCouponUsageRepository->findOneWhere([
'cart_rule_coupon_id' => $coupon->id, 'cart_rule_coupon_id' => $coupon->id,
'customer_id' => $cart->customer_id, 'customer_id' => $cart->customer_id,
]); ]);
if ($couponUsage && $couponUsage->times_used >= $coupon->usage_per_customer) { if (
$couponUsage
&& $couponUsage->times_used >= $coupon->usage_per_customer
) {
return false; return false;
} }
} }
@ -159,7 +179,10 @@ class CartRule
'customer_id' => $cart->customer_id, 'customer_id' => $cart->customer_id,
]); ]);
if ($ruleCustomer && $ruleCustomer->times_used >= $rule->usage_per_customer) { if (
$ruleCustomer
&& $ruleCustomer->times_used >= $rule->usage_per_customer
) {
return false; return false;
} }
} }
@ -170,10 +193,11 @@ class CartRule
/** /**
* Cart item discount calculation process * Cart item discount calculation process
* *
* @param \Webkul\Checkout\Models\CartItem $item * @param \Webkul\Checkout\Contracts\Cart $cart
* @param \Webkul\Checkout\Models\CartItem $item
* @return array * @return array
*/ */
public function process(CartItem $item): array public function process($cart, CartItem $item): array
{ {
$item->discount_percent = 0; $item->discount_percent = 0;
$item->discount_amount = 0; $item->discount_amount = 0;
@ -181,9 +205,7 @@ class CartRule
$appliedRuleIds = []; $appliedRuleIds = [];
$cart = Cart::getCart(); foreach ($rules = $this->getCartRules($cart) as $rule) {
foreach ($rules = $this->getCartRules() as $rule) {
if (! $this->canProcessRule($cart, $rule)) { if (! $this->canProcessRule($cart, $rule)) {
continue; continue;
} }
@ -208,7 +230,10 @@ class CartRule
$baseDiscountAmount = ($quantity * $item->base_price + $item->base_tax_amount - $item->base_discount_amount) * ($rulePercent / 100); $baseDiscountAmount = ($quantity * $item->base_price + $item->base_tax_amount - $item->base_discount_amount) * ($rulePercent / 100);
if (! $rule->discount_quantity || $rule->discount_quantity > $quantity) { if (
! $rule->discount_quantity
|| $rule->discount_quantity > $quantity
) {
$discountPercent = min(100, $item->discount_percent + $rulePercent); $discountPercent = min(100, $item->discount_percent + $rulePercent);
$item->discount_percent = $discountPercent; $item->discount_percent = $discountPercent;
@ -241,7 +266,10 @@ class CartRule
break; break;
case 'buy_x_get_y': case 'buy_x_get_y':
if (! $rule->discount_step || $rule->discount_amount > $rule->discount_step) { if (
! $rule->discount_step
|| $rule->discount_amount > $rule->discount_step
) {
break; break;
} }
@ -304,9 +332,7 @@ class CartRule
$appliedRuleIds = []; $appliedRuleIds = [];
$cart = Cart::getCart(); foreach ($this->getCartRules($cart) as $rule) {
foreach ($this->getCartRules() as $rule) {
if (! $this->canProcessRule($cart, $rule)) { if (! $this->canProcessRule($cart, $rule)) {
continue; continue;
} }
@ -315,7 +341,10 @@ class CartRule
continue; continue;
} }
if (! $rule || ! $rule->apply_to_shipping) { if (
! $rule
|| ! $rule->apply_to_shipping
) {
continue; continue;
} }
@ -388,11 +417,9 @@ class CartRule
$appliedRuleIds = []; $appliedRuleIds = [];
$cart = Cart::getCart();
foreach ($cart->items->all() as $item) { foreach ($cart->items->all() as $item) {
foreach ($this->getCartRules() as $rule) { foreach ($this->getCartRules($cart) as $rule) {
if (! $this->canProcessRule($cart, $rule)) { if (! $this->canProcessRule($cart, $rule)) {
continue; continue;
@ -403,7 +430,10 @@ class CartRule
continue; continue;
} }
if (! $rule || ! $rule->free_shipping) { if (
! $rule
|| ! $rule->free_shipping
) {
continue; continue;
} }
@ -435,14 +465,13 @@ class CartRule
/** /**
* Calculate cart item totals for each rule * Calculate cart item totals for each rule
* *
* @param \Webkul\Checkout\Contracts\Cart $cart
* @param \Illuminate\Support\Collecton $items * @param \Illuminate\Support\Collecton $items
* @return \Webkul\Rule\Helpers\Validator * @return \Webkul\Rule\Helpers\Validator
*/ */
public function calculateCartItemTotals($items) public function calculateCartItemTotals($cart, $items)
{ {
$cart = Cart::getCart(); foreach ($this->getCartRules($cart) as $rule) {
foreach ($this->getCartRules() as $rule) {
if ($rule->action_type == 'cart_fixed') { if ($rule->action_type == 'cart_fixed') {
$totalPrice = $totalBasePrice = $validCount = 0; $totalPrice = $totalBasePrice = $validCount = 0;
@ -473,12 +502,11 @@ class CartRule
/** /**
* Check if coupon code is applied or not * Check if coupon code is applied or not
* *
* @param \Webkul\Checkout\Contracts\Cart $cart
* @return bool * @return bool
*/ */
public function checkCouponCode(): bool public function checkCouponCode($cart): bool
{ {
$cart = cart()->getCart();
if (! $cart->coupon_code) { if (! $cart->coupon_code) {
return true; return true;
} }
@ -550,5 +578,4 @@ class CartRule
->orderBy('sort_order', 'asc'); ->orderBy('sort_order', 'asc');
})->findWhere(['status' => 1]); })->findWhere(['status' => 1]);
} }
} }

View File

@ -7,6 +7,7 @@ use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException; use Illuminate\Validation\ValidationException;
use Illuminate\View\View; use Illuminate\View\View;
use Webkul\Admin\DataGrids\CartRuleDataGrid; use Webkul\Admin\DataGrids\CartRuleDataGrid;
use Webkul\CartRule\Http\Requests\CartRuleRequest;
use Webkul\CartRule\Repositories\CartRuleRepository; use Webkul\CartRule\Repositories\CartRuleRepository;
class CartRuleController extends Controller class CartRuleController extends Controller
@ -92,25 +93,13 @@ class CartRuleController extends Controller
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Webkul\CartRule\Http\Requests\CartRuleRequest $cartRuleRequest
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function store() public function store(CartRuleRequest $cartRuleRequest)
{ {
try { try {
$this->validate(request(), [ $data = $cartRuleRequest->all();
'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();
$this->cartRuleRepository->create($data); $this->cartRuleRepository->create($data);
@ -142,25 +131,13 @@ class CartRuleController extends Controller
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param \Webkul\CartRule\Http\Requests\CartRuleRequest $cartRuleRequest
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update(Request $request, $id) public function update(CartRuleRequest $cartRuleRequest, $id)
{ {
try { 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',
'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);
if ($cartRule->coupon_type) { if ($cartRule->coupon_type) {
@ -175,7 +152,7 @@ class CartRuleController extends Controller
} }
} }
$cartRule = $this->cartRuleRepository->update(request()->all(), $id); $cartRule = $this->cartRuleRepository->update($cartRuleRequest->all(), $id);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Cart Rule'])); session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Cart Rule']));

View File

@ -0,0 +1,52 @@
<?php
namespace Webkul\CartRule\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CartRuleRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'name' => 'required',
'channels' => 'required|array|min:1',
'customer_groups' => 'required|array|min:1',
'coupon_type' => 'required',
'use_auto_generation' => 'required_if:coupon_type,==,1',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'action_type' => 'required',
'discount_amount' => 'required|numeric',
];
if (! request('id')) {
$rules = array_merge($rules, [
'coupon_code' => 'required_if:use_auto_generation,==,0|unique:cart_rule_coupons,code',
]);
}
if (request()->has('action_type') && request()->action_type == 'by_percent') {
$rules = array_merge($rules, [
'discount_amount' => 'required|numeric|min:0|max:100',
]);
}
return $rules;
}
}

View File

@ -24,6 +24,6 @@ class Cart
*/ */
public function applyCartRules($cart) public function applyCartRules($cart)
{ {
$this->cartRuleHepler->collect(); $this->cartRuleHepler->collect($cart);
} }
} }

View File

@ -124,7 +124,7 @@ class CartRule extends Model implements CartRuleContract
$coupon = $this->coupon_code() $coupon = $this->coupon_code()
->first(); ->first();
if (!$coupon) { if (! $coupon) {
return; return;
} }

View File

@ -12,11 +12,12 @@ class EventServiceProvider extends ServiceProvider
* @var array * @var array
*/ */
protected $listen = [ protected $listen = [
'checkout.order.save.after' => [ 'checkout.order.save.after' => [
'Webkul\CartRule\Listeners\Order@manageCartRule' 'Webkul\CartRule\Listeners\Order@manageCartRule'
], ],
'checkout.cart.collect.totals.before' => [
'Webkul\CartRule\Listeners\Cart@applyCartRules' 'checkout.cart.collect.totals.before' => [
], 'Webkul\CartRule\Listeners\Cart@applyCartRules'
],
]; ];
} }

View File

@ -71,7 +71,10 @@ class CartRuleRepository extends Repository
$cartRule->customer_groups()->sync($data['customer_groups']); $cartRule->customer_groups()->sync($data['customer_groups']);
if ($data['coupon_type'] && ! $data['use_auto_generation']) { if (
$data['coupon_type']
&& ! $data['use_auto_generation']
) {
$this->cartRuleCouponRepository->create([ $this->cartRuleCouponRepository->create([
'cart_rule_id' => $cartRule->id, 'cart_rule_id' => $cartRule->id,
'code' => $data['coupon_code'], 'code' => $data['coupon_code'],

View File

@ -106,7 +106,8 @@ class CatalogRuleProduct
$appliedAttributes = []; $appliedAttributes = [];
foreach ($rule->conditions as $condition) { foreach ($rule->conditions as $condition) {
if (! $condition['attribute'] if (
! $condition['attribute']
|| ! isset($condition['value']) || ! isset($condition['value'])
|| is_null($condition['value']) || is_null($condition['value'])
|| $condition['value'] == '' || $condition['value'] == ''

View File

@ -48,7 +48,10 @@ class CatalogRuleProductPrice
foreach ($catalogRuleProducts as $row) { foreach ($catalogRuleProducts as $row) {
$productKey = $row->product_id . '-' . $row->channel_id . '-' . $row->customer_group_id; $productKey = $row->product_id . '-' . $row->channel_id . '-' . $row->customer_group_id;
if ($previousKey && $previousKey != $productKey) { if (
$previousKey
&& $previousKey != $productKey
) {
$endRuleFlags = []; $endRuleFlags = [];
if (count($prices) > $batchCount) { if (count($prices) > $batchCount) {
@ -59,8 +62,15 @@ class CatalogRuleProductPrice
} }
foreach ($dates as $key => $date) { foreach ($dates as $key => $date) {
if ((! $row->starts_from || $date >= $row->starts_from) if (
&& (! $row->ends_till || $date <= $row->ends_till) (
! $row->starts_from
|| $date >= $row->starts_from
)
&& (
! $row->ends_till
|| $date <= $row->ends_till
)
) { ) {
$priceKey = $date->getTimestamp() . '-' . $productKey; $priceKey = $date->getTimestamp() . '-' . $productKey;

View File

@ -5,6 +5,7 @@ namespace Webkul\CatalogRule\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Webkul\Admin\DataGrids\CatalogRuleDataGrid; use Webkul\Admin\DataGrids\CatalogRuleDataGrid;
use Webkul\CatalogRule\Helpers\CatalogRuleIndex; use Webkul\CatalogRule\Helpers\CatalogRuleIndex;
use Webkul\CatalogRule\Http\Requests\CatalogRuleRequest;
use Webkul\CatalogRule\Repositories\CatalogRuleRepository; use Webkul\CatalogRule\Repositories\CatalogRuleRepository;
class CatalogRuleController extends Controller class CatalogRuleController extends Controller
@ -58,21 +59,12 @@ class CatalogRuleController extends Controller
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Webkul\CatalogRule\Http\Requests\CatalogRuleRequest $catalogRuleRequest
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function store() public function store(CatalogRuleRequest $catalogRuleRequest)
{ {
$this->validate(request(), [ $data = $catalogRuleRequest->all();
'name' => 'required',
'channels' => 'required|array|min:1',
'customer_groups' => 'required|array|min:1',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'action_type' => 'required',
'discount_amount' => 'required|numeric',
]);
$data = request()->all();
$this->catalogRuleRepository->create($data); $this->catalogRuleRepository->create($data);
@ -99,25 +91,15 @@ class CatalogRuleController extends Controller
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param \Webkul\CatalogRule\Http\Requests\CatalogRuleRequest $catalogRuleRequest
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update(Request $request, $id) public function update(CatalogRuleRequest $catalogRuleRequest, $id)
{ {
$this->validate(request(), [
'name' => 'required',
'channels' => 'required|array|min:1',
'customer_groups' => 'required|array|min:1',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'action_type' => 'required',
'discount_amount' => 'required|numeric',
]);
$this->catalogRuleRepository->findOrFail($id); $this->catalogRuleRepository->findOrFail($id);
$this->catalogRuleRepository->update(request()->all(), $id); $this->catalogRuleRepository->update($catalogRuleRequest->all(), $id);
$this->catalogRuleIndexHelper->reindexComplete(); $this->catalogRuleIndexHelper->reindexComplete();

View File

@ -0,0 +1,44 @@
<?php
namespace Webkul\CatalogRule\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CatalogRuleRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'name' => 'required',
'channels' => 'required|array|min:1',
'customer_groups' => 'required|array|min:1',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'action_type' => 'required',
'discount_amount' => 'required|numeric',
];
if (request()->has('action_type') && request()->action_type == 'by_percent') {
$rules = array_merge($rules, [
'discount_amount' => 'required|numeric|min:0|max:100',
]);
}
return $rules;
}
}

View File

@ -175,7 +175,10 @@ class CategoryController extends Controller
} }
} }
if (count($categoryIds) != 1 || $suppressFlash == true) { if (
count($categoryIds) != 1
|| $suppressFlash == true
) {
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'Category'])); session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'Category']));
} }

View File

@ -32,7 +32,10 @@ class CategoryRepository extends Repository
{ {
Event::dispatch('catalog.category.create.before'); Event::dispatch('catalog.category.create.before');
if (isset($data['locale']) && $data['locale'] == 'all') { if (
isset($data['locale'])
&& $data['locale'] == 'all'
) {
$model = app()->make($this->model()); $model = app()->make($this->model());
foreach (core()->getAllLocales() as $locale) { foreach (core()->getAllLocales() as $locale) {
@ -269,7 +272,10 @@ class CategoryRepository extends Repository
$trimmed = []; $trimmed = [];
foreach ($categories as $key => $category) { foreach ($categories as $key => $category) {
if ($category->name != null || $category->name != '') { if (
$category->name != null
|| $category->name != ''
) {
$trimmed[$key] = [ $trimmed[$key] = [
'id' => $category->id, 'id' => $category->id,
'name' => $category->name, 'name' => $category->name,

View File

@ -25,6 +25,12 @@ class Cart
{ {
use CartCoupons, CartTools, CartValidators; use CartCoupons, CartTools, CartValidators;
/**
* @var \Webkul\Checkout\Contracts\Cart
*/
private $cart;
/** /**
* Create a new class instance. * Create a new class instance.
* *
@ -47,6 +53,21 @@ class Cart
protected CustomerAddressRepository $customerAddressRepository protected CustomerAddressRepository $customerAddressRepository
) )
{ {
$this->initCart();
}
/**
* Returns cart.
*
* @return \Webkul\Checkout\Contracts\Cart|null
*/
public function initCart()
{
$this->getCart();
if ($this->cart) {
$this->removeInactiveItems();
}
} }
/** /**
@ -56,27 +77,48 @@ class Cart
*/ */
public function getCart(): ?\Webkul\Checkout\Contracts\Cart public function getCart(): ?\Webkul\Checkout\Contracts\Cart
{ {
$cart = null; if ($this->cart) {
return $this->cart;
}
if (auth()->guard()->check()) { if (auth()->guard()->check()) {
$cart = $this->cartRepository->findOneWhere([ $this->cart = $this->cartRepository->findOneWhere([
'customer_id' => auth()->guard()->user()->id, 'customer_id' => auth()->guard()->user()->id,
'is_active' => 1, 'is_active' => 1,
]); ]);
} else if (session()->has('cart')) { } elseif (session()->has('cart')) {
$cart = $this->cartRepository->find(session()->get('cart')->id); $this->cart = $this->cartRepository->find(session()->get('cart')->id);
} }
$this->removeInactiveItems($cart); return $this->cart;
}
return $cart; /**
* Set cart model to the variable for reuse
*
* @param \Webkul\Checkout\Contracts\Cart
* @return void
*/
public function setCart($cart)
{
$this->cart = $cart;
}
/**
* Reset cart
*
* @return void
*/
public function resetCart()
{
$this->cart = null;
} }
/** /**
* Get cart item by product. * Get cart item by product.
* *
* @param array|null $data * @param array $data
* @param array $parentData * @param array|null $parentData
* @return \Webkul\Checkout\Contracts\CartItem|void * @return \Webkul\Checkout\Contracts\CartItem|void
*/ */
public function getItemByProduct($data, $parentData = null) public function getItemByProduct($data, $parentData = null)
@ -110,23 +152,26 @@ class Cart
$cart = $this->getCart(); $cart = $this->getCart();
if (! $cart && ! $cart = $this->create($data)) { if (
! $cart
&& ! $cart = $this->create($data)
) {
return ['warning' => __('shop::app.checkout.cart.item.error-add')]; return ['warning' => __('shop::app.checkout.cart.item.error-add')];
} }
$product = $this->productRepository->findOneByField('id', $productId); $product = $this->productRepository->find($productId);
if ($product->status === 0) { if (! $product->status) {
return ['info' => __('shop::app.checkout.cart.item.inactive-add')]; return ['info' => __('shop::app.checkout.cart.item.inactive-add')];
} }
$cartProducts = $product->getTypeInstance()->prepareForCart($data); $cartProducts = $product->getTypeInstance()->prepareForCart($data);
if (is_string($cartProducts)) { if (is_string($cartProducts)) {
$this->collectTotals(); if ($cart->all_items->count() <= 0) {
$this->removeCart($cart);
if (count($cart->all_items) <= 0) { } else {
session()->forget('cart'); $this->collectTotals();
} }
throw new Exception($cartProducts); throw new Exception($cartProducts);
@ -143,7 +188,10 @@ class Cart
if (! $cartItem) { if (! $cartItem) {
$cartItem = $this->cartItemRepository->create(array_merge($cartProduct, ['cart_id' => $cart->id])); $cartItem = $this->cartItemRepository->create(array_merge($cartProduct, ['cart_id' => $cart->id]));
} else { } else {
if (isset($cartProduct['parent_id']) && $cartItem->parent_id !== $parentCartItem->id) { if (
isset($cartProduct['parent_id'])
&& $cartItem->parent_id !== $parentCartItem->id
) {
$cartItem = $this->cartItemRepository->create(array_merge($cartProduct, [ $cartItem = $this->cartItemRepository->create(array_merge($cartProduct, [
'cart_id' => $cart->id, 'cart_id' => $cart->id,
])); ]));
@ -175,8 +223,8 @@ class Cart
{ {
$cartData = [ $cartData = [
'channel_id' => core()->getCurrentChannel()->id, 'channel_id' => core()->getCurrentChannel()->id,
'global_currency_code' => core()->getBaseCurrencyCode(), 'global_currency_code' => $baseCurrencyCode = core()->getBaseCurrencyCode(),
'base_currency_code' => core()->getBaseCurrencyCode(), 'base_currency_code' => $baseCurrencyCode,
'channel_currency_code' => core()->getChannelBaseCurrencyCode(), 'channel_currency_code' => core()->getChannelBaseCurrencyCode(),
'cart_currency_code' => core()->getCurrentCurrencyCode(), 'cart_currency_code' => core()->getCurrentCurrencyCode(),
'items_count' => 1, 'items_count' => 1,
@ -186,11 +234,15 @@ class Cart
* Fill in the customer data, as far as possible. * Fill in the customer data, as far as possible.
*/ */
if (auth()->guard()->check()) { if (auth()->guard()->check()) {
$cartData['customer_id'] = auth()->guard()->user()->id; $customer = auth()->guard()->user();
$cartData['is_guest'] = 0;
$cartData['customer_first_name'] = auth()->guard()->user()->first_name; $cartData = array_merge($cartData, [
$cartData['customer_last_name'] = auth()->guard()->user()->last_name; 'customer_id' => $customer->id,
$cartData['customer_email'] = auth()->guard()->user()->email; 'is_guest' => 0,
'customer_first_name' => $customer->first_name,
'customer_last_name' => $customer->last_name,
'customer_email' => $customer->email,
]);
} else { } else {
$cartData['is_guest'] = 1; $cartData['is_guest'] = 1;
} }
@ -203,6 +255,8 @@ class Cart
return; return;
} }
$this->setCart($cart);
$this->putCart($cart); $this->putCart($cart);
return $cart; return $cart;
@ -217,13 +271,16 @@ class Cart
public function updateItems($data) public function updateItems($data)
{ {
foreach ($data['qty'] as $itemId => $quantity) { foreach ($data['qty'] as $itemId => $quantity) {
$item = $this->cartItemRepository->findOneByField('id', $itemId); $item = $this->cartItemRepository->find($itemId);
if (! $item) { if (! $item) {
continue; continue;
} }
if ($item->product && $item->product->status === 0) { if (
$item->product
&& $item->product->status === 0
) {
throw new Exception(__('shop::app.checkout.cart.item.inactive')); throw new Exception(__('shop::app.checkout.cart.item.inactive'));
} }
@ -275,15 +332,11 @@ class Cart
$cartItem->delete(); $cartItem->delete();
if ($cart->items()->get()->count() == 0) { if ($cart->items()->get()->count() == 0) {
$this->cartRepository->delete($cart->id); $this->removeCart($cart);
} else {
if (session()->has('cart')) { Shipping::collectRates();
session()->forget('cart');
}
} }
Shipping::collectRates();
Event::dispatch('checkout.cart.delete.after', $itemId); Event::dispatch('checkout.cart.delete.after', $itemId);
$this->collectTotals(); $this->collectTotals();
@ -321,35 +374,23 @@ class Cart
/** /**
* Remove cart items, whose product is inactive. * Remove cart items, whose product is inactive.
* *
* @param \Webkul\Checkout\Models\Cart|null $cart * @return void
* @return \Webkul\Checkout\Models\Cart|null
*/ */
public function removeInactiveItems(CartModel $cart = null): ?CartModel public function removeInactiveItems()
{ {
if (! $cart) { $cart = $this->getCart();
return $cart;
}
foreach ($cart->items as $item) { foreach ($cart->items as $item) {
if ($this->isCartItemInactive($item)) { if ($this->isCartItemInactive($item)) {
$this->cartItemRepository->delete($item->id); $this->cartItemRepository->delete($item->id);
if ($cart->items->count() == 0) { if ($cart->items->count() == 0) {
$this->cartRepository->delete($cart->id); $this->removeCart($cart);
if (session()->has('cart')) {
session()->forget('cart');
}
} }
session()->flash('info', __('shop::app.checkout.cart.item.inactive')); session()->flash('info', __('shop::app.checkout.cart.item.inactive'));
} }
} }
$cart->save();
return $cart;
} }
/** /**
@ -373,7 +414,24 @@ class Cart
$this->linkAddresses($cart, $billingAddressData, $shippingAddressData); $this->linkAddresses($cart, $billingAddressData, $shippingAddressData);
$this->assignCustomerFields($cart); if (
auth()->guard()->check()
&& ($user = auth()->guard()->user())
&& (
$user->email
&& $user->first_name
&&
$user->last_name
)
) {
$cart->customer_email = $user->email;
$cart->customer_first_name = $user->first_name;
$cart->customer_last_name = $user->last_name;
} else {
$cart->customer_email = $cart->billing_address->email;
$cart->customer_first_name = $cart->billing_address->first_name;
$cart->customer_last_name = $cart->billing_address->last_name;
}
$cart->save(); $cart->save();
@ -447,21 +505,30 @@ class Cart
Event::dispatch('checkout.cart.collect.totals.before', $cart); Event::dispatch('checkout.cart.collect.totals.before', $cart);
$this->calculateItemsTax(); $this->calculateItemsTax();
$cart->refresh(); $cart->refresh();
$cart->grand_total = $cart->base_grand_total = 0;
$cart->sub_total = $cart->base_sub_total = 0; $cart->sub_total = $cart->base_sub_total = 0;
$cart->grand_total = $cart->base_grand_total = 0;
$cart->tax_total = $cart->base_tax_total = 0; $cart->tax_total = $cart->base_tax_total = 0;
$cart->discount_amount = $cart->base_discount_amount = 0; $cart->discount_amount = $cart->base_discount_amount = 0;
$quantities = 0;
foreach ($cart->items as $item) { foreach ($cart->items as $item) {
$cart->discount_amount += $item->discount_amount; $cart->discount_amount += $item->discount_amount;
$cart->base_discount_amount += $item->base_discount_amount; $cart->base_discount_amount += $item->base_discount_amount;
$cart->sub_total = (float) $cart->sub_total + $item->total; $cart->sub_total = (float) $cart->sub_total + $item->total;
$cart->base_sub_total = (float) $cart->base_sub_total + $item->base_total; $cart->base_sub_total = (float) $cart->base_sub_total + $item->base_total;
$quantities += $item->quantity;
} }
$cart->items_qty = $quantities;
$cart->items_count = $cart->items->count();
$cart->tax_total = Tax::getTaxTotal($cart, false); $cart->tax_total = Tax::getTaxTotal($cart, false);
$cart->base_tax_total = Tax::getTaxTotal($cart, true); $cart->base_tax_total = Tax::getTaxTotal($cart, true);
@ -476,17 +543,14 @@ class Cart
$cart->base_discount_amount += $shipping->base_discount_amount; $cart->base_discount_amount += $shipping->base_discount_amount;
} }
$cart = $this->finalizeCartTotals($cart); $cart->discount_amount = round($cart->discount_amount, 2);
$cart->base_discount_amount = round($cart->base_discount_amount, 2);
$quantities = 0; $cart->sub_total = round($cart->sub_total, 2);
$cart->base_sub_total = round($cart->base_sub_total, 2);
foreach ($cart->items as $item) { $cart->grand_total = round($cart->grand_total, 2);
$quantities = $quantities + $item->quantity; $cart->base_grand_total = round($cart->base_grand_total, 2);
}
$cart->items_count = $cart->items->count();
$cart->items_qty = $quantities;
$cart->cart_currency_code = core()->getCurrentCurrencyCode(); $cart->cart_currency_code = core()->getCurrentCurrencyCode();
@ -530,7 +594,7 @@ class Cart
$address = Tax::getDefaultAddress(); $address = Tax::getDefaultAddress();
} }
$item = $this->setItemTaxToZero($item); $item->tax_percent = $item->tax_amount = $item->base_tax_amount = 0;
Tax::isTaxApplicableInCurrentAddress($taxCategory, $address, function ($rate) use ($cart, $item) { Tax::isTaxApplicableInCurrentAddress($taxCategory, $address, function ($rate) use ($cart, $item) {
$item->tax_percent = $rate->tax_rate; $item->tax_percent = $rate->tax_rate;
@ -557,15 +621,17 @@ class Cart
return false; return false;
} }
if (count($cart->items) === 0) { $cartItems = $cart->items()->get();
$this->cartRepository->delete($cart->id);
if (count($cartItems) === 0) {
$this->removeCart($cart);
return false; return false;
} }
$isInvalid = false; $isInvalid = false;
foreach ($cart->items as $item) { foreach ($cartItems as $item) {
$validationResult = $item->product->getTypeInstance()->validateCartItem($item); $validationResult = $item->product->getTypeInstance()->validateCartItem($item);
if ($validationResult->isItemInactive()) { if ($validationResult->isItemInactive()) {
@ -574,17 +640,17 @@ class Cart
$isInvalid = true; $isInvalid = true;
session()->flash('info', __('shop::app.checkout.cart.item.inactive')); session()->flash('info', __('shop::app.checkout.cart.item.inactive'));
} else {
$price = ! is_null($item->custom_price) ? $item->custom_price : $item->base_price;
$this->cartItemRepository->update([
'price' => core()->convertPrice($price),
'base_price' => $price,
'total' => core()->convertPrice($price * $item->quantity),
'base_total' => $price * $item->quantity,
], $item->id);
} }
$price = ! is_null($item->custom_price) ? $item->custom_price : $item->base_price;
$this->cartItemRepository->update([
'price' => core()->convertPrice($price),
'base_price' => $price,
'total' => core()->convertPrice($price * $item->quantity),
'base_total' => $price * $item->quantity,
], $item->id);
$isInvalid |= $validationResult->isCartInvalid(); $isInvalid |= $validationResult->isCartInvalid();
} }
@ -683,7 +749,10 @@ class Cart
'additional' => is_array($data['additional']) ? array_merge($data['additional'], $locale) : $locale, 'additional' => is_array($data['additional']) ? array_merge($data['additional'], $locale) : $locale,
]; ];
if (isset($data['children']) && $data['children']) { if (
isset($data['children'])
&& $data['children']
) {
foreach ($data['children'] as $child) { foreach ($data['children'] as $child) {
/** /**
* - For bundle, child quantity will not be zero. * - For bundle, child quantity will not be zero.
@ -722,71 +791,11 @@ class Cart
$data['payment'] = $cart->payment->toArray(); $data['payment'] = $cart->payment->toArray();
$data['items'] = $cart->items->toArray(); $data['items'] = $cart->items()->with('children')->get()->toArray();
return $data; return $data;
} }
/**
* Set Item tax to zero.
*
* @param \Webkul\Checkout\Contracts\CartItem $item
* @return \Webkul\Checkout\Contracts\CartItem
*/
protected function setItemTaxToZero(\Webkul\Checkout\Contracts\CartItem $item): \Webkul\Checkout\Contracts\CartItem
{
$item->tax_percent = 0;
$item->tax_amount = 0;
$item->base_tax_amount = 0;
return $item;
}
/**
* Transfer the user profile information into the cart/into the order.
*
* When logged in as guest or the customer profile is not complete, we use the
* billing address to fill the order customer_ data.
*
* @param \Webkul\Checkout\Contracts\Cart $cart
*/
private function assignCustomerFields(\Webkul\Checkout\Contracts\Cart $cart): void
{
if (
auth()->guard()->check()
&& ($user = auth()->guard()->user())
&& $this->profileIsComplete($user)
) {
$cart->customer_email = $user->email;
$cart->customer_first_name = $user->first_name;
$cart->customer_last_name = $user->last_name;
} else {
$cart->customer_email = $cart->billing_address->email;
$cart->customer_first_name = $cart->billing_address->first_name;
$cart->customer_last_name = $cart->billing_address->last_name;
}
}
/**
* Round cart totals.
*
* @param \Webkul\Checkout\Models\Cart $cart
* @return \Webkul\Checkout\Models\Cart
*/
private function finalizeCartTotals(CartModel $cart): CartModel
{
$cart->discount_amount = round($cart->discount_amount, 2);
$cart->base_discount_amount = round($cart->base_discount_amount, 2);
$cart->sub_total = round($cart->sub_total, 2);
$cart->base_sub_total = round($cart->base_sub_total, 2);
$cart->grand_total = round($cart->grand_total, 2);
$cart->base_grand_total = round($cart->base_grand_total, 2);
return $cart;
}
/** /**
* Returns true, if cart item is inactive. * Returns true, if cart item is inactive.
* *
@ -804,17 +813,6 @@ class Cart
return $loadedCartItem[$item->product_id] = $item->product->getTypeInstance()->isCartItemInactive($item); return $loadedCartItem[$item->product_id] = $item->product->getTypeInstance()->isCartItemInactive($item);
} }
/**
* Is profile is complete.
*
* @param $user
* @return bool
*/
private function profileIsComplete($user): bool
{
return $user->email && $user->first_name && $user->last_name;
}
/** /**
* Fill customer attributes. * Fill customer attributes.
* *
@ -871,11 +869,17 @@ class Cart
): void { ): void {
$shippingAddress['cart_id'] = $billingAddress['cart_id'] = null; $shippingAddress['cart_id'] = $billingAddress['cart_id'] = null;
if (isset($data['billing']['save_as_address']) && $data['billing']['save_as_address']) { if (
isset($data['billing']['save_as_address'])
&& $data['billing']['save_as_address']
) {
$this->customerAddressRepository->create($billingAddress); $this->customerAddressRepository->create($billingAddress);
} }
if (isset($data['shipping']['save_as_address']) && $data['shipping']['save_as_address']) { if (
isset($data['shipping']['save_as_address'])
&& $data['shipping']['save_as_address']
) {
$this->customerAddressRepository->create($shippingAddress); $this->customerAddressRepository->create($shippingAddress);
} }
} }
@ -891,7 +895,10 @@ class Cart
{ {
$customerAddress = []; $customerAddress = [];
if (isset($data['billing']['address_id']) && $data['billing']['address_id']) { if (
isset($data['billing']['address_id'])
&& $data['billing']['address_id']
) {
$customerAddress = $this $customerAddress = $this
->customerAddressRepository ->customerAddressRepository
->findOneWhere(['id' => $data['billing']['address_id']]) ->findOneWhere(['id' => $data['billing']['address_id']])
@ -920,7 +927,10 @@ class Cart
{ {
$customerAddress = []; $customerAddress = [];
if (isset($data['shipping']['address_id']) && $data['shipping']['address_id']) { if (
isset($data['shipping']['address_id'])
&& $data['shipping']['address_id']
) {
$customerAddress = $this $customerAddress = $this
->customerAddressRepository ->customerAddressRepository
->findOneWhere(['id' => $data['shipping']['address_id']]) ->findOneWhere(['id' => $data['shipping']['address_id']])
@ -952,22 +962,33 @@ class Cart
array $shippingAddressData array $shippingAddressData
): void { ): void {
$billingAddressModel = $cart->billing_address; $billingAddressModel = $cart->billing_address;
if ($billingAddressModel) { if ($billingAddressModel) {
$billingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_BILLING; $billingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_BILLING;
$this->cartAddressRepository->update($billingAddressData, $billingAddressModel->id); $this->cartAddressRepository->update($billingAddressData, $billingAddressModel->id);
if ($cart->haveStockableItems()) { if ($cart->haveStockableItems()) {
$shippingAddressModel = $cart->shipping_address; $shippingAddressModel = $cart->shipping_address;
if ($shippingAddressModel) { if ($shippingAddressModel) {
if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) { if (
isset($billingAddressData['use_for_shipping'])
&& $billingAddressData['use_for_shipping']
) {
$billingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_SHIPPING; $billingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_SHIPPING;
$this->cartAddressRepository->update($billingAddressData, $shippingAddressModel->id); $this->cartAddressRepository->update($billingAddressData, $shippingAddressModel->id);
} else { } else {
$shippingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_SHIPPING; $shippingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_SHIPPING;
$this->cartAddressRepository->update($shippingAddressData, $shippingAddressModel->id); $this->cartAddressRepository->update($shippingAddressData, $shippingAddressModel->id);
} }
} else { } else {
if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) { if (
isset($billingAddressData['use_for_shipping'])
&& $billingAddressData['use_for_shipping']
) {
$this->cartAddressRepository->create(array_merge( $this->cartAddressRepository->create(array_merge(
$billingAddressData, $billingAddressData,
['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING] ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING]
@ -984,7 +1005,10 @@ class Cart
$this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_BILLING])); $this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_BILLING]));
if ($cart->haveStockableItems()) { if ($cart->haveStockableItems()) {
if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) { if (
isset($billingAddressData['use_for_shipping'])
&& $billingAddressData['use_for_shipping']
) {
$this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING])); $this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING]));
} else { } else {
$this->cartAddressRepository->create(array_merge($shippingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING])); $this->cartAddressRepository->create(array_merge($shippingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING]));

View File

@ -38,7 +38,10 @@ class CustomerAddressForm extends FormRequest
$this->mergeNewAddressRules('billing'); $this->mergeNewAddressRules('billing');
} }
if (isset($this->get('billing')['use_for_shipping']) && ! $this->get('billing')['use_for_shipping']) { if (
isset($this->get('billing')['use_for_shipping'])
&& ! $this->get('billing')['use_for_shipping']
) {
if (isset($this->get('shipping')['address_id'])) { if (isset($this->get('shipping')['address_id'])) {
$this->mergeExistingAddressRules('shipping'); $this->mergeExistingAddressRules('shipping');
} else { } else {

View File

@ -20,10 +20,10 @@ class Cart extends Model implements CartContract
'updated_at', 'updated_at',
]; ];
protected $with = [ // protected $with = [
'items', // 'items',
'items.children', // 'items.children',
]; // ];
/** /**
* To get relevant associated items with the cart instance * To get relevant associated items with the cart instance
@ -162,11 +162,11 @@ class Cart extends Model implements CartContract
public function hasProductsWithQuantityBox(): bool public function hasProductsWithQuantityBox(): bool
{ {
foreach ($this->items as $item) { foreach ($this->items as $item) {
if ($item->product->getTypeInstance() if ($item->product->getTypeInstance()->showQuantityBox() === true) {
->showQuantityBox() === true) {
return true; return true;
} }
} }
return false; return false;
} }

View File

@ -45,10 +45,6 @@ class CheckoutServiceProvider extends ServiceProvider
$loader->alias('cart', Cart::class); $loader->alias('cart', Cart::class);
$this->app->singleton('cart', function () { $this->app->singleton('cart', \Webkul\Checkout\Cart::class);
return new Cart();
});
$this->app->bind('cart', \Webkul\Checkout\Cart::class);
} }
} }

View File

@ -11,6 +11,23 @@ namespace Webkul\Checkout\Traits;
*/ */
trait CartTools trait CartTools
{ {
/**
* Remove cart and destroy the session
*
* @param \Webkul\Checkout\Contracts\Cart $cart
* @return void
*/
public function removeCart($cart)
{
$this->cartRepository->delete($cart->id);
if (session()->has('cart')) {
session()->forget('cart');
}
$this->resetCart();
}
/** /**
* Save cart for guest. * Save cart for guest.
* *
@ -20,7 +37,10 @@ trait CartTools
public function putCart($cart) public function putCart($cart)
{ {
if (! auth()->guard()->check()) { if (! auth()->guard()->check()) {
session()->put('cart', $cart); $cartTemp = new \stdClass();
$cartTemp->id = $cart->id;
session()->put('cart', $cartTemp);
} }
} }
@ -37,7 +57,9 @@ trait CartTools
'is_active' => 1, 'is_active' => 1,
]); ]);
$guestCart = session()->get('cart'); $this->setCart($cart);
$guestCart = $this->cartRepository->find(session()->get('cart')->id);
/** /**
* When the logged in customer is not having any of the cart instance previously and are active. * When the logged in customer is not having any of the cart instance previously and are active.
@ -58,7 +80,7 @@ trait CartTools
foreach ($guestCart->items as $guestCartItem) { foreach ($guestCart->items as $guestCartItem) {
try { try {
$this->addProduct($guestCartItem->product_id, $guestCartItem->additional); $cart = $this->addProduct($guestCartItem->product_id, $guestCartItem->additional);
} catch (\Exception $e) { } catch (\Exception $e) {
//Ignore exception //Ignore exception
} }
@ -66,9 +88,7 @@ trait CartTools
$this->collectTotals(); $this->collectTotals();
$this->cartRepository->delete($guestCart->id); $this->removeCart($guestCart);
session()->forget('cart');
} }
} }
@ -140,7 +160,9 @@ trait CartTools
public function deActivateCart(): void public function deActivateCart(): void
{ {
if ($cart = $this->getCart()) { if ($cart = $this->getCart()) {
$this->cartRepository->update(['is_active' => false], $cart->id); $cart = $this->cartRepository->update(['is_active' => false], $cart->id);
$this->resetCart();
if (session()->has('cart')) { if (session()->has('cart')) {
session()->forget('cart'); session()->forget('cart');

View File

@ -489,7 +489,10 @@ class Core
{ {
static $exchangeRate; static $exchangeRate;
if ($exchangeRate || $exchangeRate === '') { if (
$exchangeRate
|| $exchangeRate === ''
) {
return $exchangeRate; return $exchangeRate;
} }
@ -538,7 +541,11 @@ class Core
$exchangeRate = $this->getExchangeRate($targetCurrency->id); $exchangeRate = $this->getExchangeRate($targetCurrency->id);
if ('' === $exchangeRate || null === $exchangeRate || ! $exchangeRate->rate) { if (
'' === $exchangeRate
|| null === $exchangeRate
|| ! $exchangeRate->rate
) {
return $amount; return $amount;
} }
@ -572,7 +579,10 @@ class Core
'target_currency' => $targetCurrency->id, 'target_currency' => $targetCurrency->id,
]); ]);
if (null === $exchangeRate || ! $exchangeRate->rate) { if (
null === $exchangeRate
|| ! $exchangeRate->rate
) {
return $amount; return $amount;
} }
@ -716,9 +726,15 @@ class Core
$toTimeStamp += 86400; $toTimeStamp += 86400;
} }
if (! $this->is_empty_date($dateFrom) && $channelTimeStamp < $fromTimeStamp) { if (
! $this->is_empty_date($dateFrom)
&& $channelTimeStamp < $fromTimeStamp
) {
$result = false; $result = false;
} elseif (! $this->is_empty_date($dateTo) && $channelTimeStamp > $toTimeStamp) { } elseif (
! $this->is_empty_date($dateTo)
&& $channelTimeStamp > $toTimeStamp
) {
$result = false; $result = false;
} else { } else {
$result = true; $result = true;
@ -791,7 +807,10 @@ class Core
{ {
static $loadedConfigs = []; static $loadedConfigs = [];
if (array_key_exists($field, $loadedConfigs) && ! in_array($field, $this->coreConfigExceptions)) { if (
array_key_exists($field, $loadedConfigs)
&& ! in_array($field, $this->coreConfigExceptions)
) {
$coreConfigValue = $loadedConfigs[$field]; $coreConfigValue = $loadedConfigs[$field];
} else { } else {
if (null === $channel) { if (null === $channel) {
@ -1103,7 +1122,10 @@ class Core
while (count($keys) > 1) { while (count($keys) > 1) {
$key = array_shift($keys); $key = array_shift($keys);
if (! isset($array[$key]) || ! is_array($array[$key])) { if (
! isset($array[$key])
|| ! is_array($array[$key])
) {
$array[$key] = []; $array[$key] = [];
} }
@ -1212,7 +1234,11 @@ class Core
$merged = $array1; $merged = $array1;
foreach ($array2 as $key => &$value) { foreach ($array2 as $key => &$value) {
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { if (
is_array($value)
&& isset($merged[$key])
&& is_array($merged[$key])
) {
$merged[$key] = $this->arrayMerge($merged[$key], $value); $merged[$key] = $this->arrayMerge($merged[$key], $value);
} else { } else {
$merged[$key] = $value; $merged[$key] = $value;
@ -1234,8 +1260,14 @@ class Core
{ {
$fields = $this->getConfigField($field); $fields = $this->getConfigField($field);
if (isset($fields['channel_based']) && $fields['channel_based']) { if (
if (isset($fields['locale_based']) && $fields['locale_based']) { isset($fields['channel_based'])
&& $fields['channel_based']
) {
if (
isset($fields['locale_based'])
&& $fields['locale_based']
) {
$coreConfigValue = $this->coreConfigRepository->findOneWhere([ $coreConfigValue = $this->coreConfigRepository->findOneWhere([
'code' => $field, 'code' => $field,
'channel_code' => $channel, 'channel_code' => $channel,
@ -1248,7 +1280,10 @@ class Core
]); ]);
} }
} else { } else {
if (isset($fields['locale_based']) && $fields['locale_based']) { if (
isset($fields['locale_based'])
&& $fields['locale_based']
) {
$coreConfigValue = $this->coreConfigRepository->findOneWhere([ $coreConfigValue = $this->coreConfigRepository->findOneWhere([
'code' => $field, 'code' => $field,
'locale_code' => $locale, 'locale_code' => $locale,

View File

@ -57,7 +57,10 @@ class ExchangeRates extends ExchangeRate
$result = json_decode($result->getBody()->getContents(), true); $result = json_decode($result->getBody()->getContents(), true);
if (isset($result['success']) && ! $result['success']) { if (
isset($result['success'])
&& ! $result['success']
) {
throw new \Exception( throw new \Exception(
isset($result['error']['info']) isset($result['error']['info'])
? $result['error']['info'] ? $result['error']['info']

View File

@ -57,7 +57,10 @@ class FixerExchange extends ExchangeRate
$result = json_decode($result->getBody()->getContents(), true); $result = json_decode($result->getBody()->getContents(), true);
if (isset($result['success']) && ! $result['success']) { if (
isset($result['success'])
&& ! $result['success']
) {
throw new \Exception( throw new \Exception(
isset($result['error']['info']) isset($result['error']['info'])
? $result['error']['info'] ? $result['error']['info']

View File

@ -33,7 +33,10 @@ class CoreConfigRepository extends Repository
{ {
Event::dispatch('core.configuration.save.before'); Event::dispatch('core.configuration.save.before');
if ($data['locale'] || $data['channel']) { if (
$data['locale']
|| $data['channel']
) {
$locale = $data['locale']; $locale = $data['locale'];
$channel = $data['channel']; $channel = $data['channel'];
@ -51,12 +54,21 @@ class CoreConfigRepository extends Repository
$localeBased = isset($field['locale_based']) && $field['locale_based'] ? true : false; $localeBased = isset($field['locale_based']) && $field['locale_based'] ? true : false;
if (getType($value) == 'array' && ! isset($value['delete'])) { if (
getType($value) == 'array'
&& ! isset($value['delete'])
) {
$value = implode(',', $value); $value = implode(',', $value);
} }
if (isset($field['channel_based']) && $field['channel_based']) { if (
if (isset($field['locale_based']) && $field['locale_based']) { isset($field['channel_based'])
&& $field['channel_based']
) {
if (
isset($field['locale_based'])
&& $field['locale_based']
) {
$coreConfigValue = $this->model $coreConfigValue = $this->model
->where('code', $fieldName) ->where('code', $fieldName)
->where('locale_code', $locale) ->where('locale_code', $locale)
@ -69,7 +81,10 @@ class CoreConfigRepository extends Repository
->get(); ->get();
} }
} else { } else {
if (isset($field['locale_based']) && $field['locale_based']) { if (
isset($field['locale_based'])
&& $field['locale_based']
) {
$coreConfigValue = $this->model $coreConfigValue = $this->model
->where('code', $fieldName) ->where('code', $fieldName)
->where('locale_code', $locale) ->where('locale_code', $locale)

View File

@ -109,11 +109,17 @@ trait CoreConfigField
{ {
$info = []; $info = [];
if (isset($field['channel_based']) && $field['channel_based']) { if (
isset($field['channel_based'])
&& $field['channel_based']
) {
$info[] = $channel; $info[] = $channel;
} }
if (isset($field['locale_based']) && $field['locale_based']) { if (
isset($field['locale_based'])
&& $field['locale_based']
) {
$info[] = $locale; $info[] = $locale;
} }

View File

@ -99,7 +99,10 @@ class Tree {
{ {
$url = trim($item['url'], '/'); $url = trim($item['url'], '/');
if ((strpos($this->current, $url) !== false) || (strpos($this->currentKey, $item['key']) === 0)) { if (
(strpos($this->current, $url) !== false)
|| (strpos($this->currentKey, $item['key']) === 0)
) {
return 'active'; return 'active';
} }
} }

View File

@ -16,7 +16,8 @@ class BladeCompiler extends BaseBladeCompiler
{ {
$tokens = $this->getOpenAndClosingPhpTokens($contents); $tokens = $this->getOpenAndClosingPhpTokens($contents);
if (config('view.tracer') if (
config('view.tracer')
&& strpos($this->getPath(), 'tracer/style.blade.php') == false && strpos($this->getPath(), 'tracer/style.blade.php') == false
&& strpos($this->getPath(), 'master.blade.php') == false && strpos($this->getPath(), 'master.blade.php') == false
) { ) {
@ -25,7 +26,10 @@ class BladeCompiler extends BaseBladeCompiler
$contents = '<div class="path-hint" data-toggle="tooltip" data-title="' . $finalPath . '" data-id="' . uniqid() . '"><span class="testing"></span>' . $contents . '</div>'; $contents = '<div class="path-hint" data-toggle="tooltip" data-title="' . $finalPath . '" data-id="' . uniqid() . '"><span class="testing"></span>' . $contents . '</div>';
} }
if ($tokens->isNotEmpty() && $tokens->last() !== T_CLOSE_TAG) { if (
$tokens->isNotEmpty()
&& $tokens->last() !== T_CLOSE_TAG
) {
$contents .= ' ?>'; $contents .= ' ?>';
} }

Some files were not shown because too many files have changed in this diff Show More