Fixed: review changes
This commit is contained in:
@@ -50,9 +50,6 @@ class BankwirePaymentModuleFrontController extends ModuleFrontController
|
||||
$total = $cart->getOrderTotal(true, Cart::BOTH);
|
||||
}
|
||||
|
||||
// check all service products are available
|
||||
ServiceProductCartDetail::validateServiceProductsInCart();
|
||||
|
||||
$restrict_order = false;
|
||||
/*Check Order restrict condition before Payment by the customer*/
|
||||
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
|
||||
|
||||
@@ -49,9 +49,6 @@ class BankwireValidationModuleFrontController extends ModuleFrontController
|
||||
if (!$authorized)
|
||||
die($this->module->l('This payment method is not available.', 'validation'));
|
||||
|
||||
// check all service products are available
|
||||
ServiceProductCartDetail::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,9 +50,6 @@ class ChequePaymentModuleFrontController extends ModuleFrontController
|
||||
$total = $cart->getOrderTotal(true, Cart::BOTH);
|
||||
}
|
||||
|
||||
// check all service products are available
|
||||
ServiceProductCartDetail::validateServiceProductsInCart();
|
||||
|
||||
$restrict_order = false;
|
||||
/*Check Order restrict condition before Payment by the customer*/
|
||||
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
|
||||
|
||||
@@ -48,9 +48,6 @@ class ChequeValidationModuleFrontController extends ModuleFrontController
|
||||
if (!$authorized)
|
||||
die($this->module->l('This payment method is not available.', 'validation'));
|
||||
|
||||
// check all service products are available
|
||||
ServiceProductCartDetail::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';
|
||||
|
||||
@@ -997,6 +997,9 @@ class HotelCartBookingData extends ObjectModel
|
||||
// Without hotel/booking context, service must be sellable standalone.
|
||||
if (!$isSellableAsStandalone) {
|
||||
$toRemoveService = 1;
|
||||
}else if($context->customer->id && !Customer::getAddressesTotalById((int) $context->customer->id)) {
|
||||
// customer has no address, so we cannot sell standalone service product to them
|
||||
$errors[] = $objModule->l('Please add an address to your account before proceeding with the order.', 'HotelOrderRestrictDate');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -662,46 +662,4 @@ class ServiceProductCartDetail extends ObjectModel
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
public static function validateServiceProductsInCart()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$objServiceProductCartDetail = new ServiceProductCartDetail();
|
||||
|
||||
// standalone products require customer address before payment
|
||||
if ($context->customer->id
|
||||
&& !Customer::getAddressesTotalById((int) $context->customer->id)
|
||||
&& count($objServiceProductCartDetail->getServiceProductsInCart(
|
||||
$context->cart->id,
|
||||
[
|
||||
Product::SELLING_PREFERENCE_WITH_STANDALONE,
|
||||
Product::SELLING_PREFERENCE_WITH_HOTEL_AND_WITH_STANDALONE,
|
||||
Product::SELLING_PREFERENCE_WITH_STANDALONE_AND_WITH_ROOM_TYPE,
|
||||
Product::SELLING_PREFERENCE_WITH_HOTEL_AND_WITH_ROOM_TYPE_AND_WITH_STANDALONE,
|
||||
],
|
||||
0,
|
||||
0
|
||||
))
|
||||
) {
|
||||
Tools::redirect('index.php?controller=address&back='.urlencode('order.php?step=1'));
|
||||
}
|
||||
|
||||
if ($cartProducts = $context->cart->getProducts()) {
|
||||
foreach ($cartProducts as $product) {
|
||||
if (!$product['active'] && !$product['booking_product']) {
|
||||
if ($serviceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
|
||||
$context->cart->id,
|
||||
[],
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
$product['id_product']
|
||||
)) {
|
||||
foreach ($serviceProducts as $serviceProduct) {
|
||||
$objServiceProductCartDetail->removeServiceProductByIdHtlCartBooking($serviceProduct['htl_cart_booking_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ class QloDuitkuPaymentValidateModuleFrontController extends ModuleFrontControlle
|
||||
|
||||
if (isset($response['status']) && $response['status'] === true) {
|
||||
$response['status'] = true;
|
||||
} elseif (isset($response['message'])) {
|
||||
$response['status'] = false;
|
||||
$response['message'] = $response['message'];
|
||||
} else if (isset($response['response']['statusMessage'])) {
|
||||
$response['message'] = $response['response']['statusMessage'];
|
||||
} elseif (isset($response['response']['title'])) {
|
||||
|
||||
@@ -385,8 +385,13 @@ class QloDuitkuPayment extends PaymentModule
|
||||
public function getDuitkuTransactionTokenResponse()
|
||||
{
|
||||
$cart = new Cart((int) $this->context->cart->id);
|
||||
// Validate and remove non-selected services from the cart
|
||||
ServiceProductCartDetail::validateServiceProductsInCart();
|
||||
// Validate cart and remove invalid services from the cart
|
||||
if ($errors = HotelCartBookingData::validateCartBookings()) {
|
||||
return array(
|
||||
'status' => false,
|
||||
'message' => implode('<br>', array_unique($errors)),
|
||||
);
|
||||
}
|
||||
|
||||
$cartTotalAmount = $cart->is_advance_payment
|
||||
? $cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT)
|
||||
|
||||
Reference in New Issue
Block a user