// Merge -> revision 8149
This commit is contained in:
+1
-1
@@ -959,7 +959,7 @@ class CartCore extends ObjectModel
|
||||
$price = Product::getPriceStatic((int)($product['id_product']), true, (int)($product['id_product_attribute']), 2, NULL, false, true, $product['cart_quantity'], false, ((int)($this->id_customer) ? (int)($this->id_customer) : NULL), (int)($this->id), ((int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) ? (int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) : NULL));
|
||||
$total_price = Tools::ps_round($price, 2) * (int)($product['cart_quantity']);
|
||||
if (!$withTaxes)
|
||||
$total_price = Tools::ps_round($total_price / (1 + ($product['rate'] / 100)), 2);
|
||||
$total_price = Tools::ps_round($total_price / (1 + ((float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100)), 2);
|
||||
}
|
||||
$order_total += $total_price;
|
||||
}
|
||||
|
||||
@@ -128,11 +128,11 @@ class FrontControllerCore
|
||||
$this->context->smarty->ps_language = $this->context->language;
|
||||
|
||||
$protocol_link = (Configuration::get('PS_SSL_ENABLED') OR Tools::usingSecureMode()) ? 'https://' : 'http://';
|
||||
$useSSL = (isset($this->ssl) AND $this->ssl AND Configuration::get('PS_SSL_ENABLED')) OR Tools::usingSecureMode()?true:false;
|
||||
$useSSL = ((isset($this->ssl) AND $this->ssl AND Configuration::get('PS_SSL_ENABLED')) OR Tools::usingSecureMode()) ? true : false;
|
||||
$protocol_content = ($useSSL) ? 'https://' : 'http://';
|
||||
$link = new Link($protocol_link, $protocol_content);
|
||||
$this->context->link = $link;
|
||||
|
||||
|
||||
if ($this->auth AND !$this->context->customer->isLogged($this->guestAllowed))
|
||||
Tools::redirect('index.php?controller=authentication'.($this->authRedirection ? '&back='.$this->authRedirection : ''));
|
||||
|
||||
|
||||
+16
-7
@@ -420,22 +420,30 @@ class OrderCore extends ObjectModel
|
||||
|
||||
$group_reduction = 1;
|
||||
if ($row['group_reduction'] > 0)
|
||||
$group_reduction = $row['group_reduction'] / 100;
|
||||
$group_reduction = 1 - $row['group_reduction'] / 100;
|
||||
|
||||
if ($row['reduction_percent'])
|
||||
if ($row['reduction_percent'] != 0)
|
||||
{
|
||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
$row['product_price'] = $row['product_price'] - $row['product_price'] * ($row['reduction_percent'] * 0.01 * $group_reduction);
|
||||
$row['product_price'] = ($row['product_price'] - $row['product_price'] * ($row['reduction_percent'] * 0.01));
|
||||
else
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] - $row['product_price_wt'] * ($row['reduction_percent'] * 0.01 * $group_reduction), 2);
|
||||
$row['product_price_wt'] = Tools::ps_round(($row['product_price_wt'] - $row['product_price_wt'] * ($row['reduction_percent'] * 0.01)), 2);
|
||||
}
|
||||
|
||||
if ($row['reduction_amount'])
|
||||
if ($row['reduction_amount'] != 0)
|
||||
{
|
||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
$row['product_price'] = $row['product_price'] - ($row['reduction_amount'] / (1 + $row['tax_rate'] / 100)) * $group_reduction;
|
||||
$row['product_price'] = ($row['product_price'] - ($row['reduction_amount'] / (1 + $row['tax_rate'] / 100)));
|
||||
else
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] - $row['reduction_amount'] * $group_reduction, 2);
|
||||
$row['product_price_wt'] = Tools::ps_round(($row['product_price_wt'] - $row['reduction_amount']), 2);
|
||||
}
|
||||
|
||||
if ($row['group_reduction'] > 0)
|
||||
{
|
||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
$row['product_price'] = $row['product_price'] * $group_reduction;
|
||||
else
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] * $group_reduction , 2);
|
||||
}
|
||||
|
||||
if (($row['reduction_percent'] OR $row['reduction_amount'] OR $row['group_reduction']) AND $this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
@@ -453,6 +461,7 @@ class OrderCore extends ObjectModel
|
||||
$row['total_price'] = $row['product_quantity'] * $row['product_price'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get order products
|
||||
*
|
||||
|
||||
@@ -222,7 +222,7 @@ abstract class PaymentModuleCore extends Module
|
||||
if (!empty($product['ecotax']))
|
||||
$ecotaxTaxRate = Tax::getProductEcotaxRate($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
|
||||
$product_price = (float)Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, false);
|
||||
$product_price = (float)Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, true, false);
|
||||
$quantityDiscount = SpecificPrice::getQuantityDiscount((int)$product['id_product'], $this->context->shop->getID(), (int)$cart->id_currency, (int)$vat_address->id_country, (int)$customer->id_default_group, (int)$product['cart_quantity']);
|
||||
$unitPrice = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL), 2, NULL, false, true, 1, false, (int)$order->id_customer, NULL, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$quantityDiscountValue = $quantityDiscount ? ((Product::getTaxCalculationMethod((int)$order->id_customer) == PS_TAX_EXC ? Tools::ps_round($unitPrice, 2) : $unitPrice) - $quantityDiscount['price'] * (1 + $tax_rate / 100)) : 0.00;
|
||||
|
||||
@@ -3050,8 +3050,18 @@ class ProductCore extends ObjectModel
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the product is in at least one of the submited categories
|
||||
*
|
||||
* @param int $id_product
|
||||
* @param array $categories array of category arrays
|
||||
* @return boolean is the product in at least one category
|
||||
*/
|
||||
public static function idIsOnCategoryId($id_product, $categories)
|
||||
{
|
||||
if (!((int)$id_product > 0) || !is_array($categories) || empty($categories))
|
||||
return false;
|
||||
$sql = 'SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE `id_product`='.(int)($id_product).' AND `id_category` IN(';
|
||||
foreach ($categories AS $category)
|
||||
$sql .= (int)($category['id_category']).',';
|
||||
|
||||
@@ -88,7 +88,7 @@ class ProductDownloadCore extends ObjectModel
|
||||
public function __construct($id_product_download = NULL)
|
||||
{
|
||||
parent::__construct($id_product_download);
|
||||
// TODO check if the file is present on hard drive
|
||||
// @TODO check if the file is present on hard drive
|
||||
}
|
||||
|
||||
public function delete($deleteFile=false)
|
||||
|
||||
+7
-5
@@ -224,12 +224,14 @@ class ToolsCore
|
||||
*/
|
||||
public static function usingSecureMode()
|
||||
{
|
||||
if (empty($_SERVER['HTTPS'])) {
|
||||
if(!empty($_SERVER['SSL']))
|
||||
$_SERVER['HTTPS'] = $_SERVER['SSL'];
|
||||
if (isset($_SERVER['HTTPS']))
|
||||
return ($_SERVER['HTTPS'] == 1 || strtolower($_SERVER['HTTPS']) == 'on');
|
||||
// $_SERVER['SSL'] exists only in some specific configuration
|
||||
if (isset($_SERVER['SSL']))
|
||||
return ($_SERVER['SSL'] == 1 || strtolower($_SERVER['SSL']) == 'on');
|
||||
|
||||
return false;
|
||||
}
|
||||
return !(empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current url prefix protocol (https/http)
|
||||
|
||||
Reference in New Issue
Block a user