// Improve multishop ergonomy with a link to missing url on shop list
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13303 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision: 9608 $
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
|
{extends file="helpers/list/list_content.tpl"}
|
||||||
|
|
||||||
|
{block name="default_field_block"}
|
||||||
|
<a href="{$link->getAdminLink('AdminShopUrl')}&id_shop={$tr.$identifier}&addshop_url" class="multishop_warning">{l s='Click here to set an URL for this shop'}</a>
|
||||||
|
{/block}
|
||||||
@@ -43,23 +43,26 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
{foreach $fields_display AS $key => $params}
|
{foreach $fields_display AS $key => $params}
|
||||||
<td
|
{block name="open_td"}
|
||||||
{if isset($params.position)}
|
<td
|
||||||
id="td_{if $id_category}{$id_category}{else}0{/if}_{$tr.$identifier}"
|
{if isset($params.position)}
|
||||||
{/if}
|
id="td_{if $id_category}{$id_category}{else}0{/if}_{$tr.$identifier}"
|
||||||
class="{if !$no_link}pointer{/if}
|
{/if}
|
||||||
{if isset($params.position) && $order_by == 'position'} dragHandle{/if}
|
class="{if !$no_link}pointer{/if}
|
||||||
{if isset($params.align)} {$params.align}{/if}"
|
{if isset($params.position) && $order_by == 'position'} dragHandle{/if}
|
||||||
|
{if isset($params.align)} {$params.align}{/if}"
|
||||||
|
|
||||||
{if (!isset($params.position) && !$no_link && !isset($params.remove_onclick))}
|
{if (!isset($params.position) && !$no_link && !isset($params.remove_onclick))}
|
||||||
onclick="document.location = '{$current_index}&{$identifier}={$tr.$identifier}{if $view}&view{else}&update{/if}{$table}&token={$token}'">
|
onclick="document.location = '{$current_index}&{$identifier}={$tr.$identifier}{if $view}&view{else}&update{/if}{$table}&token={$token}'">
|
||||||
{else}
|
{else}
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
|
{/block}
|
||||||
{if isset($params.prefix)}{$params.prefix}{/if}
|
{if isset($params.prefix)}{$params.prefix}{/if}
|
||||||
{if isset($params.color) && isset($tr[$params.color])}
|
{if isset($params.color) && isset($tr[$params.color])}
|
||||||
<span class="color_field" style="background-color: {$tr.color}">
|
<span class="color_field" style="background-color: {$tr.color}">
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if isset($params.active)}
|
{if isset($params.active)}
|
||||||
{$tr.$key}
|
{$tr.$key}
|
||||||
{elseif isset($params.activeVisu)}
|
{elseif isset($params.activeVisu)}
|
||||||
@@ -107,7 +110,7 @@
|
|||||||
{$tr.$key|escape:'htmlall':'UTF-8'}
|
{$tr.$key|escape:'htmlall':'UTF-8'}
|
||||||
{/if}
|
{/if}
|
||||||
{else}
|
{else}
|
||||||
--
|
{block name="default_field_block"}--{/block}
|
||||||
{/if}
|
{/if}
|
||||||
{if isset($params.suffix)}{$params.suffix}{/if}
|
{if isset($params.suffix)}{$params.suffix}{/if}
|
||||||
{if isset($params.color) && isset($tr.color)}
|
{if isset($params.color) && isset($tr.color)}
|
||||||
|
|||||||
@@ -188,7 +188,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{if isset($field['hint'])}<span class="hint" name="help_box">{$field['hint']}<span class="hint-pointer"> </span></span>{/if}
|
{if isset($field['hint'])}<span class="hint" name="help_box">{$field['hint']}<span class="hint-pointer"> </span></span>{/if}
|
||||||
{if isset($field['desc'])}<p class="preference_description">{$field['desc']}</p>{/if}
|
{if isset($field['desc'])}<p class="preference_description">{$field['desc']}</p>{/if}
|
||||||
{if $field['is_invisible']}<p class="multishop_warning">{l s='You can\'t change the value of this configuration field in this shop context'}</p>{/if}
|
{if $field['is_invisible']}<p class="warn">{l s='You can\'t change the value of this configuration field in this shop context'}</p>{/if}
|
||||||
</div>
|
</div>
|
||||||
{block name="end_field_block"}</div>{/block}
|
{block name="end_field_block"}</div>{/block}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ class HelperCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($override_tpl_path) && file_exists($override_tpl_path))
|
if (isset($override_tpl_path) && file_exists($override_tpl_path))
|
||||||
return $this->context->smarty->createTemplate($override_tpl_path);
|
return $this->context->smarty->createTemplate($override_tpl_path, $this->context->smarty);
|
||||||
else
|
else
|
||||||
return $this->context->smarty->createTemplate($this->base_folder.$tpl_name);
|
return $this->context->smarty->createTemplate($this->base_folder.$tpl_name, $this->context->smarty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -885,16 +885,6 @@ class ShopCore extends ObjectModel
|
|||||||
return (int)Db::getInstance()->getValue(sprintf('SELECT COUNT(*) FROM`'._DB_PREFIX_.'group_shop` WHERE `id_group_shop` = %d', (int)$id));
|
return (int)Db::getInstance()->getValue(sprintf('SELECT COUNT(*) FROM`'._DB_PREFIX_.'group_shop` WHERE `id_group_shop` = %d', (int)$id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getShopWithoutUrls($id_shop = false)
|
|
||||||
{
|
|
||||||
$without = array();
|
|
||||||
$shops = Shop::getShops();
|
|
||||||
foreach ($shops as $shop)
|
|
||||||
if ((!$id_shop || $shop['id_shop'] == $id_shop) && empty($shop['domain']) && empty($shop['uri']))
|
|
||||||
$without[] = $shop;
|
|
||||||
return $without;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 1.5.0 Use shop->getID()
|
* @deprecated 1.5.0 Use shop->getID()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ class AdminShopControllerCore extends AdminController
|
|||||||
'name' => array(
|
'name' => array(
|
||||||
'title' => $this->l('Shop'),
|
'title' => $this->l('Shop'),
|
||||||
'width' => 'auto',
|
'width' => 'auto',
|
||||||
'filter_key' => 'a!name'
|
'filter_key' => 'a!name',
|
||||||
|
'width' => 200,
|
||||||
),
|
),
|
||||||
'group_shop_name' => array(
|
'group_shop_name' => array(
|
||||||
'title' => $this->l('Group Shop'),
|
'title' => $this->l('Group Shop'),
|
||||||
@@ -55,6 +56,10 @@ class AdminShopControllerCore extends AdminController
|
|||||||
'width' => 150,
|
'width' => 150,
|
||||||
'filter_key' => 'cl!name'
|
'filter_key' => 'cl!name'
|
||||||
),
|
),
|
||||||
|
'url' => array(
|
||||||
|
'title' => $this->l('Shop main URL'),
|
||||||
|
'havingFilter' => 'url',
|
||||||
|
),
|
||||||
'active' => array(
|
'active' => array(
|
||||||
'title' => $this->l('Enabled'),
|
'title' => $this->l('Enabled'),
|
||||||
'align' => 'center',
|
'align' => 'center',
|
||||||
@@ -88,7 +93,6 @@ class AdminShopControllerCore extends AdminController
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function initToolbar()
|
public function initToolbar()
|
||||||
{
|
{
|
||||||
if ($this->display == 'edit' || $this->display == 'add')
|
if ($this->display == 'edit' || $this->display == 'add')
|
||||||
@@ -143,30 +147,20 @@ class AdminShopControllerCore extends AdminController
|
|||||||
$this->context->smarty->assign('toolbar_fix', 1);
|
$this->context->smarty->assign('toolbar_fix', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initContent()
|
|
||||||
{
|
|
||||||
$shops = Shop::getShopWithoutUrls();
|
|
||||||
if (count($shops) && !$this->ajax)
|
|
||||||
{
|
|
||||||
foreach ($shops as $shop)
|
|
||||||
$this->warnings[] = sprintf($this->l('No url is configured for shop: %s'), '<b>'.$shop['name'].'</b>')
|
|
||||||
.' <a href="'.$this->context->link->getAdminLink('AdminShopUrl').'&addshop_url&id_shop='.$shop['id_shop'].'">'
|
|
||||||
.$this->l('click here').'</a><br />';
|
|
||||||
}
|
|
||||||
parent::initContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function renderList()
|
public function renderList()
|
||||||
{
|
{
|
||||||
$this->addRowAction('edit');
|
$this->addRowAction('edit');
|
||||||
$this->addRowAction('delete');
|
$this->addRowAction('delete');
|
||||||
|
|
||||||
$this->_select = 'gs.name group_shop_name, cl.name category_name';
|
$this->_select = 'gs.name group_shop_name, cl.name category_name, CONCAT(\'http://\', su.domain, su.physical_uri, su.virtual_uri) AS url';
|
||||||
$this->_join = '
|
$this->_join = '
|
||||||
LEFT JOIN `'._DB_PREFIX_.'group_shop` gs
|
LEFT JOIN `'._DB_PREFIX_.'group_shop` gs
|
||||||
ON (a.id_group_shop = gs.id_group_shop)
|
ON (a.id_group_shop = gs.id_group_shop)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||||
ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$this->context->language->id.')';
|
ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$this->context->language->id.')
|
||||||
|
LEFT JOIN '._DB_PREFIX_.'shop_url su
|
||||||
|
ON a.id_shop = su.id_shop AND su.main = 1
|
||||||
|
';
|
||||||
$this->_group = 'GROUP BY a.id_shop';
|
$this->_group = 'GROUP BY a.id_shop';
|
||||||
|
|
||||||
return parent::renderList();
|
return parent::renderList();
|
||||||
@@ -240,7 +234,7 @@ class AdminShopControllerCore extends AdminController
|
|||||||
$shop_delete_list = array();
|
$shop_delete_list = array();
|
||||||
|
|
||||||
// don't allow to remove shop which have dependencies (customers / orders / ... )
|
// don't allow to remove shop which have dependencies (customers / orders / ... )
|
||||||
foreach ($this->_list as $shop)
|
foreach ($this->_list as &$shop)
|
||||||
{
|
{
|
||||||
if (Shop::hasDependency($shop['id_shop']))
|
if (Shop::hasDependency($shop['id_shop']))
|
||||||
$shop_delete_list[] = $shop['id_shop'];
|
$shop_delete_list[] = $shop['id_shop'];
|
||||||
|
|||||||
Reference in New Issue
Block a user