diff --git a/admin-dev/tabs/AdminScenes.php b/admin-dev/tabs/AdminScenes.php index c22a85447..6979b7fff 100644 --- a/admin-dev/tabs/AdminScenes.php +++ b/admin-dev/tabs/AdminScenes.php @@ -36,6 +36,8 @@ class AdminScenes extends AdminTab $this->lang = true; $this->edit = true; $this->delete = true; + + $this->_group = 'GROUP BY a.id_scene'; $this->fieldImageSettings = array( array('name' => 'image', 'dir' => 'scenes'), @@ -43,9 +45,9 @@ class AdminScenes extends AdminTab ); $this->fieldsDisplay = array( - 'id_scene' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), - 'name' => array('title' => $this->l('Image Maps'), 'width' => 150), - 'active' => array('title' => $this->l('Activated'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false) + 'id_scene' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), + 'name' => array('title' => $this->l('Image Maps'), 'width' => 150, 'filter_key' => 'b!name'), + 'active' => array('title' => $this->l('Activated'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false) ); parent::__construct(); @@ -225,6 +227,13 @@ class AdminScenes extends AdminTab echo '
'; echo ' '; + + if (Tools::isMultiShopActivated()) + { + echo '
'; + $this->displayAssoShop(); + echo '
'; + } echo '
diff --git a/admin-dev/tabs/AdminShop.php b/admin-dev/tabs/AdminShop.php index a6753cb9f..6a37d816f 100755 --- a/admin-dev/tabs/AdminShop.php +++ b/admin-dev/tabs/AdminShop.php @@ -156,6 +156,7 @@ class AdminShop extends AdminTab 'module_currency' => $this->l('Payment module currency restrictions'), 'product' => $this->l('Products'), 'product_lang' => $this->l('Products lang'), + 'scene' => $this->l('Scenes'), 'stock' => $this->l('Stock'), 'store' => $this->l('Stores'), 'zone' => $this->l('Zones'), diff --git a/admin-dev/tabs/AdminStores.php b/admin-dev/tabs/AdminStores.php index 0119a80ab..396c08d4a 100644 --- a/admin-dev/tabs/AdminStores.php +++ b/admin-dev/tabs/AdminStores.php @@ -47,6 +47,7 @@ class AdminStores extends AdminTab $this->_join = ' LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$context->language->id.') LEFT JOIN `'._DB_PREFIX_.'state` st ON (st.`id_state` = a.`id_state`)'; + $this->_group = 'GROUP BY a.id_store'; $countries = Country::getCountries($context->language->id); foreach ($countries AS $country) diff --git a/classes/Scene.php b/classes/Scene.php index 2db4ed0de..7e3d177bd 100644 --- a/classes/Scene.php +++ b/classes/Scene.php @@ -187,13 +187,16 @@ class SceneCore extends ObjectModel $context = Context::getContext(); $id_lang = is_null($id_lang) ? $context->language->id : $id_lang; - $scenes = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' - SELECT s.* - FROM `'._DB_PREFIX_.'scene_category` sc - LEFT JOIN `'._DB_PREFIX_.'scene` s ON (sc.id_scene = s.id_scene) - LEFT JOIN `'._DB_PREFIX_.'scene_lang` sl ON (sl.id_scene = s.id_scene) - WHERE sc.id_category = '.(int)$id_category.' AND sl.id_lang = '.(int)$id_lang.($onlyActive ? ' AND s.active = 1' : '').' - ORDER BY sl.name ASC'); + $sql = 'SELECT s.* + FROM `'._DB_PREFIX_.'scene_category` sc + LEFT JOIN `'._DB_PREFIX_.'scene` s ON (sc.id_scene = s.id_scene) + '.$context->shop->sqlAsso('scene', 's').' + LEFT JOIN `'._DB_PREFIX_.'scene_lang` sl ON (sl.id_scene = s.id_scene) + WHERE sc.id_category = '.(int)$id_category.' + AND sl.id_lang = '.(int)$id_lang + .($onlyActive ? ' AND s.active = 1' : '').' + ORDER BY sl.name ASC'; + $scenes = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); if (!$liteResult AND $scenes) foreach($scenes AS &$scene) diff --git a/classes/Shop.php b/classes/Shop.php index 0b84057ba..b79b3a06a 100644 --- a/classes/Shop.php +++ b/classes/Shop.php @@ -76,6 +76,7 @@ class ShopCore extends ObjectModel 'product' => array('type' => 'shop'), 'product_lang' => array('type' => 'fk_shop'), 'referrer' => array('type' => 'shop'), + 'scene' => array('type' => 'shop'), 'store' => array('type' => 'shop'), 'webservice_account' => array('type' => 'shop'), ); diff --git a/install-dev/sql/db.sql b/install-dev/sql/db.sql index a5b05cc68..390755710 100644 --- a/install-dev/sql/db.sql +++ b/install-dev/sql/db.sql @@ -1891,3 +1891,10 @@ CREATE TABLE `PREFIX_webservice_account_shop` ( PRIMARY KEY (`id_webservice_account` , `id_shop`), KEY `id_shop` (`id_shop`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; + +CREATE TABLE `PREFIX_scene_shop` ( +`id_scene` INT( 11 ) UNSIGNED NOT NULL , +`id_shop` INT( 11 ) UNSIGNED NOT NULL, +PRIMARY KEY (`id_scene`, `id_shop`), + KEY `id_shop` (`id_shop`) +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/install-dev/sql/db_settings_extends.sql b/install-dev/sql/db_settings_extends.sql index 4e61ffeb8..8f8e9e8a8 100644 --- a/install-dev/sql/db_settings_extends.sql +++ b/install-dev/sql/db_settings_extends.sql @@ -294,8 +294,8 @@ INSERT INTO `PREFIX_attribute_impact` (`id_attribute_impact`, `id_product`, `id_ (9, 1, 7, 0, 0.00),(10, 1, 20, 0, 0.00),(11, 1, 6, 0, 0.00),(12, 1, 18, 0, 0.00); INSERT INTO `PREFIX_scene` (`id_scene`, `active`) VALUES (1, 1),(2, 1),(3, 1); - INSERT INTO `PREFIX_scene_category` (`id_scene`, `id_category`) VALUES (1, 2),(2, 2),(3, 4); +INSERT INTO `PREFIX_scene_shop` (`id_scene`, `id_shop`) VALUES (1, 1),(2, 1),(3, 1); INSERT INTO `PREFIX_scene_lang` (`id_scene`, `id_lang`, `name`) VALUES (1, 1, 'The iPods Nano'),(1, 2, 'Les iPods Nano'),(1, 3, 'El iPod Nano'),(1, 4, 'Die iPods Nano'),(1, 5, 'Gli iPod Nano'), diff --git a/install-dev/sql/upgrade/1.5.0.0.sql b/install-dev/sql/upgrade/1.5.0.0.sql index 8cb33b3f2..2f783bbff 100755 --- a/install-dev/sql/upgrade/1.5.0.0.sql +++ b/install-dev/sql/upgrade/1.5.0.0.sql @@ -306,4 +306,11 @@ ALTER TABLE `PREFIX_cart_product` ADD `id_shop` INT NOT NULL DEFAULT '1' AFTER ` ALTER TABLE `PREFIX_customization` ADD `in_cart` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'; +CREATE TABLE `PREFIX_scene_shop` ( +`id_scene` INT( 11 ) UNSIGNED NOT NULL , +`id_shop` INT( 11 ) UNSIGNED NOT NULL, +PRIMARY KEY (`id_scene`, `id_shop`), + KEY `id_shop` (`id_shop`) +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; + /* PHP:create_multistore(); */