Search the Community
Showing results for tags 'fields_list'.
-
PrestaShop Version: 1.7.6.5 Coding Knowledge: Intermediate (Learning PrestaShop) I have developed a module that I intend to use to modify the "AdminSuppliers" controller list view in the back office. In fact I've been able to hook into the "actionAdminSuppliersListingFieldsModifier" hook in order to do just that (see attached screenshot). On the supplier list view this custom button's value is determined by a newly added custom setting that can also be toggled on the supplier edit page. On the supplier edit page when a supplier is saved the "hookActionAdminSaveAfter" is used to capture the newly added custom setting value. The problem I'm facing is that the button on the list view is simply not toggling this value in the same way, and I'm sure that I am missing a piece of information that would allow this value to be toggled on the list view. Note that I want this button to toggle the newly added custom value in the exact way the "Status" button toggles the supplier's enabled/disabled status. The only code I have for adding this button so far is the below: public function hookActionAdminSuppliersListingFieldsModifier( $params ) { // This adds the value to the list, but is not saving since there is no AdminController "processHide_products" function. $params['fields']['hide_products'] = [ 'title' => $this->trans( 'Hide assoc. products' ), 'align' => 'center', 'type' => 'bool', 'orderby' => false, 'class' => '', 'active' => 'hide_products' ]; } When the newly created custom button on the list view is clicked it tries opening the following link: "index.php?controller=AdminSuppliers&id_supplier=<id_supplier>&hide_productssupplier&token=<token>" To make this button acccess and save its custom value, should this URL be changed? What is the best way to implement this button? Thank you in advance for any assistance.
-
- actionadminsupplierslistingfieldsmodifier
- fields_list
-
(and 1 more)
Tagged with:
-
Bonjour, j'ai développe un module sous Prestashop 1.6, maintenant j'ai du mal a gérer deux tables dans la base de données, je sais pas exactement comment je peux manipuler les fields_list mais ça va pour les forms. voila un morceau de code : public function getContent() { $output = null; if (Tools::isSubmit('submit'.$this->name)) { $my_module_name = strval(Tools::getValue('printpics')); if (!$my_module_name || empty($my_module_name) || !Validate::isGenericName($my_module_name)) $output .= $this->displayError($this->l('Invalid Configuration value')); else { Configuration::updateValue('printpics', $my_module_name); $output .= $this->displayConfirmation($this->l('Settings updated')); } } return $output.$this->displayForm(); } public function displayForm() { // Get default language $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); // Init Fields form array $fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Settings'), ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Configuration champs'), 'name' => 'MYMODULE_NAME', 'size' => 20, 'required' => true ) ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'button' ) ); $helper = new HelperForm(); // Load current value $helper->fields_value['MYMODULE_NAME'] = Configuration::get('MYMODULE_NAME'); return $helper->generateForm($fields_form); }
- 1 reply
-
- initList
- fields_list
-
(and 1 more)
Tagged with:
-
I'm facing a few problems here and can't seem to find any solutions for it, any help would be much appreciated: 1) I'm trying to add in a downloadable link into the CRUD table. 2) The show more details button does not work (nothing happens when i click on it) 3) How can I disable the clicking on each row that directs the user to the edit page? 4) I'm using PS 1.6.0.5 AdminUserUploads (A custom tab in back office) <?php class AdminUserUploads extends AdminController { public function __construct(){ $this->bootstrap = true; $this->table = "customer_uploads"; $this->className = "MyUploads"; $this->lang = false; $this->deleted = false; $customer_id = (int)Tools::getValue('id_customer_uploads'); $this->context = Context::getContext(); $this->fields_list = array( 'id_customer_uploads' => array( 'title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'p_name' => array( 'title' => $this->l('Product Name'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'p_desc' => array( 'title' => $this->l('Product Description'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'p_cost' => array( 'title' => $this->l('Production Cost'), 'align' => 'center', 'type' => 'price', 'class' => 'fixed-width-xs' ), 'id_customer' => array( 'title' => $this->l('Customer ID'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'c_name' => array( 'title' => $this->l('Customer Name'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'c_contact' => array( 'title' => $this->l('Contact Number'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'c_email' => array( 'title' => $this->l('Email'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'attachment' => array( 'title' => $this->l('Attachments'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'upload_date' => array( 'title' => $this->l('Upload Date'), 'type' => 'date', 'align' => 'center', 'class' => 'fixed-width-xs' ), 'active' => array( 'title' => $this->l('Status'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'class' => 'fixed-width-xs' ) ); parent::__construct(); } public function renderList(){ //$this->actions = array('edit', 'delete', 'view'); $this->addRowAction('details'); return parent::renderList(); } public function rednerForm(){ //$this->fields_form = array() return parent::renderForm(); } public function ajaxProcess() { $query = "SELECT * FROM customer_uploads WHERE id_customer_uploads = '$customer_id'"; echo Tools::jsonEncode(array( 'data' => Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query), 'fields_display' => $this->fieldsDisplay = array( 'id_customer_uploads' => array('title' => $this->l('ID')), 'p_name' => array('title' => $this->l('Product Name')), 'p_desc' => array('title' => $this->l('Product Description')), 'upload_date' => array('title' => $this->l('Upload Date')), 'active' => array('title' => $this->l('Status')) ) )); die(); } }
-
Hi there, I am trying to hide the product-id from my backoffice product page. By removing $this->fields_list['id_product'] = array( 'title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs', 'type' => 'int' ); from my AdminProductsController.php I get a fatal error as the id is needed for further processes. That's why I want to hide the ID but I couldn't figure out how to do it. Does anybody have an idea how this can be achieved? Thanks a lot!
-
- product-id
- product-list
-
(and 4 more)
Tagged with: