Fixed preorder bug
This commit is contained in:
parent
80ea917581
commit
b868887ccc
|
|
@ -9,6 +9,12 @@ use Webkul\Attribute\Repositories\AttributeRepository;
|
|||
use Webkul\Attribute\Repositories\AttributeFamilyRepository;
|
||||
use Validator;
|
||||
|
||||
/**
|
||||
* SAASPreOrderSeeder
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class GenerateData extends Command
|
||||
{
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class PreOrderController extends Controller
|
|||
*
|
||||
* @param Webkul\Product\Repositories\ProductRepository $productRepository
|
||||
* @param Webkul\Sales\Repositories\OrderItemRepository $orderItemRepository
|
||||
* @param Webkul\PreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @param Webkul\SAASPreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Cart
|
|||
*
|
||||
* @param Webkul\Product\Helpers\Price $priceHelper
|
||||
* @param Webkul\Product\Repositories\ProductRepository $productRepository
|
||||
* @param Webkul\PreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @param Webkul\SAASPreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
@ -160,6 +160,14 @@ class Cart
|
|||
if (! request()->input('pre_order_payment')) {
|
||||
$product = $this->productRepository->find($cartItem->product_id);
|
||||
|
||||
if ($product->type == 'configurable') {
|
||||
if (isset($cartItem->child->product_id)) {
|
||||
$product = $this->productRepository->find($cartItem->child->product_id);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($product->totalQuantity() > 0 || ! $product->allow_preorder)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class Invoice
|
|||
/**
|
||||
* Create a new Order event listener instance.
|
||||
*
|
||||
* @param Webkul\PreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @param Webkul\SAASPreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @param Webkul\Sales\Repositories\OrderRepository $orderRepository
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Order
|
|||
* Create a new Order event listener instance.
|
||||
*
|
||||
* @param Webkul\Product\Helpers\Price $priceHelper
|
||||
* @param Webkul\PreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @param Webkul\SAASPreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
</a>
|
||||
@endif
|
||||
|
||||
@if ($order->canShip() && ! app('Webkul\SAASPreOrder\Repositories\PreOrderItemRepository')->resetScope()->findOneByField('payment_order_item_id', $item->id))
|
||||
@if ($order->canShip() && ! app('Webkul\SAASPreOrder\Repositories\PreOrderItemRepository')->isPreOrderPaymentOrder($order->id))
|
||||
<a href="{{ route('admin.sales.shipments.create', $order->id) }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.sales.orders.shipment-btn-title') }}
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
@include ('shop::products.buy-now')
|
||||
|
||||
<button type="submit" class="btn btn-lg btn-primary pre-order-btn" style="width: 100%; display: none;">
|
||||
<button type="submit" class="btn btn-lg btn-black pre-order-btn" style="width: 100%; display: none;">
|
||||
{{ __('preorder::app.shop.products.preorder') }}
|
||||
</button>
|
||||
@endif
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
</a>
|
||||
@endif
|
||||
|
||||
@if ($order->canShip())
|
||||
@if ($order->canShip() && ! app('Webkul\SAASPreOrder\Repositories\PreOrderItemRepository')->isPreOrderPaymentOrder($order->id))
|
||||
<a href="{{ route('admin.sales.shipments.create', $order->id) }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.sales.orders.shipment-btn-title') }}
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@
|
|||
<td data-value="{{ __('shop::app.customer.account.order.view.product-name') }}">
|
||||
{{ $item->name }}
|
||||
|
||||
@if ($preOrderItem = $preOrderItemRepository->resetScope()->findOneByField('order_item_id', $item->id))
|
||||
@if ($preOrderItem = $preOrderItemRepository->findOneByField('order_item_id', $item->id))
|
||||
<div class="pre-order-item-info">
|
||||
<span class="heading" @if($item->type == 'configurable')style="margin-top: 0"@endif>
|
||||
{{ __('preorder::app.shop.sales.orders.preorder-information') }}
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
</span>
|
||||
@endif
|
||||
</div>
|
||||
@elseif ($preOrderItem = app('Webkul\SAASPreOrder\Repositories\PreOrderItemRepository')->resetScope()->findOneByField('payment_order_item_id', $item->id))
|
||||
@elseif ($preOrderItem = app('Webkul\SAASPreOrder\Repositories\PreOrderItemRepository')->findOneByField('payment_order_item_id', $item->id))
|
||||
<div class="pre-order-item-info">
|
||||
<span class="heading" @if($item->type == 'configurable')style="margin-top: 0"@endif>
|
||||
{{ __('preorder::app.shop.sales.orders.preorder-payment-information') }}
|
||||
|
|
|
|||
Loading…
Reference in New Issue