Two long standing issues in core Ubercart have been our excessive use of cache_clear_all() and the awkwardness of the shopping cart block for themers. I dug into the first issue last night and ended up addressing the second at the same time, though this does mean that themes currently dealing with the shopping cart block will be broken after our next release. This work is for Ubercart 2.x.
A quick summary of the changes in this first patch includes:
- If caching is enabled and a user is not logged in, the shopping cart block title will always use the empty cart icon and won't have collapsibility. The contents will come from a new theme function, theme_uc_cart_block_content_cachable(), which at this point simply includes a short message and link to the cart page. This should get rid of those "ghost" carts the people get when they have page caching enabled.
- Authenticated users will see the cart block as before... so, not really a change, but just wanted to make sure no one freaked out.
- All the code has been removed from the cart block theme functions. The appropriate bits of information are now passed in as arguments for theme functions to use as they please.
- The HTML and CSS used has been updated to make a little more sense... no more specifying element names in class names. How weird was that? Did I really know what I was doing when I first wrote those??

- A total list of the theme functions now includes:
theme_uc_cart_block_title() - themes the block title
theme_uc_cart_block_title_icon() - themes the cart icon in the block title
theme_uc_cart_block_content_cachable() - themes the cachable cart block contents... should not be used for any dynamic text!
theme_uc_cart_block_content() - themes the normal block contents
theme_uc_cart_block_items() - themes the collapsible list of items in the cart
theme_uc_cart_block_summary() - themes the summary of items in the cart with the total and view/checkout links - Removes generic uses of cache_clear_all() from core that were being used inappropriately to try and keep anonymous carts from caching "ghost" items.
Please test and review this patch, especially if you intend to be theming these components!
Please note: The original patch has been replaced with the latest patch from below, currently comment #2.
| Preview | Attachment | Size |
|---|---|---|
| uc_cart_block_rewrite.patch | 25.12 KB |


But we could do a lot better to make most things editable in CSS, to be able to drastically alter the look without needing to override the entire chunk. 
