Convert if else statement to PSR-2 standard
This commit is contained in:
parent
f2df720bec
commit
e1a0c0b8c6
|
|
@ -26,7 +26,8 @@ class ConfigurationForm extends FormRequest
|
|||
{
|
||||
$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'))
|
||||
) {
|
||||
$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')
|
||||
) {
|
||||
$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')
|
||||
) {
|
||||
$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')
|
||||
) {
|
||||
$this->rules = array_merge($this->rules, [
|
||||
|
|
|
|||
|
|
@ -94,10 +94,16 @@ class AdminServiceProvider extends ServiceProvider
|
|||
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];
|
||||
|
||||
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) {
|
||||
if ($item['key'] == $value) {
|
||||
$neededItem = $allowedPermissions[$key + 1];
|
||||
|
|
|
|||
|
|
@ -469,7 +469,7 @@
|
|||
if (! this.idNullOption) {
|
||||
this.addOptionRow(true);
|
||||
}
|
||||
} elseif(this.idNullOption !== null && typeof this.idNullOption !== 'undefined') {
|
||||
} else if(this.idNullOption !== null && typeof this.idNullOption !== 'undefined') {
|
||||
const row = this.optionRows.find(optionRow => optionRow.id === this.idNullOption);
|
||||
this.removeRow(row);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@
|
|||
if (! this.idNullOption) {
|
||||
this.addOptionRow(true);
|
||||
}
|
||||
} elseif(this.idNullOption !== null && typeof this.idNullOption !== 'undefined') {
|
||||
} else if(this.idNullOption !== null && typeof this.idNullOption !== 'undefined') {
|
||||
const row = this.optionRows.find(optionRow => optionRow.id === this.idNullOption);
|
||||
this.removeRow(row);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@
|
|||
mounted () {
|
||||
if (this.image.id && this.image.url) {
|
||||
this.imageData = this.image.url;
|
||||
} elseif (this.image.id && this.image.file) {
|
||||
} else if (this.image.id && this.image.file) {
|
||||
this.readFile(this.image.file);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
foreach ($product->inventories as $inventory) {
|
||||
if ($inventory->inventory_source_id == $inventorySource->id) {
|
||||
$qty = $inventory->qty;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -521,7 +521,7 @@
|
|||
|
||||
if (image.id && image.url) {
|
||||
self.imageData.push(image.url);
|
||||
} elseif (image.id && image.file) {
|
||||
} else if (image.id && image.file) {
|
||||
self.readFile(image.file);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@
|
|||
mounted () {
|
||||
if (this.video.id && this.video.url) {
|
||||
this.videoData = this.video.url;
|
||||
} elseif (this.video.id && this.video.file) {
|
||||
} else if (this.video.id && this.video.file) {
|
||||
this.readFile(this.video.file);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -101,7 +101,10 @@
|
|||
@foreach ($customAttributes as $attribute)
|
||||
|
||||
<?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;
|
||||
}
|
||||
|
||||
|
|
@ -116,12 +119,14 @@
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
|
|
@ -164,8 +169,8 @@
|
|||
@include ($typeView)
|
||||
|
||||
<span class="control-error"
|
||||
@if ($attribute->type == 'multiselect') v-if="errors.has('{{ $attribute->code }}[]')"
|
||||
@else v-if="errors.has('{{ $attribute->code }}')" @endif>
|
||||
@if ($attribute->type == 'multiselect') v-if="errors.has('{{ $attribute->code }}[]')"
|
||||
@else v-if="errors.has('{{ $attribute->code }}')" @endif>
|
||||
@if ($attribute->type == 'multiselect')
|
||||
@{{ errors.first('{!! $attribute->code !!}[]') }}
|
||||
@else
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
|
||||
if (dependValue == 'true') {
|
||||
dependValue = 1;
|
||||
} elseif (dependValue == 'false') {
|
||||
} else if (dependValue == 'false') {
|
||||
dependValue = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,10 @@
|
|||
<span class="control-error" v-if="errors.has('address1[]')">@{{ errors.first('address1[]') }}</span>
|
||||
</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;">
|
||||
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
|
||||
<input type="text" class="control" name="address1[{{ $i }}]" id="address_{{ $i }}">
|
||||
|
|
|
|||
|
|
@ -69,7 +69,10 @@
|
|||
<span class="control-error" v-if="errors.has('address1[]')">@{{ errors.first('address1[]') }}</span>
|
||||
</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;">
|
||||
@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] : '' }}">
|
||||
|
|
|
|||
|
|
@ -67,8 +67,9 @@
|
|||
|
||||
methods: {
|
||||
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 false;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -120,15 +120,15 @@
|
|||
count = count + moveDown;
|
||||
|
||||
$('.navbar-left').css("top", count + "px");
|
||||
} elseif ((event.keyCode == 40) && count >= -differenceInHeight) {
|
||||
} else if ((event.keyCode == 40) && count >= -differenceInHeight) {
|
||||
count = count + moveUp;
|
||||
|
||||
$('.navbar-left').css("top", count + "px");
|
||||
} elseif ((event.keyCode == 33) && countKeyUp <= 0) {
|
||||
} else if ((event.keyCode == 33) && countKeyUp <= 0) {
|
||||
countKeyUp = countKeyUp + pageDown;
|
||||
|
||||
$('.navbar-left').css("top", countKeyUp + "px");
|
||||
} elseif ((event.keyCode == 34) && countKeyUp >= -differenceInHeight) {
|
||||
} else if ((event.keyCode == 34) && countKeyUp >= -differenceInHeight) {
|
||||
countKeyUp = countKeyUp + pageUp;
|
||||
|
||||
$('.navbar-left').css("top", countKeyUp + "px");
|
||||
|
|
|
|||
|
|
@ -134,12 +134,11 @@
|
|||
|
||||
if (toggle) {
|
||||
toggle.addEventListener("click", () => {
|
||||
if (nav.classList.contains("is-active")) {
|
||||
nav.classList.remove("is-active");
|
||||
}
|
||||
else {
|
||||
nav.classList.add("is-active");
|
||||
}
|
||||
if (nav.classList.contains("is-active")) {
|
||||
nav.classList.remove("is-active");
|
||||
} else {
|
||||
nav.classList.add("is-active");
|
||||
}
|
||||
});
|
||||
|
||||
nav.addEventListener("blur", () => {
|
||||
|
|
|
|||
|
|
@ -111,7 +111,10 @@
|
|||
</div>
|
||||
</accordian>
|
||||
|
||||
@if ($order->billing_address || $order->shipping_address)
|
||||
@if (
|
||||
$order->billing_address
|
||||
|| $order->shipping_address
|
||||
)
|
||||
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
|
||||
<div slot="body">
|
||||
<div class="sale">
|
||||
|
|
|
|||
|
|
@ -139,7 +139,10 @@
|
|||
</div>
|
||||
</accordian>
|
||||
|
||||
@if ($order->billing_address || $order->shipping_address)
|
||||
@if (
|
||||
$order->billing_address
|
||||
|| $order->shipping_address
|
||||
)
|
||||
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
|
||||
<div slot="body">
|
||||
<div class="sale">
|
||||
|
|
|
|||
|
|
@ -25,13 +25,19 @@
|
|||
<div class="page-action">
|
||||
{!! 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') }}'">
|
||||
{{ __('admin::app.sales.orders.cancel-btn-title') }}
|
||||
</a>
|
||||
@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">
|
||||
{{ __('admin::app.sales.orders.invoice-btn-title') }}
|
||||
</a>
|
||||
|
|
@ -139,7 +145,10 @@
|
|||
|
||||
{!! 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">
|
||||
<span class="title">
|
||||
{{ __('admin::app.customers.customers.customer_group') }}
|
||||
|
|
@ -159,7 +168,10 @@
|
|||
</div>
|
||||
</accordian>
|
||||
|
||||
@if ($order->billing_address || $order->shipping_address)
|
||||
@if (
|
||||
$order->billing_address
|
||||
|| $order->shipping_address
|
||||
)
|
||||
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
|
||||
<div slot="body">
|
||||
<div class="sale">
|
||||
|
|
|
|||
|
|
@ -110,7 +110,10 @@
|
|||
</div>
|
||||
</accordian>
|
||||
|
||||
@if ($order->billing_address || $order->shipping_address)
|
||||
@if (
|
||||
$order->billing_address
|
||||
|| $order->shipping_address
|
||||
)
|
||||
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,10 @@
|
|||
</div>
|
||||
</accordian>
|
||||
|
||||
@if ($order->billing_address || $order->shipping_address)
|
||||
@if (
|
||||
$order->billing_address
|
||||
|| $order->shipping_address
|
||||
)
|
||||
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
|
||||
<div slot="body">
|
||||
<div class="sale">
|
||||
|
|
|
|||
|
|
@ -110,7 +110,10 @@
|
|||
</div>
|
||||
</accordian>
|
||||
|
||||
@if ($order->billing_address || $order->shipping_address)
|
||||
@if (
|
||||
$order->billing_address
|
||||
|| $order->shipping_address
|
||||
)
|
||||
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
|
||||
<div slot="body">
|
||||
<div class="sale">
|
||||
|
|
@ -270,7 +273,10 @@
|
|||
<tbody>
|
||||
|
||||
@foreach ($order->items as $item)
|
||||
@if ($item->qty_to_ship > 0 && $item->product)
|
||||
@if (
|
||||
$item->qty_to_ship > 0
|
||||
&& $item->product
|
||||
)
|
||||
<tr>
|
||||
<td>{{ $item->getTypeInstance()->getOrderedItem($item)->sku }}</td>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -106,7 +106,10 @@
|
|||
</div>
|
||||
</accordian>
|
||||
|
||||
@if ($order->billing_address || $order->shipping_address)
|
||||
@if (
|
||||
$order->billing_address
|
||||
|| $order->shipping_address
|
||||
)
|
||||
<accordian title="{{ __('admin::app.sales.orders.address') }}" :active="true">
|
||||
<div slot="body">
|
||||
<div class="sale">
|
||||
|
|
@ -199,7 +202,10 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
@if ($shipment->inventory_source || $shipment->inventory_source_name)
|
||||
@if (
|
||||
$shipment->inventory_source
|
||||
|| $shipment->inventory_source_name
|
||||
)
|
||||
<div class="row">
|
||||
<span class="title">
|
||||
{{ __('admin::app.sales.shipments.inventory-source') }}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,10 @@
|
|||
<div class="control-group">
|
||||
<label>{{ __('velocity::app.admin.general.locale_logo') }}</label>
|
||||
|
||||
@if (isset($locale) && $locale->locale_image)
|
||||
@if (
|
||||
isset($locale)
|
||||
&& $locale->locale_image
|
||||
)
|
||||
<image-wrapper
|
||||
input-name="locale_image"
|
||||
:multiple="false"
|
||||
|
|
|
|||
|
|
@ -87,7 +87,11 @@ class ProductCategoryUniqueSlug implements Rule
|
|||
*/
|
||||
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)
|
||||
->where('slug', $slug)
|
||||
->limit(1)
|
||||
|
|
@ -109,7 +113,11 @@ class ProductCategoryUniqueSlug implements Rule
|
|||
*/
|
||||
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)
|
||||
->where('url_key', $slug)
|
||||
->limit(1)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,10 @@ class AttributeOption extends TranslatableModel implements AttributeOptionContra
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,10 @@ class AttributeFamilyRepository extends Repository
|
|||
$trimmed = [];
|
||||
|
||||
foreach ($attributeFamilies as $key => $attributeFamily) {
|
||||
if ($attributeFamily->name != null || $attributeFamily->name != "") {
|
||||
if (
|
||||
$attributeFamily->name != null
|
||||
|| $attributeFamily->name != ""
|
||||
) {
|
||||
$trimmed[$key] = [
|
||||
'id' => $attributeFamily->id,
|
||||
'code' => $attributeFamily->code,
|
||||
|
|
|
|||
|
|
@ -52,7 +52,10 @@ class AttributeOptionRepository extends Repository
|
|||
*/
|
||||
public function uploadSwatchImage($data, $optionId)
|
||||
{
|
||||
if (! isset($data['swatch_value']) || ! $data['swatch_value']) {
|
||||
if (
|
||||
! isset($data['swatch_value'])
|
||||
|| ! $data['swatch_value']
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,10 @@ class AttributeRepository extends Repository
|
|||
|
||||
$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) {
|
||||
$this->attributeOptionRepository->create(array_merge([
|
||||
'attribute_id' => $attribute->id,
|
||||
|
|
@ -169,7 +172,10 @@ class AttributeRepository extends Repository
|
|||
{
|
||||
$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', [
|
||||
'name',
|
||||
'description',
|
||||
|
|
|
|||
|
|
@ -173,7 +173,10 @@ class Booking
|
|||
$date = clone $currentTime;
|
||||
$date->addDays($i);
|
||||
|
||||
if ($date >= $availableFrom && $date <= $availableTo) {
|
||||
if (
|
||||
$date >= $availableFrom
|
||||
&& $date <= $availableTo
|
||||
) {
|
||||
$days[$i] = $date->format('l');
|
||||
}
|
||||
}
|
||||
|
|
@ -235,7 +238,10 @@ class Booking
|
|||
{
|
||||
$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 [];
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +261,8 @@ class Booking
|
|||
? $bookingProductSlot->slots
|
||||
: ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []);
|
||||
|
||||
if ($requestedDate < $availableFrom
|
||||
if (
|
||||
$requestedDate < $availableFrom
|
||||
|| $requestedDate > $availableTo
|
||||
) {
|
||||
return [];
|
||||
|
|
@ -289,17 +296,32 @@ class Booking
|
|||
|
||||
$to = clone $tempStartDayTime;
|
||||
|
||||
if (($startDayTime <= $from && $from <= $availableTo)
|
||||
&& ($availableTo >= $to && $to >= $startDayTime)
|
||||
&& ($startDayTime <= $from && $from <= $endDayTime)
|
||||
&& ($endDayTime >= $to && $to >= $startDayTime)
|
||||
if (
|
||||
($startDayTime <= $from
|
||||
&& $from <= $availableTo
|
||||
)
|
||||
&& (
|
||||
$availableTo >= $to
|
||||
&& $to >= $startDayTime
|
||||
)
|
||||
&& (
|
||||
$startDayTime <= $from
|
||||
&& $from <= $endDayTime
|
||||
)
|
||||
&& (
|
||||
$endDayTime >= $to
|
||||
&& $to >= $startDayTime
|
||||
)
|
||||
) {
|
||||
// Get already ordered qty for this slot
|
||||
$orderedQty = 0;
|
||||
|
||||
$qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1;
|
||||
|
||||
if ($qty && $currentTime <= $from) {
|
||||
if (
|
||||
$qty
|
||||
&& $currentTime <= $from
|
||||
) {
|
||||
$slots[] = [
|
||||
'from' => $from->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']);
|
||||
|
||||
if ($bookingProduct->qty - $this->getBookedQuantity($cartItem) < $cartItem['quantity'] || $this->isSlotExpired($cartItem)) {
|
||||
if (
|
||||
$bookingProduct->qty - $this->getBookedQuantity($cartItem) < $cartItem['quantity']
|
||||
|| $this->isSlotExpired($cartItem)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@ class DefaultSlot extends Booking
|
|||
{
|
||||
$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 [];
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +41,8 @@ class DefaultSlot extends Booking
|
|||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
if ($requestedDate < $availableFrom
|
||||
if (
|
||||
$requestedDate < $availableFrom
|
||||
|| $requestedDate > $availableTo
|
||||
) {
|
||||
return [];
|
||||
|
|
@ -110,7 +114,10 @@ class DefaultSlot extends Booking
|
|||
|
||||
$timeDuration = $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
|
||||
|
||||
if (! count($timeDuration) || ! $timeDuration['status']) {
|
||||
if (
|
||||
! count($timeDuration)
|
||||
|| ! $timeDuration['status']
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
@ -141,17 +148,33 @@ class DefaultSlot extends Booking
|
|||
|
||||
$to = clone $tempStartDayTime;
|
||||
|
||||
if (($startDayTime <= $from && $from <= $availableTo)
|
||||
&& ($availableTo >= $to && $to >= $startDayTime)
|
||||
&& ($startDayTime <= $from && $from <= $endDayTime)
|
||||
&& ($endDayTime >= $to && $to >= $startDayTime)
|
||||
if (
|
||||
(
|
||||
$startDayTime <= $from
|
||||
&& $from <= $availableTo
|
||||
)
|
||||
&& (
|
||||
$availableTo >= $to
|
||||
&& $to >= $startDayTime
|
||||
)
|
||||
&& (
|
||||
$startDayTime <= $from
|
||||
&& $from <= $endDayTime
|
||||
)
|
||||
&& (
|
||||
$endDayTime >= $to
|
||||
&& $to >= $startDayTime
|
||||
)
|
||||
) {
|
||||
// Get already ordered qty for this slot
|
||||
$orderedQty = 0;
|
||||
|
||||
$qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1;
|
||||
|
||||
if ($qty && $currentTime <= $from) {
|
||||
if (
|
||||
$qty
|
||||
&& $currentTime <= $from
|
||||
) {
|
||||
$slots[] = [
|
||||
'from' => $from->format('h:i A'),
|
||||
'to' => $to->format('h:i A'),
|
||||
|
|
|
|||
|
|
@ -21,7 +21,10 @@ class RentalSlot extends Booking
|
|||
{
|
||||
$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 [];
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +44,8 @@ class RentalSlot extends Booking
|
|||
? $bookingProductSlot->slots
|
||||
: $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
|
||||
|
||||
if ($requestedDate < $availableFrom
|
||||
if (
|
||||
$requestedDate < $availableFrom
|
||||
|| $requestedDate > $availableTo
|
||||
) {
|
||||
return [];
|
||||
|
|
@ -66,17 +70,33 @@ class RentalSlot extends Booking
|
|||
|
||||
$to = clone $tempStartDayTime;
|
||||
|
||||
if (($startDayTime <= $from && $from <= $availableTo)
|
||||
&& ($availableTo >= $to && $to >= $startDayTime)
|
||||
&& ($startDayTime <= $from && $from <= $endDayTime)
|
||||
&& ($endDayTime >= $to && $to >= $startDayTime)
|
||||
if (
|
||||
(
|
||||
$startDayTime <= $from
|
||||
&& $from <= $availableTo
|
||||
)
|
||||
&& (
|
||||
$availableTo >= $to
|
||||
&& $to >= $startDayTime
|
||||
)
|
||||
&& (
|
||||
$startDayTime <= $from
|
||||
&& $from <= $endDayTime
|
||||
)
|
||||
&& (
|
||||
$endDayTime >= $to
|
||||
&& $to >= $startDayTime
|
||||
)
|
||||
) {
|
||||
// Get already ordered qty for this slot
|
||||
$orderedQty = 0;
|
||||
|
||||
$qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1;
|
||||
|
||||
if ($qty && $currentTime <= $from) {
|
||||
if (
|
||||
$qty
|
||||
&& $currentTime <= $from
|
||||
) {
|
||||
if (! isset($slots[$index])) {
|
||||
$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('2080-01-01 00:00:00');
|
||||
|
||||
if ($requestedFromDate < $availableFrom
|
||||
if (
|
||||
$requestedFromDate < $availableFrom
|
||||
|| $requestedFromDate > $availableTo
|
||||
|| $requestedToDate < $availableFrom
|
||||
|| $requestedToDate > $availableTo
|
||||
|
|
@ -242,7 +263,8 @@ class RentalSlot extends Booking
|
|||
$rentingType = $item->additional['booking']['renting_type'] ?? $bookingProduct->rental_slot->renting_type;
|
||||
|
||||
if ($rentingType == 'daily') {
|
||||
if (! isset($item->additional['booking']['date_from'])
|
||||
if (
|
||||
! isset($item->additional['booking']['date_from'])
|
||||
|| ! isset($item->additional['booking']['date_to'])
|
||||
) {
|
||||
$result->itemIsInactive();
|
||||
|
|
@ -255,7 +277,8 @@ class RentalSlot extends Booking
|
|||
|
||||
$price += $bookingProduct->rental_slot->daily_price * $to->diffInDays($from);
|
||||
} else {
|
||||
if (! isset($item->additional['booking']['slot']['from'])
|
||||
if (
|
||||
! isset($item->additional['booking']['slot']['from'])
|
||||
|| ! isset($item->additional['booking']['slot']['to'])
|
||||
) {
|
||||
$result->itemIsInactive();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@ class TableSlot extends Booking
|
|||
$bookedQty *= $bookingProduct->table_slot->guest_limit;
|
||||
}
|
||||
|
||||
if ($bookingProduct->qty - $bookedQty < $requestedQty || $this->isSlotExpired($cartItem)) {
|
||||
if (
|
||||
$bookingProduct->qty - $bookedQty < $requestedQty
|
||||
|| $this->isSlotExpired($cartItem)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,10 @@ class BookingProductRepository extends Repository
|
|||
*/
|
||||
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++) {
|
||||
if (! isset($data['slots'][$i])) {
|
||||
$data['slots'][$i] = [];
|
||||
|
|
@ -183,8 +186,15 @@ class BookingProductRepository extends Repository
|
|||
$isOverLapping = false;
|
||||
|
||||
foreach ($tempSlots as $slot) {
|
||||
if (($slot['from'] <= $from && $slot['to'] >= $from)
|
||||
|| ($slot['from'] <= $to && $slot['to'] >= $to)
|
||||
if (
|
||||
(
|
||||
$slot['from'] <= $from
|
||||
&& $slot['to'] >= $from
|
||||
)
|
||||
|| (
|
||||
$slot['from'] <= $to
|
||||
&& $slot['to'] >= $to
|
||||
)
|
||||
) {
|
||||
$isOverLapping = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,10 @@ class BookingRepository extends Repository
|
|||
$from = $to = null;
|
||||
|
||||
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'];
|
||||
|
||||
$to = $item->additional['booking']['slot']['to'];
|
||||
|
|
@ -48,7 +51,10 @@ class BookingRepository extends Repository
|
|||
|
||||
$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();
|
||||
|
||||
$to = Carbon::createFromTimeString($item->additional['booking']['date_to'] . ' 23:59:59')->getTimestamp();
|
||||
|
|
|
|||
|
|
@ -241,8 +241,9 @@
|
|||
if (this.default_booking.booking_type == 'one') {
|
||||
this.slots['one'] = this.default_booking.slots ? this.default_booking.slots : [];
|
||||
} else {
|
||||
if (this.default_booking.slots)
|
||||
if (this.default_booking.slots) {
|
||||
this.slots['many'] = this.default_booking.slots;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -170,8 +170,9 @@
|
|||
|
||||
computed: {
|
||||
controlName: function () {
|
||||
if (this.ticketItem.id)
|
||||
if (this.ticketItem.id) {
|
||||
return 'booking[tickets][' + this.ticketItem.id + ']';
|
||||
}
|
||||
|
||||
return 'booking[tickets][ticket_' + this.index + ']';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,8 +136,9 @@
|
|||
},
|
||||
|
||||
created: function() {
|
||||
if (! bookingProduct || ! bookingProduct[this.bookingType].slots || ! bookingProduct[this.bookingType].slots)
|
||||
if (! bookingProduct || ! bookingProduct[this.bookingType].slots || ! bookingProduct[this.bookingType].slots) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bookingProduct[this.bookingType].same_slot_all_days) {
|
||||
this.slots['same_for_week'] = bookingProduct[this.bookingType].slots;
|
||||
|
|
@ -149,8 +150,9 @@
|
|||
methods: {
|
||||
addSlot: function (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] = [];
|
||||
}
|
||||
|
||||
var slot = {
|
||||
'from': '',
|
||||
|
|
|
|||
|
|
@ -36,7 +36,10 @@
|
|||
<td>{{ $day['name'] }}</td>
|
||||
|
||||
<td>
|
||||
@if ($day['slots'] && count($day['slots']))
|
||||
@if (
|
||||
$day['slots']
|
||||
&& count($day['slots'])
|
||||
)
|
||||
@foreach ($day['slots'] as $slot)
|
||||
{{ $slot['from'] . ' - ' . $slot['to'] }}</br>
|
||||
@endforeach
|
||||
|
|
|
|||
|
|
@ -36,7 +36,10 @@
|
|||
<td>{{ $day['name'] }}</td>
|
||||
|
||||
<td>
|
||||
@if ($day['slots'] && count($day['slots']))
|
||||
@if (
|
||||
$day['slots']
|
||||
&& count($day['slots'])
|
||||
)
|
||||
@foreach ($day['slots'] as $slot)
|
||||
{{ $slot['from'] . ' - ' . $slot['to'] }}</br>
|
||||
@endforeach
|
||||
|
|
|
|||
|
|
@ -36,7 +36,10 @@
|
|||
<td>{{ $day['name'] }}</td>
|
||||
|
||||
<td>
|
||||
@if ($day['slots'] && count($day['slots']))
|
||||
@if (
|
||||
$day['slots']
|
||||
&& count($day['slots'])
|
||||
)
|
||||
@foreach ($day['slots'] as $slot)
|
||||
{{ $slot['from'] . ' - ' . $slot['to'] }}</br>
|
||||
@endforeach
|
||||
|
|
|
|||
|
|
@ -161,7 +161,10 @@ class Booking extends Virtual
|
|||
*/
|
||||
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');
|
||||
}
|
||||
|
||||
|
|
@ -170,7 +173,10 @@ class Booking extends Virtual
|
|||
$bookingProduct = $this->getBookingProduct($data['product_id']);
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
|
|
@ -225,10 +231,12 @@ class Booking extends Virtual
|
|||
return false;
|
||||
}
|
||||
|
||||
if (isset($options1['booking'], $options2['booking'])
|
||||
if (
|
||||
isset($options1['booking'], $options2['booking'])
|
||||
&& isset($options1['booking']['ticket_id'], $options2['booking']['ticket_id'])
|
||||
&& $options1['booking']['ticket_id'] === $options2['booking']['ticket_id']) {
|
||||
return true;
|
||||
&& $options1['booking']['ticket_id'] === $options2['booking']['ticket_id']
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,10 @@ class CartRule
|
|||
|
||||
$appliedCartRuleIds = array_merge($appliedCartRuleIds, $itemCartRuleIds);
|
||||
|
||||
if ($item->children()->count() && $item->product->getTypeInstance()->isChildrenCalculated()) {
|
||||
if (
|
||||
$item->children()->count()
|
||||
&& $item->product->getTypeInstance()->isChildrenCalculated()
|
||||
) {
|
||||
$this->divideDiscount($item);
|
||||
}
|
||||
}
|
||||
|
|
@ -91,7 +94,10 @@ class CartRule
|
|||
public static $cartID;
|
||||
};
|
||||
|
||||
if ($staticCartRules::$cartID === $cart->id && $staticCartRules::$cartRules) {
|
||||
if (
|
||||
$staticCartRules::$cartID === $cart->id
|
||||
&& $staticCartRules::$cartRules
|
||||
) {
|
||||
return $staticCartRules::$cartRules;
|
||||
}
|
||||
|
||||
|
|
@ -132,18 +138,30 @@ class CartRule
|
|||
// reasons (cart_rule_coupon-relation is pre-loaded by self::getCartRuleQuery())
|
||||
$coupon = $rule->cart_rule_coupon()->where('code', $cart->coupon_code)->first();
|
||||
|
||||
if ($coupon && $coupon->code === $cart->coupon_code) {
|
||||
if ($coupon->usage_limit && $coupon->times_used >= $coupon->usage_limit) {
|
||||
if (
|
||||
$coupon
|
||||
&& $coupon->code === $cart->coupon_code
|
||||
) {
|
||||
if (
|
||||
$coupon->usage_limit
|
||||
&& $coupon->times_used >= $coupon->usage_limit
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($cart->customer_id && $coupon->usage_per_customer) {
|
||||
if (
|
||||
$cart->customer_id
|
||||
&& $coupon->usage_per_customer
|
||||
) {
|
||||
$couponUsage = $this->cartRuleCouponUsageRepository->findOneWhere([
|
||||
'cart_rule_coupon_id' => $coupon->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;
|
||||
}
|
||||
}
|
||||
|
|
@ -161,7 +179,10 @@ class CartRule
|
|||
'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;
|
||||
}
|
||||
}
|
||||
|
|
@ -209,7 +230,10 @@ class CartRule
|
|||
|
||||
$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);
|
||||
|
||||
$item->discount_percent = $discountPercent;
|
||||
|
|
@ -242,7 +266,10 @@ class CartRule
|
|||
break;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +341,10 @@ class CartRule
|
|||
continue;
|
||||
}
|
||||
|
||||
if (! $rule || ! $rule->apply_to_shipping) {
|
||||
if (
|
||||
! $rule
|
||||
|| ! $rule->apply_to_shipping
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -400,7 +430,10 @@ class CartRule
|
|||
continue;
|
||||
}
|
||||
|
||||
if (! $rule || ! $rule->free_shipping) {
|
||||
if (
|
||||
! $rule
|
||||
|| ! $rule->free_shipping
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class CartRule extends Model implements CartRuleContract
|
|||
$coupon = $this->coupon_code()
|
||||
->first();
|
||||
|
||||
if (!$coupon) {
|
||||
if (! $coupon) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,10 @@ class CartRuleRepository extends Repository
|
|||
|
||||
$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([
|
||||
'cart_rule_id' => $cartRule->id,
|
||||
'code' => $data['coupon_code'],
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ class CatalogRuleProduct
|
|||
$appliedAttributes = [];
|
||||
|
||||
foreach ($rule->conditions as $condition) {
|
||||
if (! $condition['attribute']
|
||||
if (
|
||||
! $condition['attribute']
|
||||
|| ! isset($condition['value'])
|
||||
|| is_null($condition['value'])
|
||||
|| $condition['value'] == ''
|
||||
|
|
|
|||
|
|
@ -48,7 +48,10 @@ class CatalogRuleProductPrice
|
|||
foreach ($catalogRuleProducts as $row) {
|
||||
$productKey = $row->product_id . '-' . $row->channel_id . '-' . $row->customer_group_id;
|
||||
|
||||
if ($previousKey && $previousKey != $productKey) {
|
||||
if (
|
||||
$previousKey
|
||||
&& $previousKey != $productKey
|
||||
) {
|
||||
$endRuleFlags = [];
|
||||
|
||||
if (count($prices) > $batchCount) {
|
||||
|
|
@ -59,8 +62,15 @@ class CatalogRuleProductPrice
|
|||
}
|
||||
|
||||
foreach ($dates as $key => $date) {
|
||||
if ((! $row->starts_from || $date >= $row->starts_from)
|
||||
&& (! $row->ends_till || $date <= $row->ends_till)
|
||||
if (
|
||||
(
|
||||
! $row->starts_from
|
||||
|| $date >= $row->starts_from
|
||||
)
|
||||
&& (
|
||||
! $row->ends_till
|
||||
|| $date <= $row->ends_till
|
||||
)
|
||||
) {
|
||||
$priceKey = $date->getTimestamp() . '-' . $productKey;
|
||||
|
||||
|
|
|
|||
|
|
@ -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']));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,10 @@ class CategoryRepository extends Repository
|
|||
{
|
||||
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());
|
||||
|
||||
foreach (core()->getAllLocales() as $locale) {
|
||||
|
|
@ -268,7 +271,10 @@ class CategoryRepository extends Repository
|
|||
$trimmed = [];
|
||||
|
||||
foreach ($categories as $key => $category) {
|
||||
if ($category->name != null || $category->name != '') {
|
||||
if (
|
||||
$category->name != null
|
||||
|| $category->name != ''
|
||||
) {
|
||||
$trimmed[$key] = [
|
||||
'id' => $category->id,
|
||||
'name' => $category->name,
|
||||
|
|
|
|||
|
|
@ -152,7 +152,10 @@ class Cart
|
|||
|
||||
$cart = $this->getCart();
|
||||
|
||||
if (! $cart && ! $cart = $this->create($data)) {
|
||||
if (
|
||||
! $cart
|
||||
&& ! $cart = $this->create($data)
|
||||
) {
|
||||
return ['warning' => __('shop::app.checkout.cart.item.error-add')];
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +188,10 @@ class Cart
|
|||
if (! $cartItem) {
|
||||
$cartItem = $this->cartItemRepository->create(array_merge($cartProduct, ['cart_id' => $cart->id]));
|
||||
} 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, [
|
||||
'cart_id' => $cart->id,
|
||||
]));
|
||||
|
|
@ -271,7 +277,10 @@ class Cart
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($item->product && $item->product->status === 0) {
|
||||
if (
|
||||
$item->product
|
||||
&& $item->product->status === 0
|
||||
) {
|
||||
throw new Exception(__('shop::app.checkout.cart.item.inactive'));
|
||||
}
|
||||
|
||||
|
|
@ -408,7 +417,8 @@ class Cart
|
|||
if (
|
||||
auth()->guard()->check()
|
||||
&& ($user = auth()->guard()->user())
|
||||
&& ($user->email
|
||||
&& (
|
||||
$user->email
|
||||
&& $user->first_name
|
||||
&&
|
||||
$user->last_name
|
||||
|
|
@ -739,7 +749,10 @@ class Cart
|
|||
'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) {
|
||||
/**
|
||||
* - For bundle, child quantity will not be zero.
|
||||
|
|
@ -856,11 +869,17 @@ class Cart
|
|||
): void {
|
||||
$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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -876,7 +895,10 @@ class Cart
|
|||
{
|
||||
$customerAddress = [];
|
||||
|
||||
if (isset($data['billing']['address_id']) && $data['billing']['address_id']) {
|
||||
if (
|
||||
isset($data['billing']['address_id'])
|
||||
&& $data['billing']['address_id']
|
||||
) {
|
||||
$customerAddress = $this
|
||||
->customerAddressRepository
|
||||
->findOneWhere(['id' => $data['billing']['address_id']])
|
||||
|
|
@ -905,7 +927,10 @@ class Cart
|
|||
{
|
||||
$customerAddress = [];
|
||||
|
||||
if (isset($data['shipping']['address_id']) && $data['shipping']['address_id']) {
|
||||
if (
|
||||
isset($data['shipping']['address_id'])
|
||||
&& $data['shipping']['address_id']
|
||||
) {
|
||||
$customerAddress = $this
|
||||
->customerAddressRepository
|
||||
->findOneWhere(['id' => $data['shipping']['address_id']])
|
||||
|
|
@ -937,22 +962,33 @@ class Cart
|
|||
array $shippingAddressData
|
||||
): void {
|
||||
$billingAddressModel = $cart->billing_address;
|
||||
|
||||
if ($billingAddressModel) {
|
||||
$billingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_BILLING;
|
||||
|
||||
$this->cartAddressRepository->update($billingAddressData, $billingAddressModel->id);
|
||||
|
||||
if ($cart->haveStockableItems()) {
|
||||
$shippingAddressModel = $cart->shipping_address;
|
||||
|
||||
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;
|
||||
|
||||
$this->cartAddressRepository->update($billingAddressData, $shippingAddressModel->id);
|
||||
} else {
|
||||
$shippingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_SHIPPING;
|
||||
|
||||
$this->cartAddressRepository->update($shippingAddressData, $shippingAddressModel->id);
|
||||
}
|
||||
} 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(
|
||||
$billingAddressData,
|
||||
['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING]
|
||||
|
|
@ -969,7 +1005,10 @@ class Cart
|
|||
$this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_BILLING]));
|
||||
|
||||
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]));
|
||||
} else {
|
||||
$this->cartAddressRepository->create(array_merge($shippingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING]));
|
||||
|
|
|
|||
|
|
@ -38,7 +38,10 @@ class CustomerAddressForm extends FormRequest
|
|||
$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'])) {
|
||||
$this->mergeExistingAddressRules('shipping');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -489,7 +489,10 @@ class Core
|
|||
{
|
||||
static $exchangeRate;
|
||||
|
||||
if ($exchangeRate || $exchangeRate === '') {
|
||||
if (
|
||||
$exchangeRate
|
||||
|| $exchangeRate === ''
|
||||
) {
|
||||
return $exchangeRate;
|
||||
}
|
||||
|
||||
|
|
@ -538,7 +541,11 @@ class Core
|
|||
|
||||
$exchangeRate = $this->getExchangeRate($targetCurrency->id);
|
||||
|
||||
if ('' === $exchangeRate || null === $exchangeRate || ! $exchangeRate->rate) {
|
||||
if (
|
||||
'' === $exchangeRate
|
||||
|| null === $exchangeRate
|
||||
|| ! $exchangeRate->rate
|
||||
) {
|
||||
return $amount;
|
||||
}
|
||||
|
||||
|
|
@ -572,7 +579,10 @@ class Core
|
|||
'target_currency' => $targetCurrency->id,
|
||||
]);
|
||||
|
||||
if (null === $exchangeRate || ! $exchangeRate->rate) {
|
||||
if (
|
||||
null === $exchangeRate
|
||||
|| ! $exchangeRate->rate
|
||||
) {
|
||||
return $amount;
|
||||
}
|
||||
|
||||
|
|
@ -716,9 +726,15 @@ class Core
|
|||
$toTimeStamp += 86400;
|
||||
}
|
||||
|
||||
if (! $this->is_empty_date($dateFrom) && $channelTimeStamp < $fromTimeStamp) {
|
||||
if (
|
||||
! $this->is_empty_date($dateFrom)
|
||||
&& $channelTimeStamp < $fromTimeStamp
|
||||
) {
|
||||
$result = false;
|
||||
} elseif (! $this->is_empty_date($dateTo) && $channelTimeStamp > $toTimeStamp) {
|
||||
} elseif (
|
||||
! $this->is_empty_date($dateTo)
|
||||
&& $channelTimeStamp > $toTimeStamp
|
||||
) {
|
||||
$result = false;
|
||||
} else {
|
||||
$result = true;
|
||||
|
|
@ -791,7 +807,10 @@ class Core
|
|||
{
|
||||
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];
|
||||
} else {
|
||||
if (null === $channel) {
|
||||
|
|
@ -1103,7 +1122,10 @@ class Core
|
|||
while (count($keys) > 1) {
|
||||
$key = array_shift($keys);
|
||||
|
||||
if (! isset($array[$key]) || ! is_array($array[$key])) {
|
||||
if (
|
||||
! isset($array[$key])
|
||||
|| ! is_array($array[$key])
|
||||
) {
|
||||
$array[$key] = [];
|
||||
}
|
||||
|
||||
|
|
@ -1212,7 +1234,11 @@ class Core
|
|||
$merged = $array1;
|
||||
|
||||
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);
|
||||
} else {
|
||||
$merged[$key] = $value;
|
||||
|
|
@ -1234,8 +1260,14 @@ class Core
|
|||
{
|
||||
$fields = $this->getConfigField($field);
|
||||
|
||||
if (isset($fields['channel_based']) && $fields['channel_based']) {
|
||||
if (isset($fields['locale_based']) && $fields['locale_based']) {
|
||||
if (
|
||||
isset($fields['channel_based'])
|
||||
&& $fields['channel_based']
|
||||
) {
|
||||
if (
|
||||
isset($fields['locale_based'])
|
||||
&& $fields['locale_based']
|
||||
) {
|
||||
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
|
||||
'code' => $field,
|
||||
'channel_code' => $channel,
|
||||
|
|
@ -1248,7 +1280,10 @@ class Core
|
|||
]);
|
||||
}
|
||||
} else {
|
||||
if (isset($fields['locale_based']) && $fields['locale_based']) {
|
||||
if (
|
||||
isset($fields['locale_based'])
|
||||
&& $fields['locale_based']
|
||||
) {
|
||||
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
|
||||
'code' => $field,
|
||||
'locale_code' => $locale,
|
||||
|
|
|
|||
|
|
@ -57,7 +57,10 @@ class ExchangeRates extends ExchangeRate
|
|||
|
||||
$result = json_decode($result->getBody()->getContents(), true);
|
||||
|
||||
if (isset($result['success']) && ! $result['success']) {
|
||||
if (
|
||||
isset($result['success'])
|
||||
&& ! $result['success']
|
||||
) {
|
||||
throw new \Exception(
|
||||
isset($result['error']['info'])
|
||||
? $result['error']['info']
|
||||
|
|
|
|||
|
|
@ -57,7 +57,10 @@ class FixerExchange extends ExchangeRate
|
|||
|
||||
$result = json_decode($result->getBody()->getContents(), true);
|
||||
|
||||
if (isset($result['success']) && ! $result['success']) {
|
||||
if (
|
||||
isset($result['success'])
|
||||
&& ! $result['success']
|
||||
) {
|
||||
throw new \Exception(
|
||||
isset($result['error']['info'])
|
||||
? $result['error']['info']
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@ class CoreConfigRepository extends Repository
|
|||
{
|
||||
Event::dispatch('core.configuration.save.before');
|
||||
|
||||
if ($data['locale'] || $data['channel']) {
|
||||
if (
|
||||
$data['locale']
|
||||
|| $data['channel']
|
||||
) {
|
||||
$locale = $data['locale'];
|
||||
$channel = $data['channel'];
|
||||
|
||||
|
|
@ -51,12 +54,21 @@ class CoreConfigRepository extends Repository
|
|||
|
||||
$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);
|
||||
}
|
||||
|
||||
if (isset($field['channel_based']) && $field['channel_based']) {
|
||||
if (isset($field['locale_based']) && $field['locale_based']) {
|
||||
if (
|
||||
isset($field['channel_based'])
|
||||
&& $field['channel_based']
|
||||
) {
|
||||
if (
|
||||
isset($field['locale_based'])
|
||||
&& $field['locale_based']
|
||||
) {
|
||||
$coreConfigValue = $this->model
|
||||
->where('code', $fieldName)
|
||||
->where('locale_code', $locale)
|
||||
|
|
@ -69,7 +81,10 @@ class CoreConfigRepository extends Repository
|
|||
->get();
|
||||
}
|
||||
} else {
|
||||
if (isset($field['locale_based']) && $field['locale_based']) {
|
||||
if (
|
||||
isset($field['locale_based'])
|
||||
&& $field['locale_based']
|
||||
) {
|
||||
$coreConfigValue = $this->model
|
||||
->where('code', $fieldName)
|
||||
->where('locale_code', $locale)
|
||||
|
|
|
|||
|
|
@ -109,11 +109,17 @@ trait CoreConfigField
|
|||
{
|
||||
$info = [];
|
||||
|
||||
if (isset($field['channel_based']) && $field['channel_based']) {
|
||||
if (
|
||||
isset($field['channel_based'])
|
||||
&& $field['channel_based']
|
||||
) {
|
||||
$info[] = $channel;
|
||||
}
|
||||
|
||||
if (isset($field['locale_based']) && $field['locale_based']) {
|
||||
if (
|
||||
isset($field['locale_based'])
|
||||
&& $field['locale_based']
|
||||
) {
|
||||
$info[] = $locale;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,10 @@ class Tree {
|
|||
{
|
||||
$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';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ class BladeCompiler extends BaseBladeCompiler
|
|||
{
|
||||
$tokens = $this->getOpenAndClosingPhpTokens($contents);
|
||||
|
||||
if (config('view.tracer')
|
||||
if (
|
||||
config('view.tracer')
|
||||
&& strpos($this->getPath(), 'tracer/style.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>';
|
||||
}
|
||||
|
||||
if ($tokens->isNotEmpty() && $tokens->last() !== T_CLOSE_TAG) {
|
||||
if (
|
||||
$tokens->isNotEmpty()
|
||||
&& $tokens->last() !== T_CLOSE_TAG
|
||||
) {
|
||||
$contents .= ' ?>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,14 +72,20 @@ class CustomerController extends Controller
|
|||
|
||||
$data = $customerProfileRequest->validated();
|
||||
|
||||
if (isset($data['date_of_birth']) && $data['date_of_birth'] == '') {
|
||||
if (
|
||||
isset($data['date_of_birth'])
|
||||
&& $data['date_of_birth'] == ''
|
||||
) {
|
||||
unset($data['date_of_birth']);
|
||||
}
|
||||
|
||||
$data['subscribed_to_news_letter'] = isset($data['subscribed_to_news_letter']) ? 1 : 0;
|
||||
|
||||
if (isset($data['oldpassword'])) {
|
||||
if ($data['oldpassword'] != '' || $data['oldpassword'] != null) {
|
||||
if (
|
||||
$data['oldpassword'] != ''
|
||||
|| $data['oldpassword'] != null
|
||||
) {
|
||||
if (Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) {
|
||||
$isPasswordChanged = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,10 @@ class WishlistController extends Controller
|
|||
'customer_id' => $this->currentCustomer->id,
|
||||
]);
|
||||
|
||||
if ($product->parent && $product->parent->type !== 'configurable') {
|
||||
if (
|
||||
$product->parent
|
||||
&& $product->parent->type !== 'configurable'
|
||||
) {
|
||||
$product = $this->productRepository->findOneByField('id', $product->parent_id);
|
||||
$data['product_id'] = $product->id;
|
||||
}
|
||||
|
|
@ -128,7 +131,10 @@ class WishlistController extends Controller
|
|||
|
||||
$updateCounts = $this->currentCustomer->wishlist_items()->update(['shared' => $data['shared']]);
|
||||
|
||||
if ($updateCounts && $updateCounts > 0) {
|
||||
if (
|
||||
$updateCounts
|
||||
&& $updateCounts > 0
|
||||
) {
|
||||
return response()->json([
|
||||
'isWishlistShared' => $this->currentCustomer->isWishlistShared(),
|
||||
'wishlistSharedLink' => $this->currentCustomer->getWishlistSharedLink()
|
||||
|
|
@ -158,7 +164,10 @@ class WishlistController extends Controller
|
|||
|
||||
$items = $customer->wishlist_items()->where('shared', 1)->get();
|
||||
|
||||
if ($customer && $items->isNotEmpty()) {
|
||||
if (
|
||||
$customer
|
||||
&& $items->isNotEmpty()
|
||||
) {
|
||||
return view($this->_config['view'], compact('customer', 'items'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,10 @@ class CustomerAddressRepository extends Repository
|
|||
->findWhere(['customer_id' => $data['customer_id'], 'default_address' => 1])
|
||||
->first();
|
||||
|
||||
if (isset($default_address->id) && $data['default_address']) {
|
||||
if (
|
||||
isset($default_address->id)
|
||||
&& $data['default_address']
|
||||
) {
|
||||
$default_address->update(['default_address' => 0]);
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +62,10 @@ class CustomerAddressRepository extends Repository
|
|||
->findWhere(['customer_id' => $address->customer_id, 'default_address' => 1])
|
||||
->first();
|
||||
|
||||
if (isset($default_address->id) && $data['default_address']) {
|
||||
if (
|
||||
isset($default_address->id)
|
||||
&& $data['default_address']
|
||||
) {
|
||||
if ($default_address->id != $address->id) {
|
||||
$default_address->update(['default_address' => 0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,10 @@ class ModuleCollector extends DataCollector implements DataCollectorInterface, R
|
|||
? "/\?(?=(?:[^'\\\']*'[^'\\\']*')*[^'\\\']*$)/"
|
||||
: "/:{$key}(?=(?:[^'\\\']*'[^'\\\']*')*[^'\\\']*$)/";
|
||||
|
||||
if (! is_int($binding) && ! is_float($binding)) {
|
||||
if (
|
||||
! is_int($binding)
|
||||
&& ! is_float($binding)
|
||||
) {
|
||||
$binding = $query->connection->getPdo()->quote($binding);
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +102,10 @@ class ModuleCollector extends DataCollector implements DataCollectorInterface, R
|
|||
public function checkBindings($bindings)
|
||||
{
|
||||
foreach ($bindings as &$binding) {
|
||||
if (is_string($binding) && ! mb_check_encoding($binding, 'UTF-8')) {
|
||||
if (
|
||||
is_string($binding)
|
||||
&& ! mb_check_encoding($binding, 'UTF-8')
|
||||
) {
|
||||
$binding = '[BINARY DATA]';
|
||||
}
|
||||
}
|
||||
|
|
@ -135,7 +141,11 @@ class ModuleCollector extends DataCollector implements DataCollectorInterface, R
|
|||
|
||||
$queries = $this->getQueries($module->getNamespaceRoot());
|
||||
|
||||
if (count($models) || count($views) || count($queries)) {
|
||||
if (
|
||||
count($models)
|
||||
|| count($views)
|
||||
|| count($queries)
|
||||
) {
|
||||
$modules[] = [
|
||||
'name' => $module->getNamespaceRoot(),
|
||||
'models' => $models,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,10 @@ class NotificationRepository extends Repository
|
|||
*/
|
||||
public function getParamsData($params)
|
||||
{
|
||||
if (isset($params['id']) && isset($params['status'])) {
|
||||
if (
|
||||
isset($params['id'])
|
||||
&& isset($params['status'])
|
||||
) {
|
||||
return $params['status'] != 'All' ? $this->model->where(function($qry) use ($params) {
|
||||
$qry->whereHas('order',function ($q) use ($params) {
|
||||
$q->where(['status' => $params['status']]);
|
||||
|
|
@ -35,7 +38,10 @@ class NotificationRepository extends Repository
|
|||
$q->where(['status' => $params['status']]);
|
||||
});
|
||||
})->with('order')->paginate(10): $this->model->with('order')->latest()->paginate(10);
|
||||
} elseif(isset($params['read']) && isset($params['limit'])) {
|
||||
} elseif(
|
||||
isset($params['read'])
|
||||
&& isset($params['limit'])
|
||||
) {
|
||||
return $this->model->where('read', $params['read'])->limit($params['limit'])->with('order')->latest()->paginate($params['limit']);
|
||||
} elseif(isset($params['limit'])) {
|
||||
return $this->model->limit($params['limit'])->with('order')->latest()->paginate($params['limit']);
|
||||
|
|
|
|||
|
|
@ -35,12 +35,24 @@ class GenerateInvoice
|
|||
*/
|
||||
public function handle($order)
|
||||
{
|
||||
if ($order->payment->method == 'cashondelivery' && core()->getConfigData('sales.paymentmethods.cashondelivery.generate_invoice')) {
|
||||
$this->invoiceRepository->create($this->prepareInvoiceData($order), core()->getConfigData('sales.paymentmethods.cashondelivery.invoice_status'), core()->getConfigData('sales.paymentmethods.cashondelivery.order_status'));
|
||||
if (
|
||||
$order->payment->method == 'cashondelivery'
|
||||
&& core()->getConfigData('sales.paymentmethods.cashondelivery.generate_invoice')
|
||||
) {
|
||||
$this->invoiceRepository->create(
|
||||
$this->prepareInvoiceData($order),
|
||||
core()->getConfigData('sales.paymentmethods.cashondelivery.invoice_status'), core()->getConfigData('sales.paymentmethods.cashondelivery.order_status')
|
||||
);
|
||||
}
|
||||
|
||||
if ($order->payment->method == 'moneytransfer' && core()->getConfigData('sales.paymentmethods.moneytransfer.generate_invoice')) {
|
||||
$this->invoiceRepository->create($this->prepareInvoiceData($order), core()->getConfigData('sales.paymentmethods.moneytransfer.invoice_status'), core()->getConfigData('sales.paymentmethods.moneytransfer.order_status'));
|
||||
if (
|
||||
$order->payment->method == 'moneytransfer'
|
||||
&& core()->getConfigData('sales.paymentmethods.moneytransfer.generate_invoice')
|
||||
) {
|
||||
$this->invoiceRepository->create(
|
||||
$this->prepareInvoiceData($order),
|
||||
core()->getConfigData('sales.paymentmethods.moneytransfer.invoice_status'), core()->getConfigData('sales.paymentmethods.moneytransfer.order_status')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ class MoneyTransfer extends Payment
|
|||
*/
|
||||
public function getAdditionalDetails()
|
||||
{
|
||||
if (! $this->getConfigData('mailing_address')
|
||||
if (
|
||||
! $this->getConfigData('mailing_address')
|
||||
|| $this->getConfigData('mailing_address') == ''
|
||||
) {
|
||||
return [];
|
||||
|
|
|
|||
|
|
@ -129,7 +129,8 @@ abstract class Payment
|
|||
*/
|
||||
public function getAdditionalDetails()
|
||||
{
|
||||
if (! $this->getConfigData('instructions')
|
||||
if (
|
||||
! $this->getConfigData('instructions')
|
||||
|| $this->getConfigData('instructions') == ''
|
||||
) {
|
||||
return [];
|
||||
|
|
|
|||
|
|
@ -52,7 +52,10 @@ class Ipn
|
|||
}
|
||||
|
||||
try {
|
||||
if (isset($this->post['txn_type']) && 'recurring_payment' == $this->post['txn_type']) {
|
||||
if (
|
||||
isset($this->post['txn_type'])
|
||||
&& 'recurring_payment' == $this->post['txn_type']
|
||||
) {
|
||||
|
||||
} else {
|
||||
$this->getOrder();
|
||||
|
|
|
|||
|
|
@ -132,7 +132,10 @@ class SmartButtonController extends Controller
|
|||
]
|
||||
];
|
||||
|
||||
if ($cart->haveStockableItems() && $cart->shipping_address) {
|
||||
if (
|
||||
$cart->haveStockableItems()
|
||||
&& $cart->shipping_address
|
||||
) {
|
||||
$data['purchase_units'][0] = array_merge($data['purchase_units'][0], [
|
||||
'shipping' => [
|
||||
'address' => [
|
||||
|
|
@ -267,7 +270,10 @@ class SmartButtonController extends Controller
|
|||
throw new \Exception(trans('shop::app.checkout.cart.minimum-order-message', ['amount' => core()->currency($minimumOrderAmount)]));
|
||||
}
|
||||
|
||||
if ($cart->haveStockableItems() && ! $cart->shipping_address) {
|
||||
if (
|
||||
$cart->haveStockableItems()
|
||||
&& ! $cart->shipping_address
|
||||
) {
|
||||
throw new \Exception(trans('Please check shipping address.'));
|
||||
}
|
||||
|
||||
|
|
@ -275,7 +281,10 @@ class SmartButtonController extends Controller
|
|||
throw new \Exception(trans('Please check billing address.'));
|
||||
}
|
||||
|
||||
if ($cart->haveStockableItems() && ! $cart->selected_shipping_rate) {
|
||||
if (
|
||||
$cart->haveStockableItems()
|
||||
&& ! $cart->selected_shipping_rate
|
||||
) {
|
||||
throw new \Exception(trans('Please specify shipping method.'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,10 @@ class Transaction
|
|||
$data = request()->all();
|
||||
|
||||
if ($invoice->order->payment->method == 'paypal_smart_button') {
|
||||
if (isset($data['orderData']) && isset($data['orderData']['orderID'])) {
|
||||
if (
|
||||
isset($data['orderData'])
|
||||
&& isset($data['orderData']['orderID'])
|
||||
) {
|
||||
$smartButtonOrderId = $data['orderData']['orderID'];
|
||||
$transactionDetails = $this->smartButton->getOrder($smartButtonOrderId);
|
||||
$transactionDetails = json_decode(json_encode($transactionDetails), true);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,10 @@ class BundleOption extends AbstractProduct
|
|||
foreach ($this->product->bundle_options as $option) {
|
||||
$data = $this->getOptionItemData($option);
|
||||
|
||||
if (! $option->is_required && ! count($data['products'])) {
|
||||
if (
|
||||
! $option->is_required
|
||||
&& ! count($data['products'])
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,10 @@ class ConfigurableOption extends AbstractProduct
|
|||
|
||||
$attributeValue = $product->{$productAttribute->code};
|
||||
|
||||
if ($attributeValue == '' && $product instanceof \Webkul\Product\Models\ProductFlat) {
|
||||
if (
|
||||
$attributeValue == ''
|
||||
&& $product instanceof \Webkul\Product\Models\ProductFlat
|
||||
) {
|
||||
$attributeValue = $product->product->{$productAttribute->code};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@ class GenerateProduct
|
|||
|
||||
foreach ($attributes as $attribute) {
|
||||
if ($attribute->type == 'text') {
|
||||
if ($attribute->code == 'width'
|
||||
if (
|
||||
$attribute->code == 'width'
|
||||
|| $attribute->code == 'height'
|
||||
|| $attribute->code == 'depth'
|
||||
|| $attribute->code == 'weight'
|
||||
|
|
@ -114,7 +115,10 @@ class GenerateProduct
|
|||
} elseif ($attribute->type == 'textarea') {
|
||||
$data[$attribute->code] = $faker->text;
|
||||
|
||||
if ($attribute->code == 'description' || $attribute->code == 'short_description') {
|
||||
if (
|
||||
$attribute->code == 'description'
|
||||
|| $attribute->code == 'short_description'
|
||||
) {
|
||||
$data[$attribute->code] = '<p>' . $data[$attribute->code] . '</p>';
|
||||
}
|
||||
} elseif ($attribute->type == 'boolean') {
|
||||
|
|
@ -131,7 +135,13 @@ class GenerateProduct
|
|||
} else {
|
||||
$data[$attribute->code] = $date->toDateString();
|
||||
}
|
||||
} elseif ($attribute->code != 'tax_category_id' && ($attribute->type == 'select' || $attribute->type == 'multiselect')) {
|
||||
} elseif (
|
||||
$attribute->code != 'tax_category_id'
|
||||
&& (
|
||||
$attribute->type == 'select'
|
||||
|| $attribute->type == 'multiselect'
|
||||
)
|
||||
) {
|
||||
$options = $attribute->options;
|
||||
|
||||
if ($attribute->type == 'select') {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,10 @@ class Toolbar extends AbstractProduct
|
|||
$params = request()->input();
|
||||
$orderDirection = $params['order'] ?? 'asc';
|
||||
|
||||
if (isset($params['sort']) && $key == $params['sort'] . '-' . $orderDirection) {
|
||||
if (
|
||||
isset($params['sort'])
|
||||
&& $key == $params['sort'] . '-' . $orderDirection
|
||||
) {
|
||||
return true;
|
||||
} elseif (! isset($params['sort'])) {
|
||||
$sortBy = core()->getConfigData('catalog.products.storefront.sort_by')
|
||||
|
|
@ -135,9 +138,15 @@ class Toolbar extends AbstractProduct
|
|||
? core()->getConfigData('catalog.products.storefront.mode')
|
||||
: 'grid';
|
||||
|
||||
if (request()->input() == null && $key == $defaultMode) {
|
||||
if (
|
||||
request()->input() == null
|
||||
&& $key == $defaultMode
|
||||
) {
|
||||
return true;
|
||||
} elseif (isset($params['mode']) && $key == $params['mode']) {
|
||||
} elseif (
|
||||
isset($params['mode'])
|
||||
&& $key == $params['mode']
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,10 @@ class View extends AbstractProduct
|
|||
continue;
|
||||
}
|
||||
}
|
||||
} elseif ($attribute->type == 'multiselect' || $attribute->type == 'checkbox') {
|
||||
} elseif (
|
||||
$attribute->type == 'multiselect'
|
||||
|| $attribute->type == 'checkbox'
|
||||
) {
|
||||
$lables = [];
|
||||
|
||||
$attributeOptions = $attributeOptionReposotory->findWhereIn('id', explode(",", $value));
|
||||
|
|
|
|||
|
|
@ -221,7 +221,10 @@ class ProductController extends Controller
|
|||
|
||||
$copiedProduct = $this->productRepository->copy($originalProduct);
|
||||
|
||||
if ($copiedProduct instanceof Product && $copiedProduct->id) {
|
||||
if (
|
||||
$copiedProduct instanceof Product
|
||||
&& $copiedProduct->id
|
||||
) {
|
||||
session()->flash('success', trans('admin::app.response.product-copied'));
|
||||
} else {
|
||||
session()->flash('error', trans('admin::app.response.error-while-copying'));
|
||||
|
|
|
|||
|
|
@ -67,7 +67,10 @@ class ProductForm extends FormRequest
|
|||
]);
|
||||
|
||||
foreach ($product->getEditableAttributes() as $attribute) {
|
||||
if (in_array($attribute->code, ['sku', 'url_key']) || $attribute->type == 'boolean') {
|
||||
if (
|
||||
in_array($attribute->code, ['sku', 'url_key'])
|
||||
|| $attribute->type == 'boolean'
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +82,10 @@ class ProductForm extends FormRequest
|
|||
$validations = $this->rules[$attribute->code];
|
||||
}
|
||||
|
||||
if ($attribute->type == 'text' && $attribute->validation) {
|
||||
if (
|
||||
$attribute->type == 'text'
|
||||
&& $attribute->validation
|
||||
) {
|
||||
array_push($validations,
|
||||
$attribute->validation == 'decimal'
|
||||
? new Decimal
|
||||
|
|
|
|||
|
|
@ -90,7 +90,10 @@ class ProductFlat
|
|||
Schema::table('product_flat', function (Blueprint $table) use($attribute) {
|
||||
$table->{$this->attributeTypeFields[$attribute->type]}($attribute->code)->nullable();
|
||||
|
||||
if ($attribute->type == 'select' || $attribute->type == 'multiselect') {
|
||||
if (
|
||||
$attribute->type == 'select'
|
||||
|| $attribute->type == 'multiselect'
|
||||
) {
|
||||
$table->string($attribute->code . '_label')->nullable();
|
||||
}
|
||||
});
|
||||
|
|
@ -111,7 +114,10 @@ class ProductFlat
|
|||
Schema::table('product_flat', function (Blueprint $table) use($attribute) {
|
||||
$table->dropColumn($attribute->code);
|
||||
|
||||
if ($attribute->type == 'select' || $attribute->type == 'multiselect') {
|
||||
if (
|
||||
$attribute->type == 'select'
|
||||
|| $attribute->type == 'multiselect'
|
||||
) {
|
||||
$table->dropColumn($attribute->code . '_label');
|
||||
}
|
||||
});
|
||||
|
|
@ -155,7 +161,10 @@ class ProductFlat
|
|||
$familyAttributes[$product->attribute_family_id] = $product->attribute_family->custom_attributes;
|
||||
}
|
||||
|
||||
if ($parentProduct && ! array_key_exists($parentProduct->id, $superAttributes)) {
|
||||
if (
|
||||
$parentProduct
|
||||
&& ! array_key_exists($parentProduct->id, $superAttributes)
|
||||
) {
|
||||
$superAttributes[$parentProduct->id] = $parentProduct->super_attributes()->pluck('code')->toArray();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,13 @@ class ProductFlat extends Model implements ProductFlatContract
|
|||
->getSingletonInstance(AttributeRepository::class)
|
||||
->getAttributeByCode($key);
|
||||
|
||||
if ($attribute && ($attribute->value_per_channel || $attribute->value_per_locale)) {
|
||||
if (
|
||||
$attribute
|
||||
&& (
|
||||
$attribute->value_per_channel
|
||||
|| $attribute->value_per_locale
|
||||
)
|
||||
) {
|
||||
$defaultProduct = $this->getDefaultProduct();
|
||||
|
||||
$this->attributes[$key] = $defaultProduct->attributes[$key];
|
||||
|
|
|
|||
|
|
@ -46,7 +46,11 @@ class ProductImage extends AbstractProduct
|
|||
$images[] = $this->getCachedImageUrls($image->path);
|
||||
}
|
||||
|
||||
if (! $product->parent_id && ! count($images) && ! count($product->videos)) {
|
||||
if (
|
||||
! $product->parent_id
|
||||
&& ! count($images)
|
||||
&& ! count($product->videos)
|
||||
) {
|
||||
$images[] = $this->getFallbackImageUrls();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,14 +62,20 @@ class ProductBundleOptionProductRepository extends Repository
|
|||
$haveIsDefaulFlag = false;
|
||||
|
||||
foreach ($data['products'] as $key => $product) {
|
||||
if (isset($product['is_default']) && $product['is_default']) {
|
||||
if (
|
||||
isset($product['is_default'])
|
||||
&& $product['is_default']
|
||||
) {
|
||||
$haveIsDefaulFlag = true;
|
||||
} else {
|
||||
$data['products'][$key]['is_default'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $haveIsDefaulFlag && $data['is_required']) {
|
||||
if (
|
||||
! $haveIsDefaulFlag
|
||||
&& $data['is_required']
|
||||
) {
|
||||
$data['products'][key($data['products'])]['is_default'] = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,9 +98,15 @@ class ProductFlatRepository extends Repository
|
|||
|
||||
foreach ($attributeKeys as $key) {
|
||||
if (! is_null($attribute[$key])) {
|
||||
if ($key == 'integer_value' && ! in_array($attribute[$key], $attributeInfo['attributeOptions'])) {
|
||||
if (
|
||||
$key == 'integer_value'
|
||||
&& ! in_array($attribute[$key], $attributeInfo['attributeOptions'])
|
||||
) {
|
||||
array_push($attributeInfo['attributeOptions'], $attribute[$key]);
|
||||
} elseif ($key == 'text_value' && ! in_array($attribute[$key], $attributeInfo['attributeOptions'])) {
|
||||
} elseif (
|
||||
$key == 'text_value'
|
||||
&& ! in_array($attribute[$key], $attributeInfo['attributeOptions'])
|
||||
) {
|
||||
$multiSelectArrributes = explode(",", $attribute[$key]);
|
||||
|
||||
foreach ($multiSelectArrributes as $multi) {
|
||||
|
|
@ -108,7 +114,13 @@ class ProductFlatRepository extends Repository
|
|||
array_push($attributeInfo['attributeOptions'], $multi);
|
||||
}
|
||||
}
|
||||
} elseif (($key == 'attribute_id' || $key == 'attributeId') && ! in_array($attribute[$key], $attributeInfo['attributes'])) {
|
||||
} elseif (
|
||||
(
|
||||
$key == 'attribute_id'
|
||||
|| $key == 'attributeId'
|
||||
)
|
||||
&& ! in_array($attribute[$key], $attributeInfo['attributes'])
|
||||
) {
|
||||
array_push($attributeInfo['attributes'], $attribute[$key]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,10 @@ class ProductMediaRepository extends Repository
|
|||
*/
|
||||
$previousIds = $this->resolveFileTypeQueryBuilder($product, $uploadFileType)->pluck('id');
|
||||
|
||||
if (isset($data[$uploadFileType]['files']) && $data[$uploadFileType]['files']) {
|
||||
if (
|
||||
isset($data[$uploadFileType]['files'])
|
||||
&& $data[$uploadFileType]['files']
|
||||
) {
|
||||
foreach ($data[$uploadFileType]['files'] as $indexOrModelId => $file) {
|
||||
if ($file instanceof UploadedFile) {
|
||||
$this->create([
|
||||
|
|
@ -63,7 +66,10 @@ class ProductMediaRepository extends Repository
|
|||
/**
|
||||
* Filter out existing models because new model positions are already setuped by index.
|
||||
*/
|
||||
if (isset($data[$uploadFileType]['positions']) && $data[$uploadFileType]['positions']) {
|
||||
if (
|
||||
isset($data[$uploadFileType]['positions'])
|
||||
&& $data[$uploadFileType]['positions']
|
||||
) {
|
||||
$positions = collect($data[$uploadFileType]['positions'])->keys()->filter(function ($position) {
|
||||
return is_numeric($position);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -223,7 +223,11 @@ class ProductRepository extends Repository
|
|||
|
||||
# sort direction
|
||||
$orderDirection = 'asc';
|
||||
if (isset($params['order']) && in_array($params['order'], ['desc', 'asc'])) {
|
||||
|
||||
if (
|
||||
isset($params['order'])
|
||||
&& in_array($params['order'], ['desc', 'asc'])
|
||||
) {
|
||||
$orderDirection = $params['order'];
|
||||
} else {
|
||||
$sortOptions = $this->getDefaultSortByOption();
|
||||
|
|
|
|||
|
|
@ -173,11 +173,17 @@ abstract class AbstractType
|
|||
foreach ($product->attribute_family->custom_attributes as $attribute) {
|
||||
$route = request()->route() ? request()->route()->getName() : '';
|
||||
|
||||
if ($attribute->type === 'boolean' && $route !== 'admin.catalog.products.massupdate') {
|
||||
if (
|
||||
$attribute->type === 'boolean'
|
||||
&& $route !== 'admin.catalog.products.massupdate'
|
||||
) {
|
||||
$data[$attribute->code] = isset($data[$attribute->code]) && $data[$attribute->code] ? 1 : 0;
|
||||
}
|
||||
|
||||
if ($attribute->type == 'multiselect' || $attribute->type == 'checkbox') {
|
||||
if (
|
||||
$attribute->type == 'multiselect'
|
||||
|| $attribute->type == 'checkbox'
|
||||
) {
|
||||
$data[$attribute->code] = isset($data[$attribute->code]) ? implode(',', $data[$attribute->code]) : null;
|
||||
}
|
||||
|
||||
|
|
@ -185,15 +191,26 @@ abstract class AbstractType
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($attribute->type === 'price' && isset($data[$attribute->code]) && $data[$attribute->code] === '') {
|
||||
if (
|
||||
$attribute->type === 'price'
|
||||
&& isset($data[$attribute->code])
|
||||
&& $data[$attribute->code] === ''
|
||||
) {
|
||||
$data[$attribute->code] = null;
|
||||
}
|
||||
|
||||
if ($attribute->type === 'date' && $data[$attribute->code] === '' && $route !== 'admin.catalog.products.massupdate') {
|
||||
if (
|
||||
$attribute->type === 'date'
|
||||
&& $data[$attribute->code] === ''
|
||||
&& $route !== 'admin.catalog.products.massupdate'
|
||||
) {
|
||||
$data[$attribute->code] = null;
|
||||
}
|
||||
|
||||
if ($attribute->type === 'image' || $attribute->type === 'file') {
|
||||
if (
|
||||
$attribute->type === 'image'
|
||||
|| $attribute->type === 'file'
|
||||
) {
|
||||
$data[$attribute->code] = gettype($data[$attribute->code]) === 'object'
|
||||
? request()->file($attribute->code)->store('product/' . $product->id)
|
||||
: null;
|
||||
|
|
@ -238,7 +255,10 @@ abstract class AbstractType
|
|||
} else {
|
||||
$productAttributeValue->update([$columnName => $data[$attribute->code]]);
|
||||
|
||||
if ($attribute->type == 'image' || $attribute->type == 'file') {
|
||||
if (
|
||||
$attribute->type == 'image'
|
||||
|| $attribute->type == 'file'
|
||||
) {
|
||||
Storage::delete($attributeValue->text_value);
|
||||
}
|
||||
}
|
||||
|
|
@ -579,7 +599,11 @@ abstract class AbstractType
|
|||
|
||||
$specialPrice = $this->product->special_price;
|
||||
|
||||
if ((is_null($specialPrice) || ! (float) $specialPrice)
|
||||
if (
|
||||
(
|
||||
is_null($specialPrice)
|
||||
|| ! (float) $specialPrice
|
||||
)
|
||||
&& ! $rulePrice
|
||||
&& $customerGroupPrice == $this->product->price
|
||||
) {
|
||||
|
|
@ -589,13 +613,19 @@ abstract class AbstractType
|
|||
$haveSpecialPrice = false;
|
||||
|
||||
if (! (float) $specialPrice) {
|
||||
if ($rulePrice && $rulePrice->price < $this->product->price) {
|
||||
if (
|
||||
$rulePrice
|
||||
&& $rulePrice->price < $this->product->price
|
||||
) {
|
||||
$this->product->special_price = $rulePrice->price;
|
||||
|
||||
$haveSpecialPrice = true;
|
||||
}
|
||||
} else {
|
||||
if ($rulePrice && $rulePrice->price <= $this->product->special_price) {
|
||||
if (
|
||||
$rulePrice
|
||||
&& $rulePrice->price <= $this->product->special_price
|
||||
) {
|
||||
$this->product->special_price = $rulePrice->price;
|
||||
|
||||
$haveSpecialPrice = true;
|
||||
|
|
@ -661,7 +691,10 @@ abstract class AbstractType
|
|||
$lastCustomerGroupId = null;
|
||||
|
||||
foreach ($customerGroupPrices as $price) {
|
||||
if ($price->customer_group_id != $customerGroupId && $price->customer_group_id) {
|
||||
if (
|
||||
$price->customer_group_id != $customerGroupId
|
||||
&& $price->customer_group_id
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -682,7 +715,10 @@ abstract class AbstractType
|
|||
}
|
||||
|
||||
if ($price->value_type == 'discount') {
|
||||
if ($price->value >= 0 && $price->value <= 100) {
|
||||
if (
|
||||
$price->value >= 0
|
||||
&& $price->value <= 100
|
||||
) {
|
||||
$lastPrice = $product->price - ($product->price * $price->value) / 100;
|
||||
|
||||
$lastQty = $price->qty;
|
||||
|
|
@ -690,7 +726,10 @@ abstract class AbstractType
|
|||
$lastCustomerGroupId = $price->customer_group_id;
|
||||
}
|
||||
} else {
|
||||
if ($price->value >= 0 && $price->value < $lastPrice) {
|
||||
if (
|
||||
$price->value >= 0
|
||||
&& $price->value < $lastPrice
|
||||
) {
|
||||
$lastPrice = $price->value;
|
||||
|
||||
$lastQty = $price->qty;
|
||||
|
|
@ -752,7 +791,10 @@ abstract class AbstractType
|
|||
$address = null;
|
||||
|
||||
if ($taxCategory = $this->getTaxCategory()) {
|
||||
if ($address === null && auth()->guard('customer')->check()) {
|
||||
if (
|
||||
$address === null
|
||||
&& auth()->guard('customer')->check()
|
||||
) {
|
||||
$address = auth()->guard('customer')->user()->addresses->where('default_address', 1)->first();
|
||||
}
|
||||
|
||||
|
|
@ -860,15 +902,24 @@ abstract class AbstractType
|
|||
if ($this->product->id != $options2['product_id']) {
|
||||
return false;
|
||||
} else {
|
||||
if (isset($options1['parent_id']) && isset($options2['parent_id'])) {
|
||||
if (
|
||||
isset($options1['parent_id'])
|
||||
&& isset($options2['parent_id'])
|
||||
) {
|
||||
if ($options1['parent_id'] == $options2['parent_id']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} elseif (isset($options1['parent_id']) && ! isset($options2['parent_id'])) {
|
||||
} elseif (
|
||||
isset($options1['parent_id'])
|
||||
&& ! isset($options2['parent_id'])
|
||||
) {
|
||||
return false;
|
||||
} elseif (isset($options2['parent_id']) && ! isset($options1['parent_id'])) {
|
||||
} elseif (
|
||||
isset($options2['parent_id'])
|
||||
&& ! isset($options1['parent_id'])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -974,7 +1025,10 @@ abstract class AbstractType
|
|||
break;
|
||||
|
||||
case 'configurable':
|
||||
if ($item->child && $item->child->product->status === 0) {
|
||||
if (
|
||||
$item->child
|
||||
&& $item->child->product->status === 0
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
|
@ -1012,13 +1066,19 @@ abstract class AbstractType
|
|||
if ($this->haveSpecialPrice()) {
|
||||
$rulePrice = app('Webkul\CatalogRule\Helpers\CatalogRuleProductPrice')->getRulePrice($this->product);
|
||||
|
||||
if ($rulePrice && $rulePrice->price < $this->product->special_price) {
|
||||
if (
|
||||
$rulePrice
|
||||
&& $rulePrice->price < $this->product->special_price
|
||||
) {
|
||||
$haveOffers = false;
|
||||
}
|
||||
|
||||
if ($haveOffers) {
|
||||
foreach ($customerGroupPrices as $key => $customerGroupPrice) {
|
||||
if ($customerGroupPrice && $customerGroupPrice->qty > 1) {
|
||||
if (
|
||||
$customerGroupPrice
|
||||
&& $customerGroupPrice->qty > 1
|
||||
) {
|
||||
array_push($offerLines, $this->getOfferLines($customerGroupPrice));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,10 @@ class Bundle extends AbstractType
|
|||
}
|
||||
}
|
||||
|
||||
if (! $haveRequiredOptions && count($minPrices)) {
|
||||
if (
|
||||
! $haveRequiredOptions
|
||||
&& count($minPrices)
|
||||
) {
|
||||
$minPrice = min($minPrices);
|
||||
}
|
||||
|
||||
|
|
@ -437,7 +440,10 @@ class Bundle extends AbstractType
|
|||
$data['bundle_options'] = array_filter($this->validateBundleOptionForCart($data['bundle_options']));
|
||||
}
|
||||
|
||||
if (! isset($data['bundle_options']) || ! count($data['bundle_options'])) {
|
||||
if (
|
||||
! isset($data['bundle_options'])
|
||||
|| ! count($data['bundle_options'])
|
||||
) {
|
||||
return trans('shop::app.checkout.cart.integrity.missing_options');
|
||||
}
|
||||
|
||||
|
|
@ -537,11 +543,17 @@ class Bundle extends AbstractType
|
|||
*/
|
||||
public function compareOptions($options1, $options2)
|
||||
{
|
||||
if (isset($options2['product_id']) && $this->product->id != $options2['product_id']) {
|
||||
if (
|
||||
isset($options2['product_id'])
|
||||
&& $this->product->id != $options2['product_id']
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($options1['bundle_options']) && isset($options2['bundle_options'])) {
|
||||
if (
|
||||
isset($options1['bundle_options'])
|
||||
&& isset($options2['bundle_options'])
|
||||
) {
|
||||
return $options1['bundle_options'] == $options2['bundle_options'] && $options1['bundle_option_qty'] == $this->getOptionQuantities($options2);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,7 +220,10 @@ class Configurable extends AbstractType
|
|||
$typeOfVariants = 'simple';
|
||||
$productInstance = app(config('product_types.' . $product->type . '.class'));
|
||||
|
||||
if (isset($productInstance->variantsType) && ! in_array($productInstance->variantsType, ['bundle', 'configurable', 'grouped'])) {
|
||||
if (
|
||||
isset($productInstance->variantsType)
|
||||
&& ! in_array($productInstance->variantsType, ['bundle', 'configurable', 'grouped'])
|
||||
) {
|
||||
$typeOfVariants = $productInstance->variantsType;
|
||||
}
|
||||
|
||||
|
|
@ -556,7 +559,10 @@ class Configurable extends AbstractType
|
|||
$customerGroupPrices[] = $this->getCustomerGroupPrice($variant, 1);
|
||||
}
|
||||
|
||||
if ($rulePrices || $customerGroupPrices) {
|
||||
if (
|
||||
$rulePrices
|
||||
|| $customerGroupPrices
|
||||
) {
|
||||
return $offerPrice = min(array_merge($rulePrices, $customerGroupPrices));
|
||||
}
|
||||
|
||||
|
|
@ -649,7 +655,10 @@ class Configurable extends AbstractType
|
|||
*/
|
||||
public function prepareForCart($data)
|
||||
{
|
||||
if (! isset($data['selected_configurable_option']) || ! $data['selected_configurable_option']) {
|
||||
if (
|
||||
! isset($data['selected_configurable_option'])
|
||||
|| ! $data['selected_configurable_option']
|
||||
) {
|
||||
if ($this->getDefaultVariantId()) {
|
||||
$data['selected_configurable_option'] = $this->getDefaultVariantId();
|
||||
} else {
|
||||
|
|
@ -709,7 +718,10 @@ class Configurable extends AbstractType
|
|||
return false;
|
||||
}
|
||||
|
||||
if (isset($options1['selected_configurable_option']) && isset($options2['selected_configurable_option'])) {
|
||||
if (
|
||||
isset($options1['selected_configurable_option'])
|
||||
&& isset($options2['selected_configurable_option'])
|
||||
) {
|
||||
return $options1['selected_configurable_option'] === $options2['selected_configurable_option'];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,10 @@ class Downloadable extends AbstractType
|
|||
*/
|
||||
public function prepareForCart($data)
|
||||
{
|
||||
if (! isset($data['links']) || ! count($data['links'])) {
|
||||
if (
|
||||
! isset($data['links'])
|
||||
|| ! count($data['links'])
|
||||
) {
|
||||
return trans('shop::app.checkout.cart.integrity.missing_links');
|
||||
}
|
||||
|
||||
|
|
@ -194,7 +197,10 @@ class Downloadable extends AbstractType
|
|||
return false;
|
||||
}
|
||||
|
||||
if (isset($options1['links']) && isset($options2['links'])) {
|
||||
if (
|
||||
isset($options1['links'])
|
||||
&& isset($options2['links'])
|
||||
) {
|
||||
return $options1['links'] === $options2['links'];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -202,7 +202,10 @@ class Grouped extends AbstractType
|
|||
*/
|
||||
public function prepareForCart($data)
|
||||
{
|
||||
if (! isset($data['qty']) || ! is_array($data['qty'])) {
|
||||
if (
|
||||
! isset($data['qty'])
|
||||
|| ! is_array($data['qty'])
|
||||
) {
|
||||
return trans('shop::app.checkout.cart.integrity.missing_options');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,10 @@ class Simple extends AbstractType
|
|||
return false;
|
||||
}
|
||||
|
||||
if (is_callable(config('products.isSaleable')) &&
|
||||
call_user_func(config('products.isSaleable'), $product) === false) {
|
||||
if (
|
||||
is_callable(config('products.isSaleable')) &&
|
||||
call_user_func(config('products.isSaleable'), $product) === false
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,8 +50,10 @@ class Virtual extends AbstractType
|
|||
return false;
|
||||
}
|
||||
|
||||
if (is_callable(config('products.isSaleable')) &&
|
||||
call_user_func(config('products.isSaleable'), $this->product) === false) {
|
||||
if (
|
||||
is_callable(config('products.isSaleable')) &&
|
||||
call_user_func(config('products.isSaleable'), $this->product) === false
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,11 +22,19 @@ class Validator
|
|||
$validConditionCount = $totalConditionCount = 0;
|
||||
|
||||
foreach ($rule->conditions as $condition) {
|
||||
if (! $condition['attribute'] || ! isset($condition['value']) || is_null($condition['value']) || $condition['value'] == '') {
|
||||
if (
|
||||
! $condition['attribute']
|
||||
|| ! isset($condition['value'])
|
||||
|| is_null($condition['value'])
|
||||
|| $condition['value'] == ''
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($entity instanceof \Webkul\Checkout\Contracts\Cart && strpos($condition['attribute'], 'cart|') === false) {
|
||||
if (
|
||||
$entity instanceof \Webkul\Checkout\Contracts\Cart
|
||||
&& strpos($condition['attribute'], 'cart|') === false
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +228,10 @@ class Validator
|
|||
break;
|
||||
|
||||
case '{}': case '!{}':
|
||||
if (is_scalar($attributeValue) && is_array($condition['value'])) {
|
||||
if (
|
||||
is_scalar($attributeValue)
|
||||
&& is_array($condition['value'])
|
||||
) {
|
||||
foreach ($condition['value'] as $item) {
|
||||
if (stripos($attributeValue, $item) !== false) {
|
||||
$result = true;
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ class OrderItemFactory extends Factory
|
|||
|
||||
if (isset($attributes['product_id'])) {
|
||||
$product = Product::query()
|
||||
->where('id', $attributes['product_id'])
|
||||
->first();
|
||||
->where('id', $attributes['product_id'])
|
||||
->first();
|
||||
} else {
|
||||
$product = Product::factory()
|
||||
->simple()
|
||||
->create();
|
||||
->simple()
|
||||
->create();
|
||||
}
|
||||
|
||||
$fallbackPrice = $this->faker->randomFloat(4, 0, 1000);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,12 @@ class Sequencer implements SequencerContract
|
|||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
if ($this->length && ($this->prefix || $this->suffix)) {
|
||||
if (
|
||||
$this->length
|
||||
&& (
|
||||
$this->prefix || $this->suffix
|
||||
)
|
||||
) {
|
||||
$number = ($this->prefix) . sprintf(
|
||||
"%0{$this->length}d",
|
||||
($this->lastId + 1)
|
||||
|
|
|
|||
|
|
@ -255,7 +255,10 @@ class Order extends Model implements OrderContract
|
|||
}
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
if ($item->canShip() && $item->order->status !== self::STATUS_CLOSED) {
|
||||
if (
|
||||
$item->canShip()
|
||||
&& $item->order->status !== self::STATUS_CLOSED
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -275,7 +278,10 @@ class Order extends Model implements OrderContract
|
|||
}
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
if ($item->canInvoice() && $item->order->status !== self::STATUS_CLOSED) {
|
||||
if (
|
||||
$item->canInvoice()
|
||||
&& $item->order->status !== self::STATUS_CLOSED
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -308,11 +314,17 @@ class Order extends Model implements OrderContract
|
|||
*/
|
||||
public function canCancel(): bool
|
||||
{
|
||||
if ($this->payment->method == 'cashondelivery' && core()->getConfigData('sales.paymentmethods.cashondelivery.generate_invoice')) {
|
||||
if (
|
||||
$this->payment->method == 'cashondelivery'
|
||||
&& core()->getConfigData('sales.paymentmethods.cashondelivery.generate_invoice')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->payment->method == 'moneytransfer' && core()->getConfigData('sales.paymentmethods.moneytransfer.generate_invoice')) {
|
||||
if (
|
||||
$this->payment->method == 'moneytransfer'
|
||||
&& core()->getConfigData('sales.paymentmethods.moneytransfer.generate_invoice')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -322,12 +334,16 @@ class Order extends Model implements OrderContract
|
|||
|
||||
$pendingInvoice = $this->invoices->where('state', 'pending')
|
||||
->first();
|
||||
|
||||
if ($pendingInvoice) {
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
if ($item->canCancel() && $item->order->status !== self::STATUS_CLOSED) {
|
||||
if (
|
||||
$item->canCancel()
|
||||
&& $item->order->status !== self::STATUS_CLOSED
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -348,12 +364,16 @@ class Order extends Model implements OrderContract
|
|||
|
||||
$pendingInvoice = $this->invoices->where('state', 'pending')
|
||||
->first();
|
||||
|
||||
if ($pendingInvoice) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
if ($item->qty_to_refund > 0 && $item->order->status !== self::STATUS_CLOSED) {
|
||||
if (
|
||||
$item->qty_to_refund > 0
|
||||
&& $item->order->status !== self::STATUS_CLOSED
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class OrderItem extends Model implements OrderItemContract
|
|||
*/
|
||||
public function canShip(): bool
|
||||
{
|
||||
if (!$this->isStockable()) {
|
||||
if (! $this->isStockable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ class OrderItem extends Model implements OrderItemContract
|
|||
*/
|
||||
public function getQtyToShipAttribute()
|
||||
{
|
||||
if (!$this->isStockable()) {
|
||||
if (! $this->isStockable()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,10 @@ class DownloadableLinkPurchasedRepository extends Repository
|
|||
* @return bool
|
||||
*/
|
||||
private function isValidDownloadableProduct($orderItem) : bool {
|
||||
if (stristr($orderItem->type,'downloadable') !== false && isset($orderItem->additional['links'])) {
|
||||
if (
|
||||
stristr($orderItem->type,'downloadable') !== false
|
||||
&& isset($orderItem->additional['links'])
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ class InvoiceItemRepository extends Repository
|
|||
}
|
||||
|
||||
$orderedInventory = $data['product']->ordered_inventories()
|
||||
->where('channel_id', $data['invoice']->order->channel->id)
|
||||
->first();
|
||||
->where('channel_id', $data['invoice']->order->channel->id)
|
||||
->first();
|
||||
|
||||
if ($orderedInventory) {
|
||||
if (($orderedQty = $orderedInventory->qty - $data['qty']) < 0) {
|
||||
|
|
@ -42,10 +42,10 @@ class InvoiceItemRepository extends Repository
|
|||
}
|
||||
|
||||
$inventories = $data['product']->inventories()
|
||||
->where('vendor_id', $data['vendor_id'])
|
||||
->whereIn('inventory_source_id', $data['invoice']->order->channel->inventory_sources()->pluck('id'))
|
||||
->orderBy('qty', 'desc')
|
||||
->get();
|
||||
->where('vendor_id', $data['vendor_id'])
|
||||
->whereIn('inventory_source_id', $data['invoice']->order->channel->inventory_sources()->pluck('id'))
|
||||
->orderBy('qty', 'desc')
|
||||
->get();
|
||||
|
||||
foreach ($inventories as $key => $inventory) {
|
||||
if ($inventory->qty >= $data['qty']) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@ class OrderItemRepository extends Repository
|
|||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
if (isset($data['product']) && $data['product']) {
|
||||
if (
|
||||
isset($data['product'])
|
||||
&& $data['product']
|
||||
) {
|
||||
$data['product_id'] = $data['product']->id;
|
||||
$data['product_type'] = get_class($data['product']);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,14 +52,20 @@ class OrderRepository extends Repository
|
|||
try {
|
||||
Event::dispatch('checkout.order.save.before', [$data]);
|
||||
|
||||
if (isset($data['customer']) && $data['customer']) {
|
||||
if (
|
||||
isset($data['customer'])
|
||||
&& $data['customer']
|
||||
) {
|
||||
$data['customer_id'] = $data['customer']->id;
|
||||
$data['customer_type'] = get_class($data['customer']);
|
||||
} else {
|
||||
unset($data['customer']);
|
||||
}
|
||||
|
||||
if (isset($data['channel']) && $data['channel']) {
|
||||
if (
|
||||
isset($data['channel'])
|
||||
&& $data['channel']
|
||||
) {
|
||||
$data['channel_id'] = $data['channel']->id;
|
||||
$data['channel_type'] = get_class($data['channel']);
|
||||
$data['channel_name'] = $data['channel']->name;
|
||||
|
|
@ -88,7 +94,10 @@ class OrderRepository extends Repository
|
|||
|
||||
$orderItem = $this->orderItemRepository->create(array_merge($item, ['order_id' => $order->id]));
|
||||
|
||||
if (isset($item['children']) && $item['children']) {
|
||||
if (
|
||||
isset($item['children'])
|
||||
&& $item['children']
|
||||
) {
|
||||
foreach ($item['children'] as $child) {
|
||||
$this->orderItemRepository->create(array_merge($child, ['order_id' => $order->id, 'parent_id' => $orderItem->id]));
|
||||
}
|
||||
|
|
@ -175,7 +184,10 @@ class OrderRepository extends Repository
|
|||
$orderItem->qty_canceled += $orderItem->qty_to_cancel;
|
||||
$orderItem->save();
|
||||
|
||||
if ($orderItem->parent && $orderItem->parent->qty_ordered) {
|
||||
if (
|
||||
$orderItem->parent
|
||||
&& $orderItem->parent->qty_ordered
|
||||
) {
|
||||
$orderItem->parent->qty_canceled += $orderItem->parent->qty_to_cancel;
|
||||
$orderItem->parent->save();
|
||||
}
|
||||
|
|
@ -241,7 +253,10 @@ class OrderRepository extends Repository
|
|||
* If order is already completed and total quantity ordered is not equal to refunded
|
||||
* then it can be considered as completed.
|
||||
*/
|
||||
if ($order->status === OrderModel::STATUS_COMPLETED && $totalQtyOrdered != $totalQtyRefunded) {
|
||||
if (
|
||||
$order->status === OrderModel::STATUS_COMPLETED
|
||||
&& $totalQtyOrdered != $totalQtyRefunded
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,10 @@ class RefundItemRepository extends Repository
|
|||
return;
|
||||
}
|
||||
|
||||
if ($orderItem->qty_shipped && $quantity > $orderItem->qty_ordered - $orderItem->qty_shipped) {
|
||||
if (
|
||||
$orderItem->qty_shipped
|
||||
&& $quantity > $orderItem->qty_ordered - $orderItem->qty_shipped
|
||||
) {
|
||||
$nonShippedQty = $orderItem->qty_ordered - $orderItem->qty_shipped;
|
||||
|
||||
if (($totalShippedQtyToRefund = $quantity - $nonShippedQty) > 0) {
|
||||
|
|
@ -69,8 +72,9 @@ class RefundItemRepository extends Repository
|
|||
|
||||
$quantity -= $totalShippedQtyToRefund;
|
||||
}
|
||||
} elseif (! $orderItem->getTypeInstance()->isStockable()
|
||||
&& $orderItem->getTypeInstance()->showQuantityBox()
|
||||
} elseif (
|
||||
! $orderItem->getTypeInstance()->isStockable()
|
||||
&& $orderItem->getTypeInstance()->showQuantityBox()
|
||||
) {
|
||||
$inventory = $orderItem->product->inventories()
|
||||
// ->where('vendor_id', $data['vendor_id'])
|
||||
|
|
|
|||
|
|
@ -128,7 +128,10 @@ class RefundRepository extends Repository
|
|||
'additional' => $childOrderItem->additional,
|
||||
]);
|
||||
|
||||
if ($childOrderItem->getTypeInstance()->isStockable() || $childOrderItem->getTypeInstance()->showQuantityBox()) {
|
||||
if (
|
||||
$childOrderItem->getTypeInstance()->isStockable()
|
||||
|| $childOrderItem->getTypeInstance()->showQuantityBox()
|
||||
) {
|
||||
$this->refundItemRepository->returnQtyToProductInventory($childOrderItem, $finalQty);
|
||||
}
|
||||
|
||||
|
|
@ -136,7 +139,10 @@ class RefundRepository extends Repository
|
|||
}
|
||||
|
||||
} else {
|
||||
if ($orderItem->getTypeInstance()->isStockable() || $orderItem->getTypeInstance()->showQuantityBox()) {
|
||||
if (
|
||||
$orderItem->getTypeInstance()->isStockable()
|
||||
|| $orderItem->getTypeInstance()->showQuantityBox()
|
||||
) {
|
||||
$this->refundItemRepository->returnQtyToProductInventory($orderItem, $qty);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue