Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
+14
-15
@@ -1161,23 +1161,18 @@ class CarrierCore extends ObjectModel
|
|||||||
$query->where('pc.id_product = '.(int)$product->id);
|
$query->where('pc.id_product = '.(int)$product->id);
|
||||||
$query->where('pc.id_shop = '.(int)$id_shop);
|
$query->where('pc.id_shop = '.(int)$id_shop);
|
||||||
|
|
||||||
$carriers = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
$carriers_for_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||||
|
$carrier_list = array();
|
||||||
if (!empty($carriers))
|
if (!empty($carriers_for_product))
|
||||||
{
|
{
|
||||||
//the product is linked with carriers
|
//the product is linked with carriers
|
||||||
$carrier_list = array();
|
foreach ($carriers_for_product as $carrier) //check if the linked carriers are available in current zone
|
||||||
foreach ($carriers as $carrier) //check if the linked carriers are available in current zone
|
|
||||||
if (Carrier::checkCarrierZone($carrier['id_carrier'], $id_zone))
|
if (Carrier::checkCarrierZone($carrier['id_carrier'], $id_zone))
|
||||||
$carrier_list[] = $carrier['id_carrier'];
|
$carrier_list[] = $carrier['id_carrier'];
|
||||||
if (!empty($carrier_list))
|
if (empty($carrier_list))
|
||||||
return $carrier_list;
|
|
||||||
else
|
|
||||||
return array();//no linked carrier are available for this zone
|
return array();//no linked carrier are available for this zone
|
||||||
}
|
}
|
||||||
|
|
||||||
$carrier_list = array();
|
|
||||||
|
|
||||||
// The product is not dirrectly linked with a carrier
|
// The product is not dirrectly linked with a carrier
|
||||||
// Get all the carriers linked to a warehouse
|
// Get all the carriers linked to a warehouse
|
||||||
if ($id_warehouse)
|
if ($id_warehouse)
|
||||||
@@ -1189,13 +1184,17 @@ class CarrierCore extends ObjectModel
|
|||||||
$available_carrier_list = array();
|
$available_carrier_list = array();
|
||||||
$customer = new Customer($cart->id_customer);
|
$customer = new Customer($cart->id_customer);
|
||||||
$carriers = Carrier::getCarriersForOrder($id_zone, $customer->getGroups(), $cart);
|
$carriers = Carrier::getCarriersForOrder($id_zone, $customer->getGroups(), $cart);
|
||||||
|
|
||||||
foreach ($carriers as $carrier)
|
foreach ($carriers as $carrier)
|
||||||
$available_carrier_list[] = $carrier['id_carrier'];
|
$available_carrier_list[] = $carrier['id_carrier'];
|
||||||
|
|
||||||
if (empty($warehouse_carrier_list))
|
if ($carrier_list)
|
||||||
$carrier_list = $available_carrier_list;
|
$carrier_list = array_intersect($available_carrier_list, $carrier_list);
|
||||||
else
|
else
|
||||||
$carrier_list = array_intersect($warehouse_carrier_list, $available_carrier_list);
|
$carrier_list = $available_carrier_list;
|
||||||
|
|
||||||
|
if (isset($warehouse_carrier_list))
|
||||||
|
$carrier_list = array_intersect($carrier_list, $warehouse_carrier_list);
|
||||||
|
|
||||||
if ($product->width > 0 || $product->height > 0 || $product->depth > 0 || $product->weight > 0)
|
if ($product->width > 0 || $product->height > 0 || $product->depth > 0 || $product->weight > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-2
@@ -1508,7 +1508,6 @@ class CartCore extends ObjectModel
|
|||||||
if ($cart_rule['obj']->reduction_percent > 0 || $cart_rule['obj']->reduction_amount > 0)
|
if ($cart_rule['obj']->reduction_percent > 0 || $cart_rule['obj']->reduction_amount > 0)
|
||||||
$order_total_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_REDUCTION, $package, $use_cache), 2);
|
$order_total_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_REDUCTION, $package, $use_cache), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$order_total_discount = min(Tools::ps_round($order_total_discount, 2), $wrapping_fees + $order_total_products + $shipping_fees);
|
$order_total_discount = min(Tools::ps_round($order_total_discount, 2), $wrapping_fees + $order_total_products + $shipping_fees);
|
||||||
$order_total -= $order_total_discount;
|
$order_total -= $order_total_discount;
|
||||||
}
|
}
|
||||||
@@ -2603,8 +2602,12 @@ class CartCore extends ObjectModel
|
|||||||
|
|
||||||
$carrier = self::$_carriers[$id_carrier];
|
$carrier = self::$_carriers[$id_carrier];
|
||||||
|
|
||||||
|
// No valid Carrier or $id_carrier <= 0 ?
|
||||||
if (!Validate::isLoadedObject($carrier))
|
if (!Validate::isLoadedObject($carrier))
|
||||||
die(Tools::displayError('Fatal error: "no default carrier"'));
|
{
|
||||||
|
Cache::store($cache_id, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$carrier->active)
|
if (!$carrier->active)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3775,11 +3775,16 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// gets the minimum
|
// gets the minimum
|
||||||
$pack_quantity = $pack_quantities[0];
|
if (!count($pack_quantities))
|
||||||
foreach ($pack_quantities as $value)
|
$pack_quantity = 0;
|
||||||
{
|
else
|
||||||
if ($pack_quantity > $value)
|
{
|
||||||
$pack_quantity = $value;
|
$pack_quantity = $pack_quantities[0];
|
||||||
|
foreach ($pack_quantities as $value)
|
||||||
|
{
|
||||||
|
if ($pack_quantity > $value)
|
||||||
|
$pack_quantity = $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Warehouse::getPackWarehouses((int)$obj->id))
|
if (!Warehouse::getPackWarehouses((int)$obj->id))
|
||||||
|
|||||||
Reference in New Issue
Block a user