In the conditions table of a discount, the "value" does not use the value_format_callback function if it is available. Attached patch fixes this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

haffmans’s picture

Cleaned up patch a bit according to Drupal guidelines. Code is still the same.

psynaptic’s picture

Hi tszcheetah, Thanks a lot for the patch, but could you please give an example of what this patch fixes? The more details, the better.

haffmans’s picture

Go to admin/store/discounts/ and click one of the discounts. The "value" column in the conditions table contains unformatted values. For example, if you use the "Order total" condition, and you enter a dollar value (let's say 20), just the number is displayed in the conditions table. You would normally expect the dollar value (e.g. "$20") to be displayed. This patch fixed this - it only changes the output to that table.

I've also got a self-made discount module that stores IDs in the value, but I want it to display actual (user-friendly) names in the table instead.

If I'm not mistaken then the original uc_discounts module also formatted the value this way, but it got removed along the way (before the module got on drupal.org).

joachim’s picture

Status: Needs review » Postponed

Patch is fine, but the only place where it has an effect, uc_discounts_order_total_value_format, is using a hardcoded $. Localization FAIL!
So this needs to be fixed first: http://drupal.org/node/326403