From c77a8fef96bc3dc6d5c8ff5b856aabd170f1daed Mon Sep 17 00:00:00 2001 From: dMetzger Date: Mon, 1 Oct 2012 13:32:54 +0000 Subject: [PATCH] [-] BO : features are not doubled anymore in multishop #PSCFV-4527 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17646 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Feature.php | 14 ++++++-------- controllers/admin/AdminProductsController.php | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/classes/Feature.php b/classes/Feature.php index 4d36f661f..d284739e0 100644 --- a/classes/Feature.php +++ b/classes/Feature.php @@ -79,16 +79,14 @@ class FeatureCore extends ObjectModel * @return array Multiple arrays with feature's data * @static */ - public static function getFeatures($id_lang) + public static function getFeatures($id_lang, $with_shop = true) { return Db::getInstance()->executeS(' - SELECT * - FROM `'._DB_PREFIX_.'feature` f - '.Shop::addSqlAssociation('feature', 'f').' - LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl - ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)$id_lang.') - ORDER BY f.`position` ASC - '); + SELECT * + FROM `'._DB_PREFIX_.'feature` f + '.($with_shop ? Shop::addSqlAssociation('feature', 'f') : '').' + LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)$id_lang.') + ORDER BY f.`position` ASC'); } /** diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 404a8f7f4..090e3290c 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -3911,7 +3911,7 @@ class AdminProductsControllerCore extends AdminController { if ($this->product_exists_in_shop) { - $features = Feature::getFeatures($this->context->language->id); + $features = Feature::getFeatures($this->context->language->id, (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP)); foreach ($features as $k => $tab_features) {