One Method Created
This commit is contained in:
parent
88df17a62a
commit
40d815d39b
|
|
@ -95,6 +95,23 @@ trait CartTools
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will deactivate the current cart if
|
||||
* buy now is active.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deactivateCurrentCartIfBuyNowIsActive()
|
||||
{
|
||||
if (request()->get('is_buy_now')) {
|
||||
if ($deactivatedCart = $this->getCart()) {
|
||||
session()->put('deactivated_cart_id', $deactivatedCart->id);
|
||||
|
||||
$this->deActivateCart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will reactivate the cart which is deactivated at the the time of buy now functionality.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -68,13 +68,7 @@ class CartController extends Controller
|
|||
public function add($id)
|
||||
{
|
||||
try {
|
||||
if (request()->get('is_buy_now')) {
|
||||
if ($deactivatedCart = Cart::getCart()) {
|
||||
session()->put('deactivated_cart_id', $deactivatedCart->id);
|
||||
|
||||
Cart::deActivateCart();
|
||||
}
|
||||
}
|
||||
Cart::deactivateCurrentCartIfBuyNowIsActive();
|
||||
|
||||
$result = Cart::addProduct($id, request()->all());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue