Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development

This commit is contained in:
vAugagneur
2013-01-28 17:47:31 +01:00
9 changed files with 75 additions and 53 deletions
+3 -3
View File
@@ -546,7 +546,7 @@
'StateCore' => 'classes/State.php', 'StateCore' => 'classes/State.php',
'StatisticsController' => 'override/controllers/front/StatisticsController.php', 'StatisticsController' => 'override/controllers/front/StatisticsController.php',
'StatisticsControllerCore' => 'controllers/front/StatisticsController.php', 'StatisticsControllerCore' => 'controllers/front/StatisticsController.php',
'Stock' => 'override/classes/Stock.php', 'Stock' => 'override/classes/stock/Stock.php',
'StockAvailable' => 'override/classes/stock/StockAvailable.php', 'StockAvailable' => 'override/classes/stock/StockAvailable.php',
'StockAvailableCore' => 'classes/stock/StockAvailable.php', 'StockAvailableCore' => 'classes/stock/StockAvailable.php',
'StockCore' => 'classes/stock/Stock.php', 'StockCore' => 'classes/stock/Stock.php',
@@ -557,9 +557,9 @@
'StockManagerInterface' => 'classes/stock/StockManagerInterface.php', 'StockManagerInterface' => 'classes/stock/StockManagerInterface.php',
'StockManagerModule' => 'override/classes/stock/StockManagerModule.php', 'StockManagerModule' => 'override/classes/stock/StockManagerModule.php',
'StockManagerModuleCore' => 'classes/stock/StockManagerModule.php', 'StockManagerModuleCore' => 'classes/stock/StockManagerModule.php',
'StockMvt' => 'override/classes/StockMvt.php', 'StockMvt' => 'override/classes/stock/StockMvt.php',
'StockMvtCore' => 'classes/stock/StockMvt.php', 'StockMvtCore' => 'classes/stock/StockMvt.php',
'StockMvtReason' => 'override/classes/StockMvtReason.php', 'StockMvtReason' => 'override/classes/stock/StockMvtReason.php',
'StockMvtReasonCore' => 'classes/stock/StockMvtReason.php', 'StockMvtReasonCore' => 'classes/stock/StockMvtReason.php',
'StockMvtWS' => 'override/classes/stock/StockMvtWS.php', 'StockMvtWS' => 'override/classes/stock/StockMvtWS.php',
'StockMvtWSCore' => 'classes/stock/StockMvtWS.php', 'StockMvtWSCore' => 'classes/stock/StockMvtWS.php',
+2 -2
View File
@@ -565,8 +565,8 @@ class CarrierCore extends ObjectModel
} }
$row['name'] = (strval($row['name']) != '0' ? $row['name'] : Configuration::get('PS_SHOP_NAME')); $row['name'] = (strval($row['name']) != '0' ? $row['name'] : Configuration::get('PS_SHOP_NAME'));
$row['price'] = ($shipping_method == Carrier::SHIPPING_METHOD_FREE ? 0 : $cart->getPackageShippingCost((int)$row['id_carrier'])); $row['price'] = ($shipping_method == Carrier::SHIPPING_METHOD_FREE ? 0 : $cart->getPackageShippingCost((int)$row['id_carrier'], true, null, null, $id_zone));
$row['price_tax_exc'] = ($shipping_method == Carrier::SHIPPING_METHOD_FREE ? 0 : $cart->getPackageShippingCost((int)$row['id_carrier'], false)); $row['price_tax_exc'] = ($shipping_method == Carrier::SHIPPING_METHOD_FREE ? 0 : $cart->getPackageShippingCost((int)$row['id_carrier'], false, null, null, $id_zone));
$row['img'] = file_exists(_PS_SHIP_IMG_DIR_.(int)$row['id_carrier']).'.jpg' ? _THEME_SHIP_DIR_.(int)$row['id_carrier'].'.jpg' : ''; $row['img'] = file_exists(_PS_SHIP_IMG_DIR_.(int)$row['id_carrier']).'.jpg' ? _THEME_SHIP_DIR_.(int)$row['id_carrier'].'.jpg' : '';
// If price is false, then the carrier is unavailable (carrier module) // If price is false, then the carrier is unavailable (carrier module)
+28 -20
View File
@@ -2393,11 +2393,13 @@ class CartCore extends ObjectModel
*/ */
public function getTotalShippingCost($delivery_option = null, $use_tax = true, Country $default_country = null) public function getTotalShippingCost($delivery_option = null, $use_tax = true, Country $default_country = null)
{ {
if(isset(Context::getContext()->cookie->id_country))
$default_country = new Country(Context::getContext()->cookie->id_country);
if (is_null($delivery_option)) if (is_null($delivery_option))
$delivery_option = $this->getDeliveryOption($default_country, false, false); $delivery_option = $this->getDeliveryOption($default_country, false, false);
$total_shipping = 0; $total_shipping = 0;
$delivery_option_list = $this->getDeliveryOptionList(); $delivery_option_list = $this->getDeliveryOptionList($default_country);
foreach ($delivery_option as $id_address => $key) foreach ($delivery_option as $id_address => $key)
{ {
if (!isset($delivery_option_list[$id_address]) || !isset($delivery_option_list[$id_address][$key])) if (!isset($delivery_option_list[$id_address]) || !isset($delivery_option_list[$id_address][$key]))
@@ -2465,7 +2467,7 @@ class CartCore extends ObjectModel
* *
* @return float Shipping total * @return float Shipping total
*/ */
public function getPackageShippingCost($id_carrier = null, $use_tax = true, Country $default_country = null, $product_list = null) public function getPackageShippingCost($id_carrier = null, $use_tax = true, Country $default_country = null, $product_list = null, $id_zone = null)
{ {
if ($this->isVirtualCart()) if ($this->isVirtualCart())
return 0; return 0;
@@ -2511,19 +2513,22 @@ class CartCore extends ObjectModel
return $shipping_cost; return $shipping_cost;
} }
// Get id zone if(!isset($id_zone))
if (!$this->isMultiAddressDelivery()
&& isset($this->id_address_delivery) // Be carefull, id_address_delivery is not usefull one 1.5
&& $this->id_address_delivery
&& Customer::customerHasAddress($this->id_customer, $this->id_address_delivery
))
$id_zone = Address::getZoneById((int)$this->id_address_delivery);
else
{ {
if (!Validate::isLoadedObject($default_country)) // Get id zone
$default_country = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT')); if (!$this->isMultiAddressDelivery()
&& isset($this->id_address_delivery) // Be carefull, id_address_delivery is not usefull one 1.5
&& $this->id_address_delivery
&& Customer::customerHasAddress($this->id_customer, $this->id_address_delivery
))
$id_zone = Address::getZoneById((int)$this->id_address_delivery);
else
{
if (!Validate::isLoadedObject($default_country))
$default_country = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
$id_zone = (int)$default_country->id_zone; $id_zone = (int)$default_country->id_zone;
}
} }
if ($id_carrier && !$this->isCarrierInRange((int)$id_carrier, (int)$id_zone)) if ($id_carrier && !$this->isCarrierInRange((int)$id_carrier, (int)$id_zone))
@@ -2658,13 +2663,16 @@ class CartCore extends ObjectModel
// Get shipping cost using correct method // Get shipping cost using correct method
if ($carrier->range_behavior) if ($carrier->range_behavior)
{ {
// Get id zone if(!isset($id_zone))
if (isset($this->id_address_delivery) {
&& $this->id_address_delivery // Get id zone
&& Customer::customerHasAddress($this->id_customer, $this->id_address_delivery)) if (isset($this->id_address_delivery)
$id_zone = Address::getZoneById((int)$this->id_address_delivery); && $this->id_address_delivery
else && Customer::customerHasAddress($this->id_customer, $this->id_address_delivery))
$id_zone = (int)$default_country->id_zone; $id_zone = Address::getZoneById((int)$this->id_address_delivery);
else
$id_zone = (int)$default_country->id_zone;
}
$check_delivery_price_by_weight = Carrier::checkDeliveryPriceByWeight((int)$carrier->id, $this->getTotalWeight(), (int)$id_zone); $check_delivery_price_by_weight = Carrier::checkDeliveryPriceByWeight((int)$carrier->id, $this->getTotalWeight(), (int)$id_zone);
+4 -1
View File
@@ -39,6 +39,8 @@ class OrderControllerCore extends ParentOrderController
parent::init(); parent::init();
$this->step = (int)(Tools::getValue('step')); $this->step = (int)(Tools::getValue('step'));
if (!$this->nbProducts)
$this->step = -1;
// If some products have disappear // If some products have disappear
if (!$this->context->cart->checkQuantities()) if (!$this->context->cart->checkQuantities())
@@ -249,7 +251,8 @@ class OrderControllerCore extends ParentOrderController
$this->context->cart->setNoMultishipping(); $this->context->cart->setNoMultishipping();
if (!Customer::customerHasAddress($this->context->customer->id, (int)Tools::getValue('id_address_delivery')) if (!Customer::customerHasAddress($this->context->customer->id, (int)Tools::getValue('id_address_delivery'))
|| (Tools::isSubmit('same') && !Customer::customerHasAddress($this->context->customer->id, (int)Tools::getValue('id_address_invoice')))) || (!Tools::isSubmit('same') && Tools::getValue('id_address_delivery') != Tools::getValue('id_address_invoice')
&& !Customer::customerHasAddress($this->context->customer->id, (int)Tools::getValue('id_address_invoice'))))
$this->errors[] = Tools::displayError('Invalid address', !Tools::getValue('ajax')); $this->errors[] = Tools::displayError('Invalid address', !Tools::getValue('ajax'));
else else
{ {
@@ -241,7 +241,15 @@ class ParentOrderControllerCore extends FrontController
$key = Cart::desintifier(Tools::getValue('id_carrier')); $key = Cart::desintifier(Tools::getValue('id_carrier'));
foreach ($delivery_option_list as $id_address => $options) foreach ($delivery_option_list as $id_address => $options)
if (isset($options[$key])) if (isset($options[$key]))
{
$this->context->cart->id_carrier = (int)Tools::getValue('id_carrier');
$this->context->cart->setDeliveryOption(array($id_address => $key)); $this->context->cart->setDeliveryOption(array($id_address => $key));
if(isset($this->context->cookie->id_country))
unset($this->context->cookie->id_country);
if(isset($this->context->cookie->id_state))
unset($this->context->cookie->id_state);
}
} }
} }
+27 -3
View File
@@ -105,6 +105,9 @@ class CarrierCompare extends Module
if (!$this->isModuleAvailable()) if (!$this->isModuleAvailable())
return; return;
if (!isset($this->context->cart) || $this->context->cart->getProducts() == 0)
return;
$protocol = (Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS']) $protocol = (Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS'])
&& strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://'; && strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://';
@@ -117,12 +120,33 @@ class CarrierCompare extends Module
$refresh_method = Configuration::get('SE_RERESH_METHOD'); $refresh_method = Configuration::get('SE_RERESH_METHOD');
if(isset($this->context->cookie->id_country) && $this->context->cookie->id_country > 0)
$id_country = (int)$this->context->cookie->id_country;
if(!isset($id_country))
$id_country = (isset($this->context->customer->geoloc_id_country) ? (int)$this->context->customer->geoloc_id_country : (int)Configuration::get('PS_COUNTRY_DEFAULT'));
if (isset($this->context->customer->id) && $this->context->customer->id && isset($this->context->cart->id_address_delivery) && $this->context->cart->id_address_delivery)
{
$address = new Address((int)($this->context->cart->id_address_delivery));
$id_country = (int)$address->id_country;
}
if(isset($this->context->cookie->id_state) && $this->context->cookie->id_state > 0)
$id_state = (int)$this->context->cookie->id_state;
if(!isset($id_state))
$id_state = (isset($this->context->customer->geoloc_id_state) ? (int)$this->context->customer->geoloc_id_state : 0);
if(isset($this->context->cookie->postcode) && $this->context->cookie->postcode > 0)
$zipcode = Tools::safeOutput($this->context->cookie->postcode);
if(!isset($zipcode))
$zipcode = (isset($this->context->customer->geoloc_postcode) ? $this->context->customer->geoloc_postcode : '');
$this->smarty->assign(array( $this->smarty->assign(array(
'countries' => Country::getCountries((int)$this->context->cookie->id_lang, true), 'countries' => Country::getCountries((int)$this->context->cookie->id_lang, true),
'id_carrier' => ($params['cart']->id_carrier ? $params['cart']->id_carrier : Configuration::get('PS_CARRIER_DEFAULT')), 'id_carrier' => ($params['cart']->id_carrier ? $params['cart']->id_carrier : Configuration::get('PS_CARRIER_DEFAULT')),
'id_country' => (isset($this->context->customer->geoloc_id_country) ? $this->context->customer->geoloc_id_country : Configuration::get('PS_COUNTRY_DEFAULT')), 'id_country' => $id_country,
'id_state' => (isset($this->context->customer->geoloc_id_state) ? $this->context->customer->geoloc_id_state : 0), 'id_state' => $id_state,
'zipcode' => (isset($this->context->customer->geoloc_postcode) ? $this->context->customer->geoloc_postcode : ''), 'zipcode' => $zipcode,
'currencySign' => $this->context->currency->sign, 'currencySign' => $this->context->currency->sign,
'currencyRate' => $this->context->currency->conversion_rate, 'currencyRate' => $this->context->currency->conversion_rate,
'currencyFormat' => $this->context->currency->format, 'currencyFormat' => $this->context->currency->format,
-7
View File
@@ -1,7 +0,0 @@
<?php
class Stock extends StockCore
{
}
-7
View File
@@ -1,7 +0,0 @@
<?php
class StockMvt extends StockMvtCore
{
}
-7
View File
@@ -1,7 +0,0 @@
<?php
class StockMvtReason extends StockMvtReasonCore
{
}