Jump to content

actionAdminSuppliersListingFieldsModifier - custom button


Recommended Posts

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.

screenshot.jpg

Edited by Estian (see edit history)
Link to comment
Share on other sites

  • Estian changed the title to actionAdminSuppliersListingFieldsModifier - custom button

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...