// Multistore bootstrap design

This commit is contained in:
Jerome Nadaud
2013-09-20 15:04:43 +02:00
parent 2f3d736f13
commit f312a055b1
8 changed files with 147 additions and 127 deletions
+43 -16
View File
@@ -29,6 +29,7 @@ class AdminShopControllerCore extends AdminController
{
public function __construct()
{
$this->bootstrap = true;
$this->context = Context::getContext();
$this->table = 'shop';
$this->className = 'Shop';
@@ -39,7 +40,7 @@ class AdminShopControllerCore extends AdminController
'id_shop' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 25
'class' => 'fixed-width-xs'
),
'name' => array(
'title' => $this->l('Shop'),
@@ -145,7 +146,6 @@ class AdminShopControllerCore extends AdminController
public function initContent()
{
$this->list_simple_header = true;
parent::initContent();
$this->addJqueryPlugin('cookie-plugin');
@@ -313,14 +313,15 @@ class AdminShopControllerCore extends AdminController
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Shop')
'title' => $this->l('Shop'),
'icon' => 'icon-shopping-cart'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Shop name:'),
'desc' => $this->l('This field does not refer to the shop name visible in the front office.').' '.
sprintf($this->l('Follow %sthis link%s to edit the shop name used on the Front Office.'), '<a href="'.$this->context->link->getAdminLink('AdminStores').'">', '</a>'),
'desc' => array($this->l('This field does not refer to the shop name visible in the front office.'),
sprintf($this->l('Follow %sthis link%s to edit the shop name used on the Front Office.'), '<a href="'.$this->context->link->getAdminLink('AdminStores').'">', '</a>')),
'name' => 'name',
'required' => true,
)
@@ -398,34 +399,60 @@ class AdminShopControllerCore extends AdminController
if (Tools::isSubmit('id_shop'))
{
$shop = new Shop((int)Tools::getValue('id_shop'));
$parent = $shop->id_category;
$id_root = $shop->id_category;
}
else
$parent = $categories[0]['id_category'];
$id_root = $categories[0]['id_category'];
$id_shop = (int)Tools::getValue('id_shop');
$shop = new Shop($id_shop);
$selected_cat = Shop::getCategories($id_shop);
if (empty($selected_cat))
{
// get first category root and preselect all these children
$root_categories = Category::getRootCategories();
$root_category = new Category($root_categories[0]['id_category']);
$children = $root_category->getAllChildren($this->context->language->id);
$selected_cat[] = $root_categories[0]['id_category'];
foreach ($children as $child)
$selected_cat[] = $child->id;
}
if (Shop::getContext() == Shop::CONTEXT_SHOP && Tools::isSubmit('id_shop'))
$root_category = new Category($shop->id_category);
else
$root_category = new Category($id_root);
$this->fields_form['input'][] = array(
'type' => 'categories_select',
'type' => 'categories',
'name' => 'categoryBox',
'label' => $this->l('Associated categories:'),
'category_tree' => $this->initCategoriesAssociation($parent),
'tree' => array(
'id' => 'categories-tree',
'selected_categories' => $selected_cat,
'root_category' => $root_category->id,
'use_search' => true,
'use_checkbox' => true
),
'desc' => $this->l('By selecting associated categories, you are choosing to share the categories between shops. Once associated between shops, any alteration of this category will impact every shop.')
);
/*$this->fields_form['input'][] = array(
'type' => 'radio',
'label' => $this->l('Status:'),
'type' => 'switch',
'label' => $this->l('Enabled:'),
'name' => 'active',
'required' => true,
'class' => 't',
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => $this->l('Enabled')
'value' => 1
),
array(
'id' => 'active_off',
'value' => 0,
'label' => $this->l('Disabled')
'value' => 0
)
),
'desc' => $this->l('Enable or disable your store?')
+17 -27
View File
@@ -28,6 +28,7 @@ class AdminShopGroupControllerCore extends AdminController
{
public function __construct()
{
$this->bootstrap = true;
$this->table = 'shop_group';
$this->className = 'ShopGroup';
$this->lang = false;
@@ -47,7 +48,7 @@ class AdminShopGroupControllerCore extends AdminController
'id_shop_group' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 25,
'class' => 'fixed-width-xs',
),
'name' => array(
'title' => $this->l('Group shop'),
@@ -92,7 +93,6 @@ class AdminShopGroupControllerCore extends AdminController
public function initContent()
{
$this->list_simple_header = true;
parent::initContent();
if ($this->display == 'options')
@@ -128,7 +128,8 @@ class AdminShopGroupControllerCore extends AdminController
{
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Shop group:')
'title' => $this->l('Shop group'),
'icon' => 'icon-shopping-cart'
),
'description' => $this->l('Warning: Enabling the "share customers" and "share orders" options is not recommended. Once activated and orders are created, you will not be able to disable these options. If you need these options, we recommend using several categories rather than several shops.'),
'input' => array(
@@ -139,7 +140,7 @@ class AdminShopGroupControllerCore extends AdminController
'required' => true
),
array(
'type' => 'radio',
'type' => 'switch',
'label' => $this->l('Share customers:'),
'name' => 'share_customer',
'required' => true,
@@ -149,19 +150,17 @@ class AdminShopGroupControllerCore extends AdminController
'values' => array(
array(
'id' => 'share_customer_on',
'value' => 1,
'label' => $this->l('Enabled')
'value' => 1
),
array(
'id' => 'share_customer_off',
'value' => 0,
'label' => $this->l('Disabled')
'value' => 0
)
),
'desc' => $this->l('Once this option is enabled, the shops in this group will share customers. If a customer registers in any one of these shops, the account will automatically be available in the others shops of this goup. rnrnWarning: you will not be able to disable this option once you have registered customers.'),
),
array(
'type' => 'radio',
'type' => 'switch',
'label' => $this->l('Share available quantities to sell:'),
'name' => 'share_stock',
'required' => true,
@@ -170,19 +169,17 @@ class AdminShopGroupControllerCore extends AdminController
'values' => array(
array(
'id' => 'share_stock_on',
'value' => 1,
'label' => $this->l('Enabled')
'value' => 1
),
array(
'id' => 'share_stock_off',
'value' => 0,
'label' => $this->l('Disabled')
'value' => 0
)
),
'desc' => $this->l('Share available quantities between shops of this group. When changing this option, all available products quantities will be reset to 0.'),
),
array(
'type' => 'radio',
'type' => 'switch',
'label' => $this->l('Share orders:'),
'name' => 'share_order',
'required' => true,
@@ -192,19 +189,17 @@ class AdminShopGroupControllerCore extends AdminController
'values' => array(
array(
'id' => 'share_order_on',
'value' => 1,
'label' => $this->l('Enabled')
'value' => 1
),
array(
'id' => 'share_order_off',
'value' => 0,
'label' => $this->l('Disabled')
'value' => 0
)
),
'desc' => $this->l('Once this option is enabled (which is only possible if customers and available quantities are shared among shops), the customer\'s cart will be shared by all shops in this group. This way, any purchase started in one shop will be able to be completed in another shop from the same group. rnrnWarning: You will not be able to disable this option once you\'ve started to accept orders.')
),
array(
'type' => 'radio',
'type' => 'switch',
'label' => $this->l('Status:'),
'name' => 'active',
'required' => true,
@@ -213,13 +208,11 @@ class AdminShopGroupControllerCore extends AdminController
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => $this->l('Enabled')
'value' => 1
),
array(
'id' => 'active_off',
'value' => 0,
'label' => $this->l('Disabled')
'value' => 0
)
),
'desc' => $this->l('Enable or disable group shops?')
@@ -305,10 +298,7 @@ class AdminShopGroupControllerCore extends AdminController
if ($this->fields_options && is_array($this->fields_options))
{
$this->display = 'options';
$this->show_toolbar = true;
unset($this->toolbar_btn);
$this->initToolbar();
$this->show_toolbar = false;
$helper = new HelperOptions($this);
$this->setHelperDisplay($helper);
$helper->id = $this->id;
+17 -21
View File
@@ -28,6 +28,7 @@ class AdminShopUrlControllerCore extends AdminController
{
public function __construct()
{
$this->bootstrap = true;
$this->table = 'shop_url';
$this->className = 'ShopUrl';
$this->lang = false;
@@ -44,11 +45,10 @@ class AdminShopUrlControllerCore extends AdminController
'id_shop_url' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 25
'class' => 'fixed-width-xs'
),
'shop_name' => array(
'title' => $this->l('Shop name'),
'width' => 150,
'filter_key' => 's!name'
),
'url' => array(
@@ -63,7 +63,7 @@ class AdminShopUrlControllerCore extends AdminController
'type' => 'bool',
'orderby' => false,
'filter_key' => 'main',
'width' => 100,
'class' => 'fixed-width-md'
),
'active' => array(
'title' => $this->l('Enabled'),
@@ -72,7 +72,7 @@ class AdminShopUrlControllerCore extends AdminController
'type' => 'bool',
'orderby' => false,
'filter_key' => 'active',
'width' => 50,
'class' => 'fixed-width-md'
),
);
@@ -118,7 +118,8 @@ class AdminShopUrlControllerCore extends AdminController
array(
'form' => array(
'legend' => array(
'title' => $this->l('URL options')
'title' => $this->l('URL options'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
@@ -139,20 +140,18 @@ class AdminShopUrlControllerCore extends AdminController
)
),
array(
'type' => 'radio',
'type' => 'switch',
'label' => $this->l('Main URL:'),
'name' => 'main',
'class' => 't',
'values' => array(
array(
'id' => 'main_on',
'value' => 1,
'label' => '<img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" />'
'value' => 1
),
array(
'id' => 'main_off',
'value' => 0,
'label' => '<img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" />'
'value' => 0
)
),
'desc' => array(
@@ -168,24 +167,21 @@ class AdminShopUrlControllerCore extends AdminController
)
),
array(
'type' => 'radio',
'label' => $this->l('Status:'),
'type' => 'switch',
'label' => $this->l('Enabled:'),
'name' => 'active',
'required' => false,
'class' => 't',
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => '<img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" />'
'value' => 1
),
array(
'id' => 'active_off',
'value' => 0,
'label' => '<img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" />'
'value' => 0
)
),
'desc' => $this->l('Enabled or disabled')
)
)
),
'submit' => array(
@@ -197,7 +193,8 @@ class AdminShopUrlControllerCore extends AdminController
array(
'form' => array(
'legend' => array(
'title' => $this->l('Shop URL')
'title' => $this->l('Shop URL'),
'icon' => 'icon-shopping-cart'
),
'input' => array(
array(
@@ -225,7 +222,7 @@ class AdminShopUrlControllerCore extends AdminController
'name' => 'virtual_uri',
'desc' => $desc_virtual_uri,
'size' => 50,
'hint' => (!$update_htaccess) ? $this->l('Warning: URL rewriting (e.g. mod_rewrite for Apache) seems to be disabled. If your URL doesn\'t work, please check with your host provider on how to activate URL rewriting.') : '',
'hint' => (!$update_htaccess) ? $this->l('Warning: URL rewriting (e.g. mod_rewrite for Apache) seems to be disabled. If your URL doesn\'t work, please check with your host provider on how to activate URL rewriting.') : null,
),
array(
'type' => 'text',
@@ -290,7 +287,6 @@ class AdminShopUrlControllerCore extends AdminController
public function initContent()
{
$this->list_simple_header = true;
parent::initContent();
$this->addJqueryPlugin('cookie-plugin');