From efed5f4a88cda3cfb43bebf3f32b1a76f36a2be3 Mon Sep 17 00:00:00 2001 From: rGaillard Date: Mon, 12 Mar 2012 17:47:13 +0000 Subject: [PATCH] // Clean product and carrier tax rules group on update git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14057 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Carrier.php | 9 +++++---- classes/Product.php | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/classes/Carrier.php b/classes/Carrier.php index 56787eb7f..d9c4f04b1 100644 --- a/classes/Carrier.php +++ b/classes/Carrier.php @@ -931,14 +931,15 @@ class CarrierCore extends ObjectModel { if (!$context) $context = Context::getContext(); - if (!Cache::isStored((int)$id_carrier.'_'.(int)$context->shop->id)) - Cache::store((int)$id_carrier.'_'.(int)$context->shop->id, + $key = 'carrier_id_tax_rules_group_'.(int)$id_carrier.'_'.(int)$context->shop->id; + if (!Cache::isStored($key)) + Cache::store($key, Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT `id_tax_rules_group` FROM `'._DB_PREFIX_.'carrier_tax_rules_group_shop` WHERE `id_carrier` = '.(int)$id_carrier.' AND id_shop='.(int)Context::getContext()->shop->id)); - return Cache::retrieve((int)$id_carrier.'_'.(int)$context->shop->id); + return Cache::retrieve($key); } public function deleteTaxRulesGroup(array $shops = null) @@ -971,7 +972,7 @@ class CarrierCore extends ObjectModel 'id_tax_rules_group' => (int)$id_tax_rules_group, 'id_shop' => (int)$id_shop, ); - + Cache::clean('carrier_id_tax_rules_group_'.(int)$this->id.'_'.(int)Context::getContext()->shop->id); return Db::getInstance()->insert('carrier_tax_rules_group_shop', $values); } diff --git a/classes/Product.php b/classes/Product.php index c1b1cbe54..78dfb1efb 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -4125,7 +4125,7 @@ class ProductCore extends ObjectModel 'id_tax_rules_group' => (int)$id_tax_rules_group, 'id_shop' => (int)$id_shop, ); - + Cache::clean('product_id_tax_rules_group_'.(int)$this->id.'_'.(int)Context::getContext()->shop->id); return Db::getInstance()->insert('product_tax_rules_group_shop', $values); } @@ -4138,14 +4138,16 @@ class ProductCore extends ObjectModel { if (!$context) $context = Context::getContext(); - if (!Cache::isStored((int)$id_product.'_'.(int)$context->shop->id)) - Cache::store((int)$id_product.'_'.(int)$context->shop->id, + + $key = 'product_id_tax_rules_group_'.(int)$id_product.'_'.(int)$context->shop->id; + if (!Cache::isStored($key)) + Cache::store($key, Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT `id_tax_rules_group` FROM `'._DB_PREFIX_.'product_tax_rules_group_shop` WHERE `id_product` = '.(int)$id_product.' AND id_shop='.(int)Context::getContext()->shop->id)); - return Cache::retrieve((int)$id_product.'_'.(int)$context->shop->id); + return Cache::retrieve($key); } /**