// fix added leadin link and norm in AdminCategoriesController
This commit is contained in:
@@ -1,13 +1,44 @@
|
|||||||
|
{*
|
||||||
|
* 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$
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
{extends file="helper/list/list_header.tpl"}
|
{extends file="helper/list/list_header.tpl"}
|
||||||
|
|
||||||
{block name=leadin}
|
{block name=leadin}
|
||||||
<div class="cat_bar2">
|
<div class="cat_bar2">
|
||||||
{if count($categories_tree) == 0}
|
{if count($categories_tree) == 0}
|
||||||
<img src="../img/admin/home.gif" alt="" /> {l s='Home'}
|
<img src="../img/admin/home.gif" alt="" /> {l s='Home'}
|
||||||
{else}
|
{else}
|
||||||
<img src="../img/admin/home.gif" alt="" /> {l s='Home'} >
|
<a href="{$currentIndex}&token={$token}"><img src="../img/admin/home.gif" alt="" /> {l s='Home'}</a> >
|
||||||
|
|
||||||
{foreach $categories_tree key=key item=category}
|
{foreach $categories_tree key=key item=category}
|
||||||
|
{if $key == 0}
|
||||||
{$category.name}
|
{$category.name}
|
||||||
|
{else}
|
||||||
|
<a href="{$currentIndex}&token={$token}&id_category={$category.id_category}&viewcategory">{$category.name}</a> >
|
||||||
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
$this->lang = true;
|
$this->lang = true;
|
||||||
$this->deleted = false;
|
$this->deleted = false;
|
||||||
|
|
||||||
$this->requiredDatabase = true;
|
|
||||||
|
|
||||||
$this->context = Context::getContext();
|
$this->context = Context::getContext();
|
||||||
|
|
||||||
$this->fieldImageSettings = array(
|
$this->fieldImageSettings = array(
|
||||||
@@ -114,13 +112,16 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||||
{
|
{
|
||||||
parent::getList($id_lang, 'position', $order_way, $start, $limit, Context::getContext()->shop->getID(true));
|
parent::getList($id_lang, 'position', $order_way, $start, $limit, Context::getContext()->shop->getID(true));
|
||||||
}
|
// Check each row to see if there are combinations and get the correct action in consequence
|
||||||
|
|
||||||
public function initContent()
|
$nb_items = count($this->_list);
|
||||||
{
|
for ($i = 0; $i < $nb_items; $i++)
|
||||||
if ($this->display == 'view')
|
{
|
||||||
$this->initView();
|
$item = &$this->_list[$i];
|
||||||
parent::initContent();
|
$category_tree = Category::getChildren((int)$item['id_category'], $this->context->language->id);
|
||||||
|
if (!count($category_tree))
|
||||||
|
$this->addRowActionSkipList('view', array($item['id_category']));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initView()
|
public function initView()
|
||||||
@@ -131,23 +132,31 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
|
|
||||||
public function initToolbar()
|
public function initToolbar()
|
||||||
{
|
{
|
||||||
// $this->toolbar_title = stripslashes($this->_category->getName());
|
|
||||||
if (empty($this->display))
|
if (empty($this->display))
|
||||||
$this->toolbar_btn['new'] = array(
|
$this->toolbar_btn['new'] = array(
|
||||||
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
|
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
|
||||||
'desc' => $this->l('Add new')
|
'desc' => $this->l('Add new')
|
||||||
);
|
);
|
||||||
if (Tools::getValue('id_category'))
|
if (Tools::getValue('id_category') && !Tools::isSubmit('updatecategory'))
|
||||||
|
{
|
||||||
$this->toolbar_btn['edit'] = array(
|
$this->toolbar_btn['edit'] = array(
|
||||||
'href' => self::$currentIndex.'&update'.$this->table.'&id_category='.Tools::getValue('id_category').'&token='.$this->token,
|
'href' => self::$currentIndex.'&update'.$this->table.'&id_category='.Tools::getValue('id_category').'&token='.$this->token,
|
||||||
'desc' => $this->l('Edit')
|
'desc' => $this->l('Edit')
|
||||||
);
|
);
|
||||||
|
$back = Tools::safeOutput(Tools::getValue('back', ''));
|
||||||
|
if (empty($back))
|
||||||
|
$back = self::$currentIndex.'&token='.$this->token;
|
||||||
|
$this->toolbar_btn['cancel'] = array(
|
||||||
|
'href' => $back,
|
||||||
|
'desc' => $this->l('Cancel')
|
||||||
|
);
|
||||||
|
}
|
||||||
if ($this->display == 'view')
|
if ($this->display == 'view')
|
||||||
$this->toolbar_btn['new'] = array(
|
$this->toolbar_btn['new'] = array(
|
||||||
'href' => self::$currentIndex.'&add'.$this->table.'&id_parent='.Tools::getValue('id_category').'&token='.$this->token,
|
'href' => self::$currentIndex.'&add'.$this->table.'&id_parent='.Tools::getValue('id_category').'&token='.$this->token,
|
||||||
'desc' => $this->l('Add new')
|
'desc' => $this->l('Add new')
|
||||||
);
|
);
|
||||||
parent::initToolbar();
|
parent::initToolbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initForm()
|
public function initForm()
|
||||||
@@ -155,7 +164,7 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
$this->initToolbar();
|
$this->initToolbar();
|
||||||
$obj = $this->loadObject(true);
|
$obj = $this->loadObject(true);
|
||||||
$selected_cat = array(isset($obj->id_parent) ? $obj->id_parent : Tools::getValue('id_parent', 1));
|
$selected_cat = array(isset($obj->id_parent) ? $obj->id_parent : Tools::getValue('id_parent', 1));
|
||||||
if (sizeof($selected_cat) > 0)
|
if (count($selected_cat) > 0)
|
||||||
{
|
{
|
||||||
if (isset($selected_cat[0]))
|
if (isset($selected_cat[0]))
|
||||||
$selected_cat = implode(',', $selected_cat);
|
$selected_cat = implode(',', $selected_cat);
|
||||||
@@ -299,7 +308,6 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
foreach ($groups as $group)
|
foreach ($groups as $group)
|
||||||
$this->fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], (in_array($group['id_group'], $carrier_groups_ids)));
|
$this->fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], (in_array($group['id_group'], $carrier_groups_ids)));
|
||||||
|
|
||||||
|
|
||||||
return parent::initForm();
|
return parent::initForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,8 +334,10 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
if (Validate::isLoadedObject($object = $this->loadObject()) && isset($this->fieldImageSettings))
|
if (Validate::isLoadedObject($object = $this->loadObject()) && isset($this->fieldImageSettings))
|
||||||
{
|
{
|
||||||
// check if request at least one object with noZeroObject
|
// check if request at least one object with noZeroObject
|
||||||
if (isset($object->noZeroObject) && count($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
|
if (isset($object->noZeroObject) &&
|
||||||
$this->_errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
count($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
|
||||||
|
$this->_errors[] = Tools::displayError('You need at least one object.').' <b>'.
|
||||||
|
$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($this->deleted)
|
if ($this->deleted)
|
||||||
@@ -343,7 +353,8 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.
|
||||||
|
$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||||
@@ -353,11 +364,12 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
if ($this->tabAccess['edit'] !== '1')
|
if ($this->tabAccess['edit'] !== '1')
|
||||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||||
else if (!Validate::isLoadedObject($object = new Category((int)Tools::getValue($this->identifier, Tools::getValue('id_category_to_move', 1)))))
|
else if (!Validate::isLoadedObject($object = new Category((int)Tools::getValue($this->identifier, Tools::getValue('id_category_to_move', 1)))))
|
||||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.
|
||||||
if (!$object->updatePosition((int)(Tools::getValue('way')), (int)Tools::getValue('position')))
|
$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||||
|
if (!$object->updatePosition((int)Tools::getValue('way'), (int)Tools::getValue('position')))
|
||||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||||
else
|
else
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier, Tools::getValue('id_category_parent', 1)))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCategories'));
|
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)Tools::getValue($this->identifier, Tools::getValue('id_category_parent', 1))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCategories'));
|
||||||
}
|
}
|
||||||
/* Delete multiple objects */
|
/* Delete multiple objects */
|
||||||
else if (Tools::getValue('submitDel'.$this->table))
|
else if (Tools::getValue('submitDel'.$this->table))
|
||||||
@@ -390,11 +402,17 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
protected function postImage($id)
|
protected function postImage($id)
|
||||||
{
|
{
|
||||||
$ret = parent::postImage($id);
|
$ret = parent::postImage($id);
|
||||||
if (($id_category = (int)Tools::getValue('id_category')) && isset($_FILES) && count($_FILES) && $_FILES['image']['name'] != null && file_exists(_PS_CAT_IMG_DIR_.$id_category.'.jpg'))
|
if (($id_category = (int)Tools::getValue('id_category')) &&
|
||||||
|
isset($_FILES) && count($_FILES) && $_FILES['image']['name'] != null &&
|
||||||
|
file_exists(_PS_CAT_IMG_DIR_.$id_category.'.jpg'))
|
||||||
{
|
{
|
||||||
$images_types = ImageType::getImagesTypes('categories');
|
$images_types = ImageType::getImagesTypes('categories');
|
||||||
foreach ($images_types as $k => $image_type)
|
foreach ($images_types as $k => $image_type)
|
||||||
imageResize(_PS_CAT_IMG_DIR_.$id_category.'.jpg', _PS_CAT_IMG_DIR_.$id_category.'-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height']);
|
imageResize(
|
||||||
|
_PS_CAT_IMG_DIR_.$id_category.'.jpg',
|
||||||
|
_PS_CAT_IMG_DIR_.$id_category.'-'.stripslashes($image_type['name']).'.jpg',
|
||||||
|
(int)$image_type['width'], (int)$image_type['height']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user