// when you adding a product on order, you can set a specific price
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11444 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+16
-4
@@ -2191,12 +2191,13 @@ class ProductCore extends ObjectModel
|
||||
* @param variable_reference $specificPriceOutput.
|
||||
* If a specific price applies regarding the previous parameters, this variable is filled with the corresponding SpecificPrice object
|
||||
* @param boolean $with_ecotax insert ecotax in price output.
|
||||
* @param bool $flush_cache set to true in order to flush getPriceStatic cache for these parameters
|
||||
* @return float Product price
|
||||
*/
|
||||
public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null,
|
||||
$only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null, $id_cart = null,
|
||||
$id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, Context $context = null,
|
||||
$use_customer_price = true)
|
||||
$use_customer_price = true, $flush_cache = false)
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
@@ -2234,6 +2235,10 @@ class ProductCore extends ObjectModel
|
||||
$condition = ' AND `id_product_attribute` = '.(int)$id_product_attribute;
|
||||
}
|
||||
|
||||
// Flush cache
|
||||
if (isset(self::$_cart_quantity[$cache_name]) && $flush_cache)
|
||||
unset(self::$_cart_quantity[$cache_name]);
|
||||
|
||||
if (!isset(self::$_cart_quantity[$cache_name]) || self::$_cart_quantity[$cache_name] != (int)$quantity)
|
||||
{
|
||||
self::$_cart_quantity[$cache_name] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
@@ -2305,7 +2310,8 @@ class ProductCore extends ObjectModel
|
||||
$specific_price_output,
|
||||
$use_group_reduction,
|
||||
$id_customer,
|
||||
$use_customer_price
|
||||
$use_customer_price,
|
||||
$flush_cache
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2327,12 +2333,12 @@ class ProductCore extends ObjectModel
|
||||
* @param boolean $with_ecotax insert ecotax in price output.
|
||||
* @param variable_reference $specific_price_output
|
||||
* If a specific price applies regarding the previous parameters, this variable is filled with the corresponding SpecificPrice object
|
||||
*
|
||||
* @param bool $flush_cache set to true in order to flush getPriceStatic cache for these parameters
|
||||
* @return float Product price
|
||||
**/
|
||||
public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency,
|
||||
$id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_group_reduction,
|
||||
$id_customer = 0, $use_customer_price = true)
|
||||
$id_customer = 0, $use_customer_price = true, $flush_cache = false)
|
||||
{
|
||||
if (!$use_customer_price)
|
||||
$id_customer = 0;
|
||||
@@ -2358,11 +2364,17 @@ class ProductCore extends ObjectModel
|
||||
$id_customer
|
||||
);
|
||||
|
||||
// Flush cache
|
||||
if (isset(self::$_prices[$cache_id]) && $flush_cache)
|
||||
unset(self::$_prices[$cache_id]);
|
||||
|
||||
if (isset(self::$_prices[$cache_id]))
|
||||
return self::$_prices[$cache_id];
|
||||
|
||||
// fetch price & attribute price
|
||||
$cache_id_2 = $id_product.'-'.$id_product_attribute;
|
||||
if (isset(self::$_pricesLevel2[$cache_id_2]) && $flush_cache)
|
||||
unset(self::$_pricesLevel2[$cache_id_2]);
|
||||
if (!isset(self::$_pricesLevel2[$cache_id_2]))
|
||||
{
|
||||
$sql = new DbQuery();
|
||||
|
||||
Reference in New Issue
Block a user