Chill_user Posted January 22, 2020 Share Posted January 22, 2020 Hello 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 More sharing options...
tomerg3 Posted January 22, 2020 Share Posted January 22, 2020 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. Link to comment Share on other sites More sharing options...
Chill_user Posted January 23, 2020 Author Share Posted January 23, 2020 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 More sharing options...
Chill_user Posted January 23, 2020 Author Share Posted January 23, 2020 Please help Link to comment Share on other sites More sharing options...
tomerg3 Posted January 23, 2020 Share Posted January 23, 2020 I'm happy to help with any code specific questions, or post where you got stuck. If you're looking for someone to write code for you, you should try the paid work section. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now