Search the Community
Showing results for tags 'Helper List'.
-
Salut j'ai crée un module dont la configuration doit contenir une liste et un deuxième formulaire de configuration indépendant . comme illustre l'image ci-dessous protected function initList() { $this->fields_list = array( 'id_info' => array( 'title' => $this->trans('ID', array(), 'Admin.Global'), 'width' => 120, 'type' => 'text', 'search' => false, 'orderby' => false ), 'title' => array( 'title' => $this->trans('Title', array(), 'Admin.Global'), 'width' => 100, 'type' => 'text', 'search' => false, 'orderby' => false ), 'active' => array( 'title' => $this->trans('Displayed', array(), 'Admin.Global'), 'type' => 'bool', 'active' => 'status', 'class' => 'fixed-width-xs', 'align' => 'center', 'ajax' => true, ), 'position' => array( 'title' => $this->trans('Position', array(), 'Admin.Global'), 'align' => 'center', 'class' => 'fixed-width-xs', 'position' => 'position', 'filter_key' => false ) ); $helper = new HelperList(); $helper->shopLinkType = ''; $helper->simple_header = false; $helper->actions = array('edit', 'delete'); $helper->show_toolbar = true; $helper->title = $this->displayName; $helper->table = 'eg_partners_infos'; $helper->identifier = 'id_eg_partners_infos'; $helper->position_identifier = 'id_egblockreassurance_to_move'; $helper->orderBy = 'position'; $helper->orderWay = 'ASC'; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name; $helper->imageType = 'jpg'; $helper->toolbar_btn['new'] = array( 'href' => AdminController::$currentIndex . '&configure=' . $this->name . '&add' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->trans('Add new', array(), 'Admin.Actions') ); return $helper; } /** * Create the form that will be displayed in the configuration of your module. */ protected function renderForm() { $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $helper->module = $this; $helper->default_form_language = $this->context->language->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0); $helper->identifier = $this->identifier; $helper->submit_action = 'submitEg_partners_infosModule'; $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->getConfigFormValues(), /* Add values for your inputs */ 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id, ); return $helper->generateForm(array($this->getConfigForm())); } comment pourrais -je ajouter le deuximè formualire de configuration ? Merci d'avance
-
Bonjour, Je voudrais ajouter un champs 'En solde' dans la liste des produits en admin products, le champs s'affiche bien, mon problème est le filtrage me retourne une erreur 'ambiguious field on_sale', malgré j'ai bien spécifié l'alias $this->_select .= 'sa.`on_sale`'; $this->fields_list['on_sale'] = array( 'title' => $this->l('En solde'), 'filter_key' => sa.'!on_sale', 'align' => 'text-center', 'type' => 'bool', 'class' => 'fixed-width-sm', 'orderby' => false ); Merci d'avance.
-
- field list
- helper
-
(and 1 more)
Tagged with:
-
Hi everyone! I've created a Admin controller with an object model for table but when I use helper form for editing a row of table my changes doesnt save in database. and row that I've edit will be removed from list view !! this is my controller code: -------------------------------------------------------------------------------------------------------- <?php class AdminResellersreqControllerCore extends AdminController { public $description; public function initProcess() { $this->id_object = Tools::getValue('id_'.$this->table); if (Tools::isSubmit('changeStatus') && $this->id_object) $this->action = 'change_status'; parent::initProcess(); } public function __construct() { $this->bootstrap = true; $this->table = 'resellers_req'; $this->className = 'Resellersreq'; $this->lang = false; // Building the list of records stored within the "resellersreq" table $this->fields_list = array( 'firstname' => array( 'title' => $this->l('First Name'), 'align' => 'center', ), 'lastname' => array( 'title' => $this->l('Last Name'), 'width' => 'auto', ), 'req_date' => array( 'type' => 'date', 'title' => $this->l('Request Date'), 'width' => 'auto' ), // 'description' => array( // 'title' => $this->l('Description'), // 'width' => 'auto' // ), // 'status' => array( // 'title' => $this->l('Status'), // 'type' => 'bool', // 'callback' => 'ShowStatusIcon', // 'width' => 'auto' // ), 'id_customer' => array( 'title' => $this->l('Edit Group'), 'callback' =>'ShowCustomerGroupLink', 'width' => 'auto' ), ); $this->bulk_actions = array( 'delete' => array( 'text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?') ) ); parent::__construct(); $id_shop = $this->context->shop->id; $this->_select = ' a.*, cu.firstname, cu.lastname'; $this->_join = 'LEFT JOIN '._DB_PREFIX_.'customer cu ON (cu.id_customer = a.id_customer)'; $this->_where = 'AND a.id_shop = '.(int)$id_shop; $this->processFilter(); } // This method generates the list of results public function renderList() { $this->addRowAction('edit'); return parent::renderList(); } public function renderForm() { $this->fields_form = array( 'legend' => array( 'title' => $this->l(''), ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Customer Description'), 'name' => 'description', //'values' => $this->description, 'style' => '', 'readonly' => true, //'class' => 't', 'rows' => 5, 'cols' => 35, // 'required' => true, 'desc' => $this->l('Customer Description'), ), array( 'type' => 'switch', 'label' => $this->l('Accept'), 'desc' => $this->l('Accepting or Rejecting a Customer'), 'name' => 'status', 'required' => true, 'class' => 't', 'is_bool' => true, 'values' => array( array( 'id' => 'active_on', 'value' => 1, 'label' => $this->l('Accept') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Reject') ) ), ), array( 'type' => 'textarea', 'autoload_rte' => true, //'class' => 'input fixed-width-sm', 'label' => $this->l('Shop Description'), 'name' => 'shop_description', 'rows' => 5, 'cols' => 35, // 'required' => true, 'desc' => $this->l('Your description for customer'), ), ), 'submit' => array( 'title' => $this->l(' Save '), 'class' => 'button btn btn-default pull-right' ) ); return parent::renderForm(); } public function ShowStatusIcon($id_resellers_req, $tr) { $resellersreq = new Resellersreq($tr['id_resellers_req']); if (!Validate::isLoadedObject($resellersreq)) return; return '<a class="list-action-enable'.($resellersreq->status ? ' action-enabled' : ' action-disabled').'" href="index.php?tab=AdminResellersreq&id_resellers_req='.(int)$resellersreq->id.'&changeStatus&token='.Tools::getAdminTokenLite('AdminResellersreq').'"> '.($resellersreq->status ? '<i class="icon-check"></i>' : '<i class="icon-remove"></i>'). '</a>'; } public function ShowCustomerGroupLink($id_resellers_req, $tr) { $resellersreq = new Resellersreq($tr['id_resellers_req']); if (!Validate::isLoadedObject($resellersreq)) return; return '<a class="edit btn btn-default" href="index.php?tab=AdminCustomers&id_customer='.(int)$resellersreq->id_customer.'&updatecustomer&token='.Tools::getAdminTokenLite('AdminCustomers').'"> '.$this->l('Edit Group').' </a>'; } public function processChangeStatus() { $resellersreq = new Resellersreq($this->id_object); if (!Validate::isLoadedObject($resellersreq)) $this->errors[] = Tools::displayError('An error occurred while updating this Request.'); $update = Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'resellers_req` SET status = '.($resellersreq->status ? 0 : 1).' WHERE `id_resellers_req` = '.(int)$resellersreq->id); if (!$update) $this->errors[] = Tools::displayError('An error occurred while updating this Request.'); Tools::clearSmartyCache(); Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); } } ----------------------------------------------------------------------------------- Code of Object Model : class ResellersreqCore extends ObjectModel { public $id; public $status; public $id_customer; public $firstname; public $lastname; /** @var string Name */ public $name; //public $editgroup; //public $shop_description; /** * @see ObjectModel::$definition */ public static $definition = array( 'table' => 'resellers_req', //'multishop' => true, 'primary' => 'id_resellers_req', 'fields' => array( 'id_shop' => array( 'type' => self::TYPE_INT, 'validate' => 'isUnsignedId' ), 'id_customer' => array( 'type' => self::TYPE_INT, 'validate' => 'isUnsignedId' ), 'req_date' => array( 'type' => self::TYPE_DATE, 'validate' => 'isDateFormat', ), 'description' => array( 'type' => self::TYPE_STRING, ), 'status' => array( 'type' => self::TYPE_INT, 'validate' => 'isUnsignedId', ), 'shop_description' => array( 'type' => self::TYPE_STRING, ), ), ); public function __construct($id_shop = null) { parent::__construct($id_shop); } } ---------------------------------------------------------------------------------------------------------------- Could anyone Help me? Tanx.
-
Przy dodawaniu kodu SQL do AdminCategoriesController nie zwraca żadnego wyniku, za pomocą var_dump sprawdziłem zapytanie i jest ono poprawne. Może ktoś wie, co przeoczyłem? Problem powodują te 3 linijki, dodane do kodu $this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'product` p ON (a.`id_category` = p.`id_category_default`)'; $this->_select .= 'COUNT(p.id_product)'; $this->_group .= 'GROUP BY a.id_category';
-
- Helper List
- AdminController
-
(and 1 more)
Tagged with: