diff --git a/controllers/admin/AdminAttributesGroupsController.php b/controllers/admin/AdminAttributesGroupsController.php index 0388dd046..b96bb1430 100644 --- a/controllers/admin/AdminAttributesGroupsController.php +++ b/controllers/admin/AdminAttributesGroupsController.php @@ -26,6 +26,7 @@ class AdminAttributesGroupsControllerCore extends AdminController { + public $bootstrap = true; protected $id_attribute; protected $position_identifier = 'id_attribute_group'; protected $attribute_name; @@ -43,7 +44,8 @@ class AdminAttributesGroupsControllerCore extends AdminController $this->fields_list = array( 'id_attribute_group' => array( 'title' => $this->l('ID'), - 'align' => 'center' + 'align' => 'center', + 'class' => 'fixed-width-xs' ), 'name' => array( 'title' => $this->l('Name'), @@ -528,7 +530,7 @@ class AdminAttributesGroupsControllerCore extends AdminController if ($this->display == 'view') { $this->page_header_toolbar_title = $this->attribute_name[$this->context->employee->id_lang]; - $this->page_header_toolbar_btn['new_attribute_group'] = array( + $this->page_header_toolbar_btn['back_to_list'] = array( 'href' => self::$currentIndex.'&token='.$this->token, 'desc' => $this->l('Back to list'), 'icon' => 'process-icon-back' diff --git a/controllers/admin/AdminFeaturesController.php b/controllers/admin/AdminFeaturesController.php index 619e81ad8..bcc92b822 100644 --- a/controllers/admin/AdminFeaturesController.php +++ b/controllers/admin/AdminFeaturesController.php @@ -25,9 +25,9 @@ */ class AdminFeaturesControllerCore extends AdminController { - public $bootstrap = true ; - + public $bootstrap = true; protected $position_identifier = 'id_feature'; + protected $feature_name; public function __construct() { @@ -37,7 +37,9 @@ class AdminFeaturesControllerCore extends AdminController $this->fields_list = array( 'id_feature' => array( - 'title' => $this->l('ID') + 'title' => $this->l('ID'), + 'align' => 'center', + 'class' => 'fixed-width-xs' ), 'name' => array( 'title' => $this->l('Name'), @@ -75,7 +77,7 @@ class AdminFeaturesControllerCore extends AdminController { $this->addRowAction('edit'); $this->addRowAction('delete'); - $this->addRowAction('details'); + $this->addRowAction('view'); $this->_defaultOrderBy = 'position'; // Added specific button in toolbar @@ -112,6 +114,43 @@ class AdminFeaturesControllerCore extends AdminController $this->identifier = 'id_feature'; } + public function renderView() + { + if (($id = Tools::getValue('id_feature'))) + { + + $this->setTypeValue(); + $this->lang = true; + + // Action for list + $this->addRowAction('edit'); + $this->addRowAction('delete'); + + if (!Validate::isLoadedObject($obj = new Feature((int)$id))) + { + $this->errors[] = Tools::displayError('An error occurred while updating the status for an object.').' '.$this->table.' '.Tools::displayError('(cannot load object)'); + return; + } + + $this->feature_name = $obj->name; + $this->toolbar_title = $this->feature_name; + $this->fields_list = array( + 'id_feature_value' => array( + 'title' => $this->l('ID'), + 'align' => 'center', + 'class' => 'fixed-width-xs' + ), + 'value' => array( + 'title' => $this->l('Value') + ) + ); + + $this->_where = sprintf('AND `id_feature` = %d', (int)$id); + } + + return parent::renderList(); + } + /** * method call when ajax request is made with the details row action * @see AdminController::postProcess() @@ -214,17 +253,29 @@ class AdminFeaturesControllerCore extends AdminController public function initPageHeaderToolbar() { - $this->page_header_toolbar_title = $this->l('Features'); - $this->page_header_toolbar_btn['new_feature'] = array( - 'href' => self::$currentIndex.'&addfeature&token='.$this->token, - 'desc' => $this->l('Add new feature'), - 'icon' => 'process-icon-new' - ); - $this->page_header_toolbar_btn['new_feature_value'] = array( - 'href' => self::$currentIndex.'&addfeature_value&token='.$this->token, - 'desc' => $this->l('Add new feature value'), - 'icon' => 'process-icon-new' - ); + if ($this->display == 'view') + { + $this->page_header_toolbar_title = $this->feature_name[$this->context->employee->id_lang]; + $this->page_header_toolbar_btn['back_to_list'] = array( + 'href' => self::$currentIndex.'&token='.$this->token, + 'desc' => $this->l('Back to list'), + 'icon' => 'process-icon-back' + ); + } + else + { + $this->page_header_toolbar_title = $this->l('Features'); + $this->page_header_toolbar_btn['new_feature'] = array( + 'href' => self::$currentIndex.'&addfeature&token='.$this->token, + 'desc' => $this->l('Add new feature'), + 'icon' => 'process-icon-new' + ); + $this->page_header_toolbar_btn['new_feature_value'] = array( + 'href' => self::$currentIndex.'&addfeature_value&token='.$this->token, + 'desc' => $this->l('Add new feature value'), + 'icon' => 'process-icon-new' + ); + } parent::initPageHeaderToolbar(); } @@ -263,6 +314,8 @@ class AdminFeaturesControllerCore extends AdminController 'desc' => $this->l('Back to the list') ); break; + case 'view': + break; default: parent::initToolbar();