// 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}
|
||||
</td>
|
||||
{foreach $fields_display AS $key => $params}
|
||||
<td
|
||||
{if isset($params.position)}
|
||||
id="td_{if $id_category}{$id_category}{else}0{/if}_{$tr.$identifier}"
|
||||
{/if}
|
||||
class="{if !$no_link}pointer{/if}
|
||||
{if isset($params.position) && $order_by == 'position'} dragHandle{/if}
|
||||
{if isset($params.align)} {$params.align}{/if}"
|
||||
{block name="open_td"}
|
||||
<td
|
||||
{if isset($params.position)}
|
||||
id="td_{if $id_category}{$id_category}{else}0{/if}_{$tr.$identifier}"
|
||||
{/if}
|
||||
class="{if !$no_link}pointer{/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))}
|
||||
onclick="document.location = '{$current_index}&{$identifier}={$tr.$identifier}{if $view}&view{else}&update{/if}{$table}&token={$token}'">
|
||||
{else}
|
||||
>
|
||||
{/if}
|
||||
{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}'">
|
||||
{else}
|
||||
>
|
||||
{/if}
|
||||
{/block}
|
||||
{if isset($params.prefix)}{$params.prefix}{/if}
|
||||
{if isset($params.color) && isset($tr[$params.color])}
|
||||
<span class="color_field" style="background-color: {$tr.color}">
|
||||
{/if}
|
||||
|
||||
{if isset($params.active)}
|
||||
{$tr.$key}
|
||||
{elseif isset($params.activeVisu)}
|
||||
@@ -107,7 +110,7 @@
|
||||
{$tr.$key|escape:'htmlall':'UTF-8'}
|
||||
{/if}
|
||||
{else}
|
||||
--
|
||||
{block name="default_field_block"}--{/block}
|
||||
{/if}
|
||||
{if isset($params.suffix)}{$params.suffix}{/if}
|
||||
{if isset($params.color) && isset($tr.color)}
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
{/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 $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>
|
||||
{block name="end_field_block"}</div>{/block}
|
||||
{/if}
|
||||
|
||||
@@ -88,9 +88,9 @@ class HelperCore
|
||||
}
|
||||
|
||||
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
|
||||
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));
|
||||
}
|
||||
|
||||
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()
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,8 @@ class AdminShopControllerCore extends AdminController
|
||||
'name' => array(
|
||||
'title' => $this->l('Shop'),
|
||||
'width' => 'auto',
|
||||
'filter_key' => 'a!name'
|
||||
'filter_key' => 'a!name',
|
||||
'width' => 200,
|
||||
),
|
||||
'group_shop_name' => array(
|
||||
'title' => $this->l('Group Shop'),
|
||||
@@ -55,6 +56,10 @@ class AdminShopControllerCore extends AdminController
|
||||
'width' => 150,
|
||||
'filter_key' => 'cl!name'
|
||||
),
|
||||
'url' => array(
|
||||
'title' => $this->l('Shop main URL'),
|
||||
'havingFilter' => 'url',
|
||||
),
|
||||
'active' => array(
|
||||
'title' => $this->l('Enabled'),
|
||||
'align' => 'center',
|
||||
@@ -88,7 +93,6 @@ class AdminShopControllerCore extends AdminController
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
if ($this->display == 'edit' || $this->display == 'add')
|
||||
@@ -143,30 +147,20 @@ class AdminShopControllerCore extends AdminController
|
||||
$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()
|
||||
{
|
||||
$this->addRowAction('edit');
|
||||
$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 = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'group_shop` gs
|
||||
ON (a.id_group_shop = gs.id_group_shop)
|
||||
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';
|
||||
|
||||
return parent::renderList();
|
||||
@@ -240,7 +234,7 @@ class AdminShopControllerCore extends AdminController
|
||||
$shop_delete_list = array();
|
||||
|
||||
// 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']))
|
||||
$shop_delete_list[] = $shop['id_shop'];
|
||||
|
||||
Reference in New Issue
Block a user