Posted by Bojhan on January 17, 2011 at 10:18am
6 followers
| Project: | Drupal Commerce |
| Version: | 7.x-1.x-dev |
| Component: | User experience |
| Category: | task |
| Priority: | normal |
| Assigned: | mr.baileys |
| Status: | closed (fixed) |
| Issue tags: | Usability |
Issue Summary
Reviewing Drupal commerce I saw there are no "Empty tables", instead we display just the line "No products have been created yet." where it should display a table, within that a line that says "There are no products links yet. Add product."

| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| empty-product-table.png | 5.35 KB | Ignored: Check issue status. | None | None |
Comments
#1
#1029654: Empty table messages
#2
Tagging.
#3
Views is now fixed, can we fix this?
#4
Sure. This is an easy tweak.
#5
Completely untested.
http://drupalcode.org/sandbox/bojanz/1097750.git/commit/f16ada1
#6
#7
I don't think we need this option on every table (for example, the shopping cart shouldn't need it anywhere, and some Views don't have empty text like the line item table and Payment tab View). Additionally, the mock-up specified links to add missing items if applicable.
I'd just limit this to the three main Views for now: Customer profiles, Products, and Orders.
#8
Why is this not in yet?
#9
I guess because no one got around to fixing it. *Bump.* : D
#10
Patch attached that switches to using table layout for the empty text for the Customer Profiles, Orders and Products-views.
I did not implement the "links to add missing items" mentioned in #7 and shown in the mock-up since:
#11
Here's what it looks like for Customer Profiles with the patch from #10 applied:
#12
Looks good.
#13
Actually according to http://drupal.org/node/1146122 - it should always also have the "action" in this case Add a customer profile at the end of the empty message.
#14
Fair enough, here's a patch that includes the action links in the empty results text.
For now I've just switched to "Filtered HTML" since this is used by Commerce in a number of places. I'll open a separate issue to address the fact that "Filtered HTML" is not always available which might cause link-tags to show up escaped.
#15
Nice, I don't think I was aware that Views could still use the table for the empty message.
mr.baileys is really rocking the queue lately! I smell a big Commerce project in the works over there... : )
Will leave this open for review later today.
#16
I'm not sure I want to commit this as is while it depends on relative URLs for the empty message text. The problem is Drupal may be used in a folder on the domain (which is the case for my development environment, for example), and using a relative URL beginning with a / will break these "add" links. This means we may actually have to implement area handlers for the empty text (if that's even possible). I'd be fine with the short term workaround of just committing the patch without the links until we have a solution for those, but I also suppose there isn't much reason to rush it in.
#17
Ah yes. People with clean URLs disabled will probably not like this solution either.
#18
First exposure to writing handlers for the Views 3 API...
This patch creates 3 area handlers to display empty text for Products, Orders and Customer profiles.The screenshot from #14 remains valid, it's just the way that the text is generated that changed. Using a views handler does allow us to bypass the problem the the Filtered HTML format might not be available.
One thing to note is that ever since the exposed filters were added to filter by SKU/order number/customer name, the empty text message used is not longer correct. In all three cases it states that no entity of that type has been created yet, while in reality they might exist but be ignored because of the exposed filter. So I guess we need to tweak the actual text too?
#19
Less low-hanging than I figured :)
#20
Hmm, good call. Maybe we can just have the handler check to see if there are any filters on the View, and if so have it say something like "No products match your filter criteria." without including the add link.
#21
I went ahead and pushed this through to completion. First I moved all the area handlers to the base modules instead of the UI modules; they should really be available whether the site is using the default UI modules or not. To accommodate this, I added an option for the 'add_path' that will be used to generate the appropriate add link if specified. As I described above, I also check to see if there's any exposed filter input in the View, and if so I assume the View has been filtered and display an appropriate message instead of the default empty text message.
Commit: http://drupalcode.org/project/commerce.git/commitdiff/182bbcb
#22
Automatically closed -- issue fixed for 2 weeks with no activity.