Jump to content

PS 1.7 - Make a module hooked on product page returns error or confirmation message


Recommended Posts

Hi community,

I'm trying to adapt one of my small module for PS 1.7, this one is hooked to the product page (in the "Modules" tab, with "hookDisplayAdminProductsExtra" method)  and i have a question about how to make it returns error or confirmation message (as the ones that appear on the top-right corner when updating a product).

Currently the module is correctly showing in the tab and the data are sent to the module when clicking "Save".

But i don't understand how to pass an error or confirmation message to the product page.

Here is my code :

    public function hookActionProductUpdate($params)
    {
        $cpcd_array = Tools::getValue("cpcd");
        $new_product_date = $cpcd_array['changeproductcreationdate']['product_creation_date'];
        if (!Validate::isDate($new_product_date)) {
            //die('invalid date'); //showing in the console
            return $this->displayError($this->l('Invalid date')); //not working
        }
    }

Does anybody has an idea on how to perform this ?

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