diff --git a/classes/Cart.php b/classes/Cart.php index 0d7e4711a..52126f604 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -2293,7 +2293,7 @@ class CartCore extends ObjectModel $this->id_carrier = 0; return; } - + Cache::clean('getContextualValue_*'); $delivery_option_list = $this->getDeliveryOptionList(null, true); foreach ($delivery_option_list as $id_address => $options) diff --git a/classes/Gender.php b/classes/Gender.php index 63a9a65bf..62b21d471 100644 --- a/classes/Gender.php +++ b/classes/Gender.php @@ -66,8 +66,8 @@ class GenderCore extends ObjectModel public function getImage($use_unknown = false) { - if (!file_exists(_PS_GENDERS_DIR_.$this->id.'.jpg')) - return ($use_unknown) ? _PS_ADMIN_IMG_.'unknown.gif' : false; + if (!isset($this->id) || empty($this->id) || !file_exists(_PS_GENDERS_DIR_.$this->id.'.jpg')) + return _THEME_GENDERS_DIR_.'Unknown.jpg'; return _THEME_GENDERS_DIR_.$this->id.'.jpg'; } } \ No newline at end of file diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 17ba854d6..ebe12dc1c 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -940,8 +940,8 @@ abstract class ObjectModelCore { global $_FIELDS; - if (file_exists(_PS_TRANSLATIONS_DIR_.Context::getContext()->language->iso_code.'/fields.php')) - include(_PS_TRANSLATIONS_DIR_.Context::getContext()->language->iso_code.'/fields.php'); + if ($_FIELDS === null && file_exists(_PS_TRANSLATIONS_DIR_.Context::getContext()->language->iso_code.'/fields.php')) + include_once(_PS_TRANSLATIONS_DIR_.Context::getContext()->language->iso_code.'/fields.php'); $key = $class.'_'.md5($field); return ((is_array($_FIELDS) && array_key_exists($key, $_FIELDS)) ? ($htmlentities ? htmlentities($_FIELDS[$key], ENT_QUOTES, 'utf-8') : $_FIELDS[$key]) : $field); @@ -1596,4 +1596,4 @@ abstract class ObjectModelCore { $this->update_fields = $fields; } -} +} \ No newline at end of file diff --git a/classes/ProductSale.php b/classes/ProductSale.php index a14b5fc3c..53503664d 100644 --- a/classes/ProductSale.php +++ b/classes/ProductSale.php @@ -65,11 +65,9 @@ class ProductSaleCore { if ($page_number < 0) $page_number = 0; if ($nb_products < 1) $nb_products = 10; - $final_order_by = $order_by; - if (empty($order_by) || $order_by == 'position' || $order_by = 'price') $order_by = 'sales'; - if (empty($order_way) || $order_by == 'sales') $order_way = 'DESC'; - + if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales'; + if (is_null($order_way) || $order_by == 'sales') $order_way == 'DESC'; $groups = FrontController::getCurrentCustomerGroups(); $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); $interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20; diff --git a/classes/SpecificPriceRule.php b/classes/SpecificPriceRule.php index e165cdba4..99b9f674d 100755 --- a/classes/SpecificPriceRule.php +++ b/classes/SpecificPriceRule.php @@ -280,7 +280,7 @@ class SpecificPriceRuleCore extends ObjectModel $specific_price->id_currency = (int)$rule->id_currency; $specific_price->id_group = (int)$rule->id_group; $specific_price->from_quantity = (int)$rule->from_quantity; - $specific_price->price = (int)$rule->price; + $specific_price->price = (float)$rule->price; $specific_price->reduction_type = $rule->reduction_type; $specific_price->reduction = ($rule->reduction_type == 'percentage' ? $rule->reduction / 100 : (float)$rule->reduction); $specific_price->from = $rule->from; @@ -288,4 +288,4 @@ class SpecificPriceRuleCore extends ObjectModel return $specific_price->add(); } -} +} \ No newline at end of file diff --git a/classes/Tools.php b/classes/Tools.php index 06e212447..519f10dc0 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -2121,9 +2121,12 @@ exit; */ public static function clearCache($smarty = null, $tpl = false, $cache_id = null, $compile_id = null) { - if (is_null($smarty)) + if ($smarty === null) $smarty = Context::getContext()->smarty; - + + if ($smarty === null) + return; + if (!$tpl && $cache_id === null && $compile_id === null) return $smarty->clearAllCache(); @@ -2456,4 +2459,3 @@ function cmpPriceDesc($a, $b) return -1; return 0; } - diff --git a/controllers/admin/AdminCmsController.php b/controllers/admin/AdminCmsController.php index 00d8eb884..71497c56e 100644 --- a/controllers/admin/AdminCmsController.php +++ b/controllers/admin/AdminCmsController.php @@ -219,22 +219,12 @@ class AdminCmsControllerCore extends AdminController /* Close list table and submit button */ $this->displayListFooter($token); } - - /** - * Modifying initial getList method to display position feature (drag and drop) - */ - public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false) - { - if ($order_by && $this->context->cookie->__get($this->table.'Orderby')) - $order_by = $this->context->cookie->__get($this->table.'Orderby'); - else - $order_by = 'position'; - - parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop); - } - + public function postProcess() { + if (Tools::isSubmit($this->table.'Orderby') || Tools::isSubmit($this->table.'Orderway')) + $this->filter = true; + if (Tools::isSubmit('viewcms') && ($id_cms = (int)Tools::getValue('id_cms')) && ($cms = new CMS($id_cms, $this->context->language->id)) && Validate::isLoadedObject($cms)) { $redir = $this->context->link->getCMSLink($cms); diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index 9d516d1d9..c457c4496 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -391,6 +391,8 @@ class AdminModulesControllerCore extends AdminController $this->recursiveDeleteOnDisk($tmp_folder); if ($success && $redirect) Tools::redirectAdmin(self::$currentIndex.'&conf=8&anchor=anchor'.ucfirst($folder).'&token='.$this->token); + + return $success; } protected function recursiveDeleteOnDisk($dir) diff --git a/controllers/admin/AdminPPreferencesController.php b/controllers/admin/AdminPPreferencesController.php index 4cb5beedf..c3cb9a352 100644 --- a/controllers/admin/AdminPPreferencesController.php +++ b/controllers/admin/AdminPPreferencesController.php @@ -223,7 +223,7 @@ class AdminPPreferencesControllerCore extends AdminController public function beforeUpdateOptions() { - if (!Tools::getValue('PS_STOCK_MANAGEMENT')) + if (!Tools::getValue('PS_STOCK_MANAGEMENT', true)) { $_POST['PS_ORDER_OUT_OF_STOCK'] = 1; $_POST['PS_DISPLAY_QTIES'] = 0; diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 989c59ee3..0938d1106 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -257,9 +257,9 @@ class ProductControllerCore extends FrontController 'HOOK_EXTRA_LEFT' => Hook::exec('displayLeftColumnProduct'), 'HOOK_EXTRA_RIGHT' => Hook::exec('displayRightColumnProduct'), 'HOOK_PRODUCT_OOS' => Hook::exec('actionProductOutOfStock', array('product' => $this->product)), - 'HOOK_PRODUCT_ACTIONS' => Hook::exec('displayProductButtons'), - 'HOOK_PRODUCT_TAB' => Hook::exec('displayProductTab'), - 'HOOK_PRODUCT_TAB_CONTENT' => Hook::exec('displayProductTabContent'), + 'HOOK_PRODUCT_ACTIONS' => Hook::exec('displayProductButtons', array('product' => $this->product)), + 'HOOK_PRODUCT_TAB' => Hook::exec('displayProductTab', array('product' => $this->product)), + 'HOOK_PRODUCT_TAB_CONTENT' => Hook::exec('displayProductTabContent', array('product' => $this->product)), 'display_qties' => (int)Configuration::get('PS_DISPLAY_QTIES'), 'display_ht' => !Tax::excludeTaxeOption(), 'currencySign' => $this->context->currency->sign,