// Add scenes for multistore
This commit is contained in:
@@ -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 '<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>
|
||||
';
|
||||
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoShop();
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '<label>'.$this->l('Category:').' </label>
|
||||
<div class="margin-form">
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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)
|
||||
|
||||
+10
-7
@@ -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)
|
||||
|
||||
@@ -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'),
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
@@ -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'),
|
||||
|
||||
@@ -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(); */
|
||||
|
||||
Reference in New Issue
Block a user