Jump to content

Call function on button click/link


Recommended Posts


I have a button on .tpl page and working function in Product class (for example: {Product::getProductAttributesIds()})

I like to call this function only after "click" or "submit" of button

If I make "action={Product::getProductAttributesIds()}" - fuction will be called immediatelly while page load

How run this function only after button click

Thanks a lot for your help!


Link to comment
Share on other sites

12 hours ago, tomerg3 said:

You cannot call a PHP function from a loaded HTML page.
You will need to trigger a Javascript Ajax call to a PHP file, which will call the function.

There are many examples of this in PrestaShop, for example, the Add To Cart button.

Didnt find working, will be glad if you can help

Link to comment
Share on other sites

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...