remove disbale services from cart'
This commit is contained in:
@@ -389,6 +389,9 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
*/
|
||||
public function initContent()
|
||||
{
|
||||
// check all service products are available
|
||||
RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
|
||||
|
||||
parent::initContent();
|
||||
|
||||
// check ORDER RESTRICT condition before payment by the customer
|
||||
|
||||
@@ -50,6 +50,9 @@ class BankwirePaymentModuleFrontController extends ModuleFrontController
|
||||
$total = $cart->getOrderTotal(true, Cart::BOTH);
|
||||
}
|
||||
|
||||
// check all service products are available
|
||||
RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
|
||||
|
||||
$restrict_order = false;
|
||||
/*Check Order restrict condition before Payment by the customer*/
|
||||
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
|
||||
|
||||
@@ -49,6 +49,9 @@ class BankwireValidationModuleFrontController extends ModuleFrontController
|
||||
if (!$authorized)
|
||||
die($this->module->l('This payment method is not available.', 'validation'));
|
||||
|
||||
// check all service products are available
|
||||
RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
|
||||
|
||||
// Check Order restrict condition before Payment by the customer
|
||||
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
|
||||
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
|
||||
|
||||
@@ -50,6 +50,9 @@ class ChequePaymentModuleFrontController extends ModuleFrontController
|
||||
$total = $cart->getOrderTotal(true, Cart::BOTH);
|
||||
}
|
||||
|
||||
// check all service products are available
|
||||
RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
|
||||
|
||||
$restrict_order = false;
|
||||
/*Check Order restrict condition before Payment by the customer*/
|
||||
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
|
||||
|
||||
@@ -48,6 +48,9 @@ class ChequeValidationModuleFrontController extends ModuleFrontController
|
||||
if (!$authorized)
|
||||
die($this->module->l('This payment method is not available.', 'validation'));
|
||||
|
||||
// check all service products are available
|
||||
RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
|
||||
|
||||
/*Check Order restrict condition before Payment by the customer*/
|
||||
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
|
||||
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
|
||||
|
||||
@@ -341,4 +341,20 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function validateServiceProductsInCart()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
if ($cartProducts = $context->cart->getProducts()) {
|
||||
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
|
||||
foreach ($cartProducts as $product) {
|
||||
if (!$product['active'] && !$product['booking_product']) {
|
||||
$serviceProducts = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart($context->cart->id, $product['id_product']);
|
||||
foreach ($serviceProducts as $serviceProduct) {
|
||||
$objRoomTypeServiceProductCartDetail->removeServiceProductByIdHtlCartBooking($serviceProduct['htl_cart_booking_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user