Jump to content

Display error message or warning in backoffice


Shwamateur

Recommended Posts

Hi everyone, im struggling with this problem:

 

I want to display a warning or an error message (whichever is easier to do) from a module.

More concretely i'm trying to achieve this from a module.

 

The goal is that a message like this is shown:

 

post-734062-0-80275800-1404915236_thumb.png

 

whenever any user updates a product and he or she doesn't select a supplier for the product.

I'm trying to trigger this from the hook  "hookupdateproduct".

 

Can anyone help me, please?

 

Thank you in advance.

post-734062-0-80275800-1404915236_thumb.png

Link to comment
Share on other sites

  • 10 months later...

I have this same question, but I'll add some more info as the OP seems to have left the thread.

 

I'm using PS1.6 and I've created a module that adds a new product tab to the back office.

This works just fine, but I want to throw an error when someone forgets to fill out a specific field.

 

Inside of my module, during actionProductSave, actionProductUpdate and actionObjectProductUpdateAfter I've added $this->displayError('Oh dear!'); and made the method return false, but that didn't help.

Neither did $this->errors[] = Tools::displayError('Oh dear');

 

Any ideas?

Link to comment
Share on other sites

  • 2 years later...
On 19.05.2015 at 9:29 AM, Appwards said:

Ha! That did the trick.

I guess I need to learn a bit more about that context object.

 

Thanks a lot!

What did the trick? There is no previous message.

Anyway, the way to achieve what OP was asking for is 

$this->adminDisplayWarning('Your message');

Edited by hakeryk2 (see edit history)
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...