// Multishipping : on opc, on putting multi-shipping to off, the cart is set to one address delivery

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10458 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2011-11-22 17:18:30 +00:00
parent 4dc0ebb2de
commit 5532f12d80
5 changed files with 60 additions and 7 deletions
+15 -2
View File
@@ -1480,6 +1480,19 @@ class CartCore extends ObjectModel
return $delivery_option_list;
}
/**
* Does the cart use multiple
*/
public function isMultiAddressDelivery()
{
$sql = new DbQuery();
$sql->select('count(distinct id_address_delivery)');
$sql->from('cart_product as cp');
$sql->where('id_cart = '.(int)$this->id);
return (boolean)(Db::getInstance()->getValue($sql) > 1);
}
/**
* Get all delivery addresses object for the current cart
*/
@@ -1916,7 +1929,6 @@ class CartCore extends ObjectModel
'invoice' => $invoice,
'invoice_state' => State::getNameById($invoice->id_state),
'formattedAddresses' => $formattedAddresses,
//'carrier' => new Carrier($this->id_carrier, $id_lang),
'products' => $this->getProducts(false),
'discounts' => $this->getCartRules(),
'is_virtual_cart' => (int)$this->isVirtualCart(),
@@ -1930,7 +1942,8 @@ class CartCore extends ObjectModel
'total_products' => $this->getOrderTotal(false, Cart::ONLY_PRODUCTS),
'total_price' => $this->getOrderTotal(),
'total_tax' => $total_tax,
'total_price_without_tax' => $this->getOrderTotal(false));
'total_price_without_tax' => $this->getOrderTotal(false),
'is_multi_address_delivery' => $this->isMultiAddressDelivery());
}
public function checkQuantities()