aimeos-core icon indicating copy to clipboard operation
aimeos-core copied to clipboard

Coupon is not removed when invalid, no error message

Open nvindice opened this issue 3 years ago • 5 comments

When a coupon code is entered but invalid (eg. because the basket decorator does not fit requirements), no error message is displayed. The code just becomes part of the basket but does not have any effect on the basket value.

IMHO it would make more sense to explain the problem to the user like it happened in 2018.10 so the user can enter another coupon code or change his basket contents.

Same thing happens when the coupon code gets invalid because the basket content changed - the user may not even recognize the coupon is no longer valid. The invalid coupon code should be removed from the basket (IMHO) or at least the user should see a note explaning to problem.

nvindice avatar Nov 18 '21 16:11 nvindice

Main problem is that Aimeos has no system for passing warning messages to the frontend and providers can only throw exceptions to display errors. But throwing an exception always stops of the rest of the code which should be executed nevertheless in case of a warning.

aimeos avatar Nov 20 '21 09:11 aimeos

I see. Is there any way to get access to the view object in the plugin? This would be a very simple way to pass error messages.

nvindice avatar Nov 22 '21 12:11 nvindice

Don't think so. You can get a view object from the context but it's not the view object used by the HTML client.

aimeos avatar Nov 22 '21 12:11 aimeos

Yes, I've noticed that. In our case, we will just go back to the 2018.x version and throw an exception (which seems to work fine here). However, this seems to be a good candidate for a 2022 feature? :-)

nvindice avatar Nov 22 '21 13:11 nvindice

Yeah and help is always appreciated :-)

aimeos avatar Nov 22 '21 13:11 aimeos