Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    Display Custom Error On Symfony Admin Product Controller Form In Prestashop 1.7

    In this post, I am going to explain how we can display the error on Admin Product controller custom form in our module.

    Step 1:-  Changes in template form

    Register the hook displayProductExtra and return the HTML

    Make sure you have added id=”form_hooks_{field_name}” in the form field where you want to display the error.

    <input type=”text” name=”{field_name}” id=”form_hooks_{field_name}” />


    <input type=”text” name=”title” id=”form_hooks_title” />

    Step 2:- On Product Save

    Inside ActionProductSave hook check the condition and set the error in the following format

    Example: –

    Now check the condition whether there is an error or not.

    If there is an error then set the http_response_code with 400 and die the error.

    This is how we can display the error message in the Admin Product controller custom form of our module.

    . . .


    Add Your Comment

    Be the first to comment.

    Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again