diff --git a/admin-dev/tabs/AdminAttributes.php b/admin-dev/tabs/AdminAttributes.php deleted file mode 100644 index 97edea1db..000000000 --- a/admin-dev/tabs/AdminAttributes.php +++ /dev/null @@ -1,203 +0,0 @@ - -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 7465 $ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); - -class AdminAttributes extends AdminTab -{ - public function __construct() - { - $this->table = 'attribute'; - $this->className = 'Attribute'; - $this->lang = true; - $this->edit = true; - $this->delete = true; - $this->fieldImageSettings = array('name' => 'texture', 'dir' => 'co'); - - parent::__construct(); - } - - /** - * Display form - */ - public function displayForm($token = NULL) - { - if (!Combination::isFeatureActive()) - { - $this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' '.$this->l('Performances').''); - return; - } - - parent::displayForm(); - - if (!($obj = $this->loadObject(true))) - return; - $color = ($obj->color ? $obj->color : 0); - $attributes_groups = AttributeGroup::getAttributesGroups($this->_defaultFormLanguage); - $strAttributesGroups = ''; - echo ' - -
- '; - } - - /** - * Manage page processing - */ - public function postProcess($token = NULL) - { - if (!Combination::isFeatureActive()) - return; - - - Module::hookExec('postProcessAttribute', - array('errors' => &$this->_errors)); // send _errors as reference to allow postProcessFeatureValue to stop saving process - - if (Tools::getValue('submitDel'.$this->table)) - { - if ($this->tabAccess['delete'] === '1') - { - if (isset($_POST[$this->table.$_POST['groupid'].'Box'])) - { - $object = new $this->className(); - if ($object->deleteSelection($_POST[$this->table.$_POST['groupid'].'Box'])) - Tools::redirectAdmin(self::$currentIndex.'&conf=2'.'&token='.($token ? $token : $this->token)); - $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); - } - else - $this->_errors[] = Tools::displayError('You must select at least one element to delete.'); - } - else - $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); - } - elseif (Tools::isSubmit('submitAdd'.$this->table)) - { - $id_attribute = (int)Tools::getValue('id_attribute'); - // Adding last position to the attribute if not exist - if ($id_attribute <= 0) - { - $sql = 'SELECT `position`+1 - FROM `'._DB_PREFIX_.'attribute` - WHERE id_attribute_group = '.(int)Tools::getValue('id_attribute_group').' - ORDER BY position DESC'; - // set the position of the new attribute in $_POST for postProcess() method - $_POST['position'] = DB::getInstance()->getValue($sql); - } - // clean \n\r characters - foreach ($_POST as $key => $value) - if (stripos($key, 'name_') !== false) - $_POST[$key] = str_replace ('\n', '', str_replace('\r', '', $value)); - parent::postProcess(); - } - else - parent::postProcess(); - } - - - /** - * Modifying initial getList method to display position feature (drag and drop) - */ - public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false) - { - if ($order_by && $this->context->cookie->__get($this->table.'Orderby')) - $order_by = $this->context->cookie->__get($this->table.'Orderby'); - else - $order_by = 'position'; - - parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop); - } -} - - diff --git a/admin-dev/tabs/AdminAttributesGroups.php b/admin-dev/tabs/AdminAttributesGroups.php deleted file mode 100644 index 2e7eecbbb..000000000 --- a/admin-dev/tabs/AdminAttributesGroups.php +++ /dev/null @@ -1,360 +0,0 @@ - -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 7465 $ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); -include_once(_PS_ADMIN_DIR_.'/tabs/AdminAttributes.php'); - -class AdminAttributesGroups extends AdminTab -{ - /** @var object AdminAttributes() instance */ - private $adminAttributes; - - public function __construct() - { - $this->adminAttributes = new AdminAttributes(); - $this->table = 'attribute_group'; - $this->className = 'AttributeGroup'; - $this->lang = true; - $this->edit = true; - $this->delete = true; - - $this->fieldsDisplay = array( - 'name' => array('title' => $this->l('Name'), 'width' => 140, 'filter_key' => 'b!name'), - 'attribute' => array('title' => $this->l('Attributes'), 'width' => 240, 'orderby' => false, 'search' => false), - 'position' => array('title' => $this->l('Position'), 'width' => 40,'filter_key' => 'cp!position', 'align' => 'center', 'position' => 'position')); - parent::__construct(); - } - - public function display() - { - if (Combination::isFeatureActive()) - { - if ((isset($_POST['submitAddattribute']) AND sizeof($this->adminAttributes->_errors)) - OR isset($_GET['updateattribute']) OR isset($_GET['addattribute'])) - { - $this->adminAttributes->displayForm($this->token); - echo '
'.$this->l('Back to list').'
'.$this->l('Add attributes group').'
'.$this->l('Add attribute').'
';
-
- echo '
-
';
- }
- else
- echo (int)($tr['position'] + 1);
-
- echo '
-
-
-
-
{l s='Back'}
+ {else}
+
{l s='Back to list'}
+ {/if}
+
+ {elseif isset($params.position)}
+ {if $order_by == 'position' && $order_way != 'DESC'}
+
+
+
+
+
+
+
+ {else}
+ {$tr.$key.position + 1}
+ {/if}
+ {elseif isset($params.image)}
+ {$tr.$key}
+ {elseif (isset($params.icon))}
+