diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 336d52b06..e505dd457 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -147,8 +147,16 @@ abstract class PaymentModuleCore extends Module { $product_list = $package['product_list']; $order = new Order(); - $carrier = new Carrier($package['id_carrier'], $cart->id_lang); - $order->id_carrier = (int)$carrier->id; + + $carrier = null; + if (!$cart->isVirtualCart() && isset($package['id_carrier'])) + { + $carrier = new Carrier($package['id_carrier'], $cart->id_lang); + $order->id_carrier = (int)$carrier->id; + } + else + $order->id_carrier = 0; + $order->id_customer = (int)$cart->id_customer; $order->id_address_invoice = (int)$cart->id_address_invoice; $order->id_address_delivery = (int)$id_address; @@ -182,7 +190,7 @@ abstract class PaymentModuleCore extends Module $order->total_shipping_tax_excl = (float)$cart->getPackageShippingCost((int)$id_carrier, false, null, $product_list, $id_carrier); $order->total_shipping_tax_incl = (float)$cart->getPackageShippingCost((int)$id_carrier, true, null, $product_list, $id_carrier); - if (Validate::isLoadedObject($carrier)) + if (!is_null($carrier) && Validate::isLoadedObject($carrier)) $order->carrier_tax_rate = $carrier->getTaxesRate(new Address($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')})); $order->total_wrapping = (float)abs($cart->getOrderTotal(true, Cart::ONLY_WRAPPING, $product_list, $id_carrier)); @@ -221,13 +229,16 @@ abstract class PaymentModuleCore extends Module $order_detail_list[] = $order_detail; // Adding an entry in order_carrier table - $order_carrier = new OrderCarrier(); - $order_carrier->id_order = (int)$order->id; - $order_carrier->id_carrier = (int)$carrier->id; - $order_carrier->weight = (float)$order->getTotalWeight(); - $order_carrier->shipping_cost_tax_excl = (float)$order->total_shipping_tax_excl; - $order_carrier->shipping_cost_tax_incl = (float)$order->total_shipping_tax_incl; - $order_carrier->add(); + if (!is_null($carrier)) + { + $order_carrier = new OrderCarrier(); + $order_carrier->id_order = (int)$order->id; + $order_carrier->id_carrier = (int)$carrier->id; + $order_carrier->weight = (float)$order->getTotalWeight(); + $order_carrier->shipping_cost_tax_excl = (float)$order->total_shipping_tax_excl; + $order_carrier->shipping_cost_tax_incl = (float)$order->total_shipping_tax_incl; + $order_carrier->add(); + } } // Next ! diff --git a/controllers/front/OrderController.php b/controllers/front/OrderController.php index 1ef10b3f9..123745ca9 100644 --- a/controllers/front/OrderController.php +++ b/controllers/front/OrderController.php @@ -150,11 +150,13 @@ class OrderControllerCore extends ParentOrderController Tools::redirect('index.php?controller=order&step=2'); // Check the delivery option is setted - if (!Tools::getValue('delivery_option')) - Tools::redirect('index.php?controller=order&step=2'); - foreach (Tools::getValue('delivery_option') as $delivery_option) - if (empty($delivery_option)) - Tools::redirect('index.php?controller=order&step=2'); + if (!Tools::getValue('delivery_option') && !$this->context->cart->isVirtualCart()) + { + Tools::redirect('index.php?controller=order&step=2'); + foreach (Tools::getValue('delivery_option') as $delivery_option) + if (empty($delivery_option)) + Tools::redirect('index.php?controller=order&step=2'); + } $this->autoStep(); diff --git a/themes/default/order-address.tpl b/themes/default/order-address.tpl index 5b03e0d05..58cf20359 100644 --- a/themes/default/order-address.tpl +++ b/themes/default/order-address.tpl @@ -167,7 +167,7 @@ {include file="$tpl_dir./order-steps.tpl"} {include file="$tpl_dir./errors.tpl"} - {if !$multi_shipping && {Configuration::get('PS_ALLOW_MULTISHIPPING')}} + {if !$multi_shipping && {Configuration::get('PS_ALLOW_MULTISHIPPING')} && !$cart->isVirtualCart()}
{l s='Multi-shipping'}
@@ -179,7 +179,7 @@ {/if}
{else} - {if {Configuration::get('PS_ALLOW_MULTISHIPPING')}} + {if {Configuration::get('PS_ALLOW_MULTISHIPPING')} && !$cart->isVirtualCart()}
{l s='Multi-shipping'}
@@ -207,7 +207,7 @@ {/if}

- +