// Add scenes for multistore

This commit is contained in:
rMalie
2011-07-22 12:27:42 +00:00
parent 8d3e36c904
commit 3dbff71fcd
8 changed files with 40 additions and 11 deletions
+12 -3
View File
@@ -36,6 +36,8 @@ class AdminScenes extends AdminTab
$this->lang = true; $this->lang = true;
$this->edit = true; $this->edit = true;
$this->delete = true; $this->delete = true;
$this->_group = 'GROUP BY a.id_scene';
$this->fieldImageSettings = array( $this->fieldImageSettings = array(
array('name' => 'image', 'dir' => 'scenes'), array('name' => 'image', 'dir' => 'scenes'),
@@ -43,9 +45,9 @@ class AdminScenes extends AdminTab
); );
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id_scene' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_scene' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Image Maps'), 'width' => 150), '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) 'active' => array('title' => $this->l('Activated'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
); );
parent::__construct(); parent::__construct();
@@ -225,6 +227,13 @@ class AdminScenes extends AdminTab
echo '<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="'._THEME_SCENE_DIR_.'thumbs/'.$obj->id.'-thumb_scene.jpg" /><br />'; echo '<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="'._THEME_SCENE_DIR_.'thumbs/'.$obj->id.'-thumb_scene.jpg" /><br />';
echo '</div> echo '</div>
'; ';
if (Tools::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
echo '</div>';
}
echo '<label>'.$this->l('Category:').' </label> echo '<label>'.$this->l('Category:').' </label>
<div class="margin-form"> <div class="margin-form">
+1
View File
@@ -156,6 +156,7 @@ class AdminShop extends AdminTab
'module_currency' => $this->l('Payment module currency restrictions'), 'module_currency' => $this->l('Payment module currency restrictions'),
'product' => $this->l('Products'), 'product' => $this->l('Products'),
'product_lang' => $this->l('Products lang'), 'product_lang' => $this->l('Products lang'),
'scene' => $this->l('Scenes'),
'stock' => $this->l('Stock'), 'stock' => $this->l('Stock'),
'store' => $this->l('Stores'), 'store' => $this->l('Stores'),
'zone' => $this->l('Zones'), 'zone' => $this->l('Zones'),
+1
View File
@@ -47,6 +47,7 @@ class AdminStores extends AdminTab
$this->_join = ' $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_.'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`)'; 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); $countries = Country::getCountries($context->language->id);
foreach ($countries AS $country) foreach ($countries AS $country)
+10 -7
View File
@@ -187,13 +187,16 @@ class SceneCore extends ObjectModel
$context = Context::getContext(); $context = Context::getContext();
$id_lang = is_null($id_lang) ? $context->language->id : $id_lang; $id_lang = is_null($id_lang) ? $context->language->id : $id_lang;
$scenes = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' $sql = 'SELECT s.*
SELECT s.* FROM `'._DB_PREFIX_.'scene_category` sc
FROM `'._DB_PREFIX_.'scene_category` sc LEFT JOIN `'._DB_PREFIX_.'scene` s ON (sc.id_scene = s.id_scene)
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) 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' : '').' WHERE sc.id_category = '.(int)$id_category.'
ORDER BY sl.name ASC'); 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) if (!$liteResult AND $scenes)
foreach($scenes AS &$scene) foreach($scenes AS &$scene)
+1
View File
@@ -76,6 +76,7 @@ class ShopCore extends ObjectModel
'product' => array('type' => 'shop'), 'product' => array('type' => 'shop'),
'product_lang' => array('type' => 'fk_shop'), 'product_lang' => array('type' => 'fk_shop'),
'referrer' => array('type' => 'shop'), 'referrer' => array('type' => 'shop'),
'scene' => array('type' => 'shop'),
'store' => array('type' => 'shop'), 'store' => array('type' => 'shop'),
'webservice_account' => array('type' => 'shop'), 'webservice_account' => array('type' => 'shop'),
); );
+7
View File
@@ -1891,3 +1891,10 @@ CREATE TABLE `PREFIX_webservice_account_shop` (
PRIMARY KEY (`id_webservice_account` , `id_shop`), PRIMARY KEY (`id_webservice_account` , `id_shop`),
KEY `id_shop` (`id_shop`) KEY `id_shop` (`id_shop`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) 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;
+1 -1
View File
@@ -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); (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` (`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_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 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'), (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'),
+7
View File
@@ -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'; 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(); */ /* PHP:create_multistore(); */