diff --git a/admin-dev/themes/default/template/controllers/modules/js.tpl b/admin-dev/themes/default/template/controllers/modules/js.tpl index d920b668b..d2d732e1b 100644 --- a/admin-dev/themes/default/template/controllers/modules/js.tpl +++ b/admin-dev/themes/default/template/controllers/modules/js.tpl @@ -348,7 +348,7 @@ // res.status = cache or refresh if (data == 'OK') { - el.parent('div').find('.toggle_favorite').toggle(); + el.parent('li').find('.toggle_favorite').toggle(); } }, diff --git a/admin-dev/themes/default/template/controllers/modules/list.tpl b/admin-dev/themes/default/template/controllers/modules/list.tpl index bd8d1162e..7466f64a1 100644 --- a/admin-dev/themes/default/template/controllers/modules/list.tpl +++ b/admin-dev/themes/default/template/controllers/modules/list.tpl @@ -150,8 +150,6 @@ {l s='Remove from Favorites'} - -
  • @@ -161,8 +159,6 @@ -
  • -
  • {l s='Mark as Favorite'} diff --git a/controllers/admin/AdminFeaturesController.php b/controllers/admin/AdminFeaturesController.php index 1bbfdec21..f437c5349 100644 --- a/controllers/admin/AdminFeaturesController.php +++ b/controllers/admin/AdminFeaturesController.php @@ -156,64 +156,6 @@ class AdminFeaturesControllerCore extends AdminController } } - /** - * method call when ajax request is made with the details row action - * @see AdminController::postProcess() - */ - /*public function ajaxProcessDetails() - { - if (($id = Tools::getValue('id'))) - { - $this->setTypeValue(); - $this->lang = true; - - // override attributes - $this->display = 'list'; - - // 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)'); - - $this->fields_list = array( - 'id_feature_value' => array( - 'title' => $this->l('ID'), - 'width' => 25 - ), - 'value' => array( - 'title' => $this->l('Value') - ) - ); - - $this->_where = sprintf('AND `id_feature` = %d', (int)$id); - - // get list and force no limit clause in the request - $this->getList($this->context->language->id); - - // Render list - $helper = new HelperList(); - $helper->actions = $this->actions; - $helper->no_link = true; - $helper->shopLinkType = ''; - $helper->identifier = $this->identifier; - $helper->toolbar_scroll = false; - $helper->orderBy = 'position'; - $helper->orderWay = 'ASC'; - $helper->currentIndex = self::$currentIndex; - $helper->token = $this->token; - $helper->table = $this->table; - $helper->simple_header = true; - $helper->show_toolbar = false; - $helper->bulk_actions = $this->bulk_actions; - $content = $helper->generateList($this->_list, $this->fields_list); - - echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content)); - exit; - } - }*/ - /** * AdminController::renderForm() override * @see AdminController::renderForm() diff --git a/modules/homefeatured/homefeatured.php b/modules/homefeatured/homefeatured.php index 5a2b1ca54..69c9ab79a 100644 --- a/modules/homefeatured/homefeatured.php +++ b/modules/homefeatured/homefeatured.php @@ -70,10 +70,10 @@ class HomeFeatured extends Module public function getContent() { - $output = '

    '.$this->displayName.'

    '; + $output = ''; if (Tools::isSubmit('submitHomeFeatured')) { - $nbr = (int)Tools::getValue('nbr'); + $nbr = (int)Tools::getValue('HOME_FEATURED_NBR'); if (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr)) $errors[] = $this->l('An invalid number of products has been specified.'); else @@ -83,25 +83,7 @@ class HomeFeatured extends Module else $output .= $this->displayConfirmation($this->l('Your settings have been updated.')); } - return $output.$this->displayForm(); - } - - public function displayForm() - { - $output = ' -
    -
    '.$this->l('Settings').' -

    '.$this->l('To add products to your homepage, simply add them to the "home" category.').'


    - -
    - -

    '.$this->l('Define the number of products that you would like to display on homepage (default: 8).').'

    - -
    -
    -
    -
    '; - return $output; + return $output.$this->renderForm(); } public function hookDisplayHeader($params) @@ -146,4 +128,56 @@ class HomeFeatured extends Module { $this->_clearCache('homefeatured.tpl'); } + + public function renderForm() + { + $fields_form = array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Settings'), + 'icon' => 'icon-cogs' + ), + 'description' => $this->l('To add products to your homepage, simply add them to the "home" category.'), + 'input' => array( + array( + 'type' => 'text', + 'label' => $this->l('Define the number of products to be displayed.'), + 'name' => 'HOME_FEATURED_NBR', + 'class' => 'fixed-width-xs', + 'desc' => $this->l('Define the number of products that you would like to display on homepage (default: 8).'), + ), + ), + 'submit' => array( + 'title' => $this->l('Save'), + 'class' => 'btn btn-primary') + ), + ); + + $helper = new HelperForm(); + $helper->show_toolbar = false; + $helper->table = $this->table; + $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); + $helper->default_form_language = $lang->id; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; + $this->fields_form = array(); + $helper->id = (int)Tools::getValue('id_carrier'); + $helper->identifier = $this->identifier; + $helper->submit_action = 'submitHomeFeatured'; + $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->tpl_vars = array( + 'fields_value' => $this->getConfigFieldsValues(), + 'languages' => $this->context->controller->getLanguages(), + 'id_language' => $this->context->language->id + ); + + return $helper->generateForm(array($fields_form)); + } + + public function getConfigFieldsValues() + { + return array( + 'HOME_FEATURED_NBR' => Tools::getValue('HOME_FEATURED_NBR', Configuration::get('HOME_FEATURED_NBR')), + ); + } }