commit
f05217fbb8
|
|
@ -12,6 +12,7 @@ use Webkul\Product\Helpers\ProductImage;
|
||||||
use Webkul\BookingProduct\Repositories\BookingProductRepository;
|
use Webkul\BookingProduct\Repositories\BookingProductRepository;
|
||||||
use Webkul\BookingProduct\Helpers\Booking as BookingHelper;
|
use Webkul\BookingProduct\Helpers\Booking as BookingHelper;
|
||||||
use Webkul\Product\Type\Virtual;
|
use Webkul\Product\Type\Virtual;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
class Booking extends Virtual
|
class Booking extends Virtual
|
||||||
{
|
{
|
||||||
|
|
@ -168,6 +169,10 @@ class Booking extends Virtual
|
||||||
$bookingProduct = $this->getBookingProduct($data['product_id']);
|
$bookingProduct = $this->getBookingProduct($data['product_id']);
|
||||||
|
|
||||||
if ($bookingProduct->type == 'event') {
|
if ($bookingProduct->type == 'event') {
|
||||||
|
if (Carbon::now() > $bookingProduct->available_from && Carbon::now() > $bookingProduct->available_to) {
|
||||||
|
return trans('shop::app.checkout.cart.event.expired');
|
||||||
|
}
|
||||||
|
|
||||||
$filtered = Arr::where($data['booking']['qty'], function ($qty, $key) {
|
$filtered = Arr::where($data['booking']['qty'], function ($qty, $key) {
|
||||||
return $qty != 0;
|
return $qty != 0;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -568,38 +568,29 @@ class Configurable extends AbstractType
|
||||||
public function haveSufficientQuantity($qty)
|
public function haveSufficientQuantity($qty)
|
||||||
{
|
{
|
||||||
$backorders = core()->getConfigData('catalog.inventory.stock_options.backorders');
|
$backorders = core()->getConfigData('catalog.inventory.stock_options.backorders');
|
||||||
|
|
||||||
return $qty <= $this->totalQuantity() ? true : $backorders;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function totalQuantity()
|
|
||||||
{
|
|
||||||
$total = 0;
|
|
||||||
|
|
||||||
$channelInventorySourceIds = core()->getCurrentChannel()
|
|
||||||
->inventory_sources()
|
|
||||||
->where('status', 1)
|
|
||||||
->pluck('id');
|
|
||||||
|
|
||||||
foreach ($this->product->variants as $variant) {
|
foreach ($this->product->variants as $variant) {
|
||||||
foreach ($variant->inventories as $inventory) {
|
if ($variant->haveSufficientQuantity($qty)) {
|
||||||
if (is_numeric($index = $channelInventorySourceIds->search($inventory->inventory_source_id))) {
|
return true;
|
||||||
$total += $inventory->qty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$orderedInventory = $variant->ordered_inventories()
|
return $backorders;
|
||||||
->where('channel_id', core()->getCurrentChannel()->id)
|
}
|
||||||
->first();
|
|
||||||
|
/**
|
||||||
if ($orderedInventory) {
|
* Return true if this product type is saleable
|
||||||
$total -= $orderedInventory->qty;
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isSaleable()
|
||||||
|
{
|
||||||
|
foreach ($this->product->variants as $variant) {
|
||||||
|
if ($variant->isSaleable()) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $total;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -411,7 +411,7 @@ return [
|
||||||
'your-customization' => 'التخصيص الخاص بك',
|
'your-customization' => 'التخصيص الخاص بك',
|
||||||
'total-amount' => 'المبلغ الإجمالي',
|
'total-amount' => 'المبلغ الإجمالي',
|
||||||
'none' => 'لا شيء',
|
'none' => 'لا شيء',
|
||||||
'available' => 'Available'
|
'available' => 'Available',
|
||||||
],
|
],
|
||||||
|
|
||||||
// 'reviews' => [
|
// 'reviews' => [
|
||||||
|
|
@ -461,7 +461,10 @@ return [
|
||||||
'cart-subtotal' => 'المجموع الفرعي للمشتريات',
|
'cart-subtotal' => 'المجموع الفرعي للمشتريات',
|
||||||
'cart-remove-action' => 'هل تريد حقا أن تسمح هذا ؟',
|
'cart-remove-action' => 'هل تريد حقا أن تسمح هذا ؟',
|
||||||
'partial-cart-update' => 'تم تحديث بعض المنتجات.',
|
'partial-cart-update' => 'تم تحديث بعض المنتجات.',
|
||||||
'link-missing' => ''
|
'link-missing' => '',
|
||||||
|
'event' => [
|
||||||
|
'expired' => 'This event has been expired.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'onepage' => [
|
'onepage' => [
|
||||||
|
|
|
||||||
|
|
@ -461,7 +461,10 @@ return [
|
||||||
'cart-subtotal' => 'Cart Subtotal',
|
'cart-subtotal' => 'Cart Subtotal',
|
||||||
'cart-remove-action' => 'Do you really want to do this ?',
|
'cart-remove-action' => 'Do you really want to do this ?',
|
||||||
'partial-cart-update' => 'Only some of the product(s) were updated',
|
'partial-cart-update' => 'Only some of the product(s) were updated',
|
||||||
'link-missing' => ''
|
'link-missing' => '',
|
||||||
|
'event' => [
|
||||||
|
'expired' => 'This event has been expired.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'onepage' => [
|
'onepage' => [
|
||||||
|
|
|
||||||
|
|
@ -429,6 +429,9 @@ return [
|
||||||
'cart-subtotal' => 'Total parcial',
|
'cart-subtotal' => 'Total parcial',
|
||||||
'cart-remove-action' => '¿Realmente quieres hacer esto?',
|
'cart-remove-action' => '¿Realmente quieres hacer esto?',
|
||||||
'partial-cart-update' => 'Solo algunos de los productos se han actualizado',
|
'partial-cart-update' => 'Solo algunos de los productos se han actualizado',
|
||||||
|
'event' => [
|
||||||
|
'expired' => 'This event has been expired.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'onepage' => [
|
'onepage' => [
|
||||||
|
|
|
||||||
|
|
@ -462,6 +462,9 @@ return [
|
||||||
'cart-subtotal' => 'سبد فرعی',
|
'cart-subtotal' => 'سبد فرعی',
|
||||||
'cart-remove-action' => 'آیا واقعاً می خواهید این کار را انجام دهید؟',
|
'cart-remove-action' => 'آیا واقعاً می خواهید این کار را انجام دهید؟',
|
||||||
'partial-cart-update' => 'فقط برخی از محصولات (های) به روز شده اند',
|
'partial-cart-update' => 'فقط برخی از محصولات (های) به روز شده اند',
|
||||||
|
'event' => [
|
||||||
|
'expired' => 'This event has been expired.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'onepage' => [
|
'onepage' => [
|
||||||
|
|
|
||||||
|
|
@ -466,7 +466,10 @@ return [
|
||||||
'cart-subtotal' => 'Subtotaal',
|
'cart-subtotal' => 'Subtotaal',
|
||||||
'cart-remove-action' => 'Wil je dit echt doen?',
|
'cart-remove-action' => 'Wil je dit echt doen?',
|
||||||
'partial-cart-update' => 'Slechts enkele van de producten zijn bijgewerkt',
|
'partial-cart-update' => 'Slechts enkele van de producten zijn bijgewerkt',
|
||||||
'link-missing' => ''
|
'link-missing' => '',
|
||||||
|
'event' => [
|
||||||
|
'expired' => 'This event has been expired.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'onepage' => [
|
'onepage' => [
|
||||||
|
|
|
||||||
|
|
@ -451,7 +451,10 @@ return [
|
||||||
'cart-subtotal' => 'Subtotal do carrinho',
|
'cart-subtotal' => 'Subtotal do carrinho',
|
||||||
'cart-remove-action' => 'Você realmente quer fazer isso ?',
|
'cart-remove-action' => 'Você realmente quer fazer isso ?',
|
||||||
'partial-cart-update' => 'Only some of the product(s) were updated',
|
'partial-cart-update' => 'Only some of the product(s) were updated',
|
||||||
'link-missing' => ''
|
'link-missing' => '',
|
||||||
|
'event' => [
|
||||||
|
'expired' => 'This event has been expired.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'onepage' => [
|
'onepage' => [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue