I was just thinking that I still like using uc_currency_format() to straight format a price, but I don't want to be doing things outside of the price handler system. So, I wonder if that func should be turned into a wrapper that takes care of simply returning the formatted original price for display? Or did we already do that and I've forgotten? : P

CommentFileSizeAuthor
#4 467632_uc_currency_format.patch1.26 KBIsland Usurper

Comments

tr’s picture

That sounds like a good idea, for the following reason:

Most contributed code still uses uc_currency_format(). There is not yet documentation for uc_price(). So, it's going to be a while, maybe a long while, before all the modules out there get converted over to using uc_price(). Until then, price handlers will not be able to affect prices generated by these modules.

In addition to contributed modules, people may be using uc_currency_format() in theme function overrides or templates. Price handlers aren't able to touch those either.

The price handler system isn't useful unless it can alter/format *all* prices, and it seems the only way to do this while keeping Ubercart compatible with existing code is to make uc_currency_format() a wrapper for uc_price().

rszrama’s picture

Issue tags: +price, +ubercamp sprint
rszrama’s picture

Island Usurper’s picture

Status: Active » Needs review
StatusFileSize
new1.26 KB

This will really only work for the price alterers that don't care what type of price it is because there isn't any extra information about it available. So if themers are displaying a price that's more than just a basic amount, I'd still encourage them to use uc_price() with appropriate $context.

rszrama’s picture

Status: Needs review » Fixed

Don't think this needs any additional testing... worked fine embedded in a test page on the Livetest.

Committed!

torgospizza’s picture

Thanks, Ryan! Just wanted to mention my quick support for this. While moving our stuff to D6 I noticed that $node->sell_price in my product.tpl file showed "0.990" - which ignores our "2 decimal places" setting. Didn't want to use uc_price() since I'm still unfamiliar with it. But using uc_currency_format($node->sell_price) worked like a charm - especially when, for building our theme, that's really all we need. Thanks for keeping it in :)

rszrama’s picture

Hoorah. : D

We're also extending the support for the "decimal places" setting a bit, too, so that should help you.

Status: Fixed » Closed (fixed)
Issue tags: -Release blocker, -price

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