diff --git a/admin-dev/themes/default/template/controllers/shop/helpers/list/list_content.tpl b/admin-dev/themes/default/template/controllers/shop/helpers/list/list_content.tpl new file mode 100644 index 000000000..90de6ce9c --- /dev/null +++ b/admin-dev/themes/default/template/controllers/shop/helpers/list/list_content.tpl @@ -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 +* @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"} + {l s='Click here to set an URL for this shop'} +{/block} \ No newline at end of file diff --git a/admin-dev/themes/default/template/helpers/list/list_content.tpl b/admin-dev/themes/default/template/helpers/list/list_content.tpl index bbe7605bd..f92d80aba 100644 --- a/admin-dev/themes/default/template/helpers/list/list_content.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_content.tpl @@ -43,23 +43,26 @@ {/if} {foreach $fields_display AS $key => $params} - - {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])} {/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)} diff --git a/admin-dev/themes/default/template/helpers/options/options.tpl b/admin-dev/themes/default/template/helpers/options/options.tpl index efcba2280..981f9fc8a 100644 --- a/admin-dev/themes/default/template/helpers/options/options.tpl +++ b/admin-dev/themes/default/template/helpers/options/options.tpl @@ -188,7 +188,7 @@ {/if} {if isset($field['hint'])}{$field['hint']} {/if} {if isset($field['desc'])}

{$field['desc']}

{/if} - {if $field['is_invisible']}

{l s='You can\'t change the value of this configuration field in this shop context'}

{/if} + {if $field['is_invisible']}

{l s='You can\'t change the value of this configuration field in this shop context'}

{/if} {block name="end_field_block"}{/block} {/if} diff --git a/classes/helper/Helper.php b/classes/helper/Helper.php index c6eeb693d..bb19e5771 100755 --- a/classes/helper/Helper.php +++ b/classes/helper/Helper.php @@ -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); } /** diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index fffadb838..a9bea0c94 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -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() */ diff --git a/controllers/admin/AdminShopController.php b/controllers/admin/AdminShopController.php index 0c0490968..3001c6a6f 100755 --- a/controllers/admin/AdminShopController.php +++ b/controllers/admin/AdminShopController.php @@ -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'), ''.$shop['name'].'') - .' ' - .$this->l('click here').'
'; - } - 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'];