Add warning when no conditions and/or actions are available
psynaptic - October 20, 2008 - 20:33
| Project: | UC Discounts |
| Version: | 5.x-1.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
There seems to be a repeating issue where people are finding the conditions and/or actions select widget empty. This can be caused by not having any of the included modules installed so no conditions or actions are available.
We need to add a warning message when no conditions or actions are available so users don't get confused.

#1
Simplest thing is to implement hook_store_status.
A warning when users actually are on the page with the empty bits, or when users are at the start of the process of adding a discount would be good too -- since there's no point creating a discount if you have less than 1 condition and 1 action available.
#2
I would say the most visible place for a warning would be on the discounts admin page itself. We could have a message on the install page too since that would save the admin navigating back to the modules page.
#3
/admin/store/discounts ?
Yup, since that's where you start trying to add discounts.
Still, it's not too hard to also do a status notice.
So we need to code:
- a sanity-checking function for the core discounts module. This checks there is at least one action and one condition available; returns TRUE or FALSE.
- something that calls this on the discounts admin page. Ideally, this should block the 'add discount' link too, since it's of no use.
- an implementation of hook_store_status which calls this too.
#4
#5
Turns out there's already functions that get a list of actions and conditions: they're used to populate those lists that are showing up empty.
Implemented the hook, and checking on our admin page too with a message that sends the user to check status.
Here's a patch of what I've committed.
#6
Just tested this and it works perfectly. Thanks!
#7
Automatically closed -- issue fixed for two weeks with no activity.