uc_order currently renders product descriptions (in core this is the attributes ul list) using its own code and doesn't hook through hook_cart_item_description(). It's a simple fix to get around this but the hook name is no longer representative of what the hook does. I've created a patch to fix both of these things. Patch to follow.

Comments

sammys’s picture

Status: Active » Needs review
StatusFileSize
new6.72 KB

Patch attached.

sammys’s picture

Title: Make all product description generation use the same code » Use same code for all product description generation and hook_cart_item_description() renamed

Changed title so commit log and changelog will be more informative for contrib/third-party module developers.

Island Usurper’s picture

Status: Needs review » Needs work

That looks like a lot of logic to be put into a theme function. I'm not sure I want to subject designers to that (says the author of theme_uc_catalog_browse() :P).

Sammy's told me that he's thinking of splitting it into two layers, so we'll see how that pans out.

sammys’s picture

Status: Needs work » Needs review
StatusFileSize
new13.46 KB

Ok... here's the resulting patch.

fenstrat’s picture

Status: Needs review » Needs work

Excellent idea.

A couple of notes on the patch:

* Implementation of hook_cart_item_description().
is now
* Implementation of hook_product_description().

Need to remove:
//return '';
from the end of uc_product_get_description

Island Usurper’s picture

Status: Needs work » Needs review
StatusFileSize
new11.77 KB

Fixed issues mentioned in #5. I also found a way for check_plain() to be run twice on option names, so that's fixed.

I saw where the product is being put into the #product key of the description's attributes, but I think it makes more sense to pass the product directly as a parameter to drupal_alter(). I left #product alone though. Some other render alterer from higher up the tree may possibly need it.

sammys’s picture

Status: Needs review » Reviewed & tested by the community

Works fine on my testbed with the extensions I've made working too. RTBC!

Island Usurper’s picture

Status: Reviewed & tested by the community » Fixed

Is good. Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.