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

This commit is contained in:
vAugagneur
2013-04-17 10:02:37 +02:00
14 changed files with 43 additions and 27 deletions
+7 -2
View File
@@ -953,6 +953,7 @@ class CartCore extends ObjectModel
$this->update(true);
$context = Context::getContext()->cloneContext();
$context->cart = $this;
Cache::clean('getContextualValue_*');
if ($auto_add_cart_rule)
CartRule::autoAddToCart($context);
@@ -2869,8 +2870,12 @@ class CartCore extends ObjectModel
{
$cart_rule['value_real'] -= $total_shipping;
$cart_rule['value_tax_exc'] -= $total_shipping_tax_exc;
$total_discounts -= $total_shipping;
$total_discounts_tax_exc -= $total_shipping_tax_exc;
$cart_rule['value_real'] = Tools::ps_round($cart_rule['value_real'], (int)$context->currency->decimals * _PS_PRICE_DISPLAY_PRECISION_);
$cart_rule['value_tax_exc'] = Tools::ps_round($cart_rule['value_tax_exc'], (int)$context->currency->decimals * _PS_PRICE_DISPLAY_PRECISION_);
if ($total_discounts > $cart_rule['value_real'])
$total_discounts -= $total_shipping;
if ($total_discounts_tax_exc > $cart_rule['value_tax_exc'])
$total_discounts_tax_exc -= $total_shipping_tax_exc;
// Update total shipping
$total_shipping = 0;
+1 -1
View File
@@ -912,7 +912,7 @@ class CartRuleCore extends ObjectModel
if ($cart_vat_amount == 0 || $cart_amount_te == 0)
$cart_average_vat_rate = 0;
else
$cart_average_vat_rate = $cart_vat_amount / $cart_amount_te;
$cart_average_vat_rate = Tools::ps_round($cart_vat_amount / $cart_amount_te, 3);
if ($this->reduction_tax && !$use_tax)
$reduction_value += $prorata * $reduction_amount / (1 + $cart_average_vat_rate);
+3 -2
View File
@@ -429,13 +429,14 @@ abstract class PaymentModuleCore extends Module
// Set the new voucher value
if ($voucher->reduction_tax)
$voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt;
$voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt - $order->total_shipping_tax_incl;
else
$voucher->reduction_amount = $values['tax_excl'] - $order->total_products;
$voucher->reduction_amount = $values['tax_excl'] - $order->total_products - $order->total_shipping_tax_excl;
$voucher->id_customer = $order->id_customer;
$voucher->quantity = 1;
$voucher->quantity_per_user = 1;
$voucher->free_shipping = 0;
if ($voucher->add())
{
// If the voucher has conditions, they are now copied to the new voucher
+6 -6
View File
@@ -2347,16 +2347,16 @@ exit;
$addons_url = 'api.addons.prestashop.com';
$postData = '';
$postDataArray = array(
'version' => _PS_VERSION_,
'iso_lang' => strtolower(Context::getContext()->language->iso_code),
'iso_code' => strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))),
'shop_url' => urlencode(Tools::getShopDomain()),
'mail' => urlencode(Configuration::get('PS_SHOP_EMAIL'))
'version' => isset($params['version']) ? $params['version'] : _PS_VERSION_,
'iso_lang' => Tools::strtolower(isset($params['iso_lang']) ? $params['iso_lang'] : Context::getContext()->language->iso_code),
'iso_code' => Tools::strtolower(isset($params['iso_country']) ? $params['iso_country'] : Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))),
'shop_url' => urlencode(isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain()),
'mail' => urlencode(isset($params['email']) ? $params['email'] : Configuration::get('email'))
);
foreach ($postDataArray as $postDataKey => $postDataValue)
$postData .= '&'.$postDataKey.'='.$postDataValue;
$postData = ltrim($postData, '&');
// Config for each request
if ($request == 'native')
{
+2 -2
View File
@@ -175,8 +175,8 @@ abstract class ControllerCore
// then using displayAjax[action]
if ($this->ajax)
{
$action = Tools::getValue('action');
if (!empty($action) && method_exists($this, 'displayAjax'.Tools::toCamelCase($action, true)))
$action = Tools::toCamelCase(Tools::getValue('action', true));
if (!empty($action) && method_exists($this, $action))
$this->{'displayAjax'.$action}();
elseif (method_exists($this, 'displayAjax'))
$this->displayAjax();