This is my actual patch for the Price Display handler hook on which I got CA tests through my contrib in progress working. Includes a fallback function for the US.

The hook is totally open, my contrib can provide the whole output. This way I could solve all related stuff like suffixes and later currency conversion, but I am open to talk about as you usually have good reasons for a nope.

Hope the patch is generated ok. Tomorrow I'll post the other issues as far as I have them to provide you a better overview what this all means for ubercart.

For everybody who is not deep in: This patch alone does nothing as the function still is nowhere called. As I mentioned in the forums this way will need to replace every uc_currency_format() and replace $amount/$price by an object containing more information and separation of the item price an Qty.

TIA,

Al

Comments

rszrama’s picture

StatusFileSize
new1.94 KB
rszrama’s picture

Status: Active » Postponed (maintainer needs more info)

Alrighty, Al, so let's think about this a bit. Your idea is that every place that we currently use uc_currency_format() we would switch to using this new function? Where would multi-currency support come in?

Also, I'm not sure I understand checking for just $output[0]. Doesn't that mean that only a single module could implement hook_uc_price() and that any other modules would have their output ignored?

I like the idea of running prices through a system of modifications, but it seems like we need to anticipate more than one module wanting to plug into this.

Al01’s picture

StatusFileSize
new4.03 KB

Yes, this function would replace uc_currency_format() everywhere. Additional $price must get an object with more informations like $node->nid, $node->price, $qty and sth about "where we are" (if to display some suffix). Example patch for uc_product.module attached.
In general it works great, but e.g. in the cart view (with the block I am fine) I am still running into a wall as there are no detail informations anymore. I must check CA.

If there is no handler installed, you get the output as usual. This is working stable. As the design is now, TR would provide an alternative multi-currency handler for the US mode, I would call sth he provides or what I write. I was not totally sure about your interest in multi-currency. The other thing is that I believe there are just 2 needs for a display modifier: VAT and multi-currency. Everything else are price modifiers.

Does TR already work on a UC2.x version?

The design is now that the user has to decide for one handler which has full responsibility for the output. My suffix stuff has already now various options, will later optional call uc_currency_format() once more, even possibly in a different currency which I would cover without TR's contrib as this is not in his design. (Todays Slovak, later others need).

I thought about a specialized multi-currency hook at the end of uc_currency_format() for TR, modifying the value and changing the currency sign, which would keep things simple. My alternative would be total control what happens here. You are right that this is not finished. Multiple calls of hook_uc_price() sounds great, but might take me some time to get it working.

Do You have some concrete idea who else than VAT and multi-currency would need to modify the display value?

Al01’s picture

StatusFileSize
new8.07 KB

I am all the time convinced that this is the only way to solve VAT clean & other display issues like multi currency support.

A tax is a tax, independent if it is called "sales tax", "VAT", "GST" or whatever.
If to display it everywhere or just at checkout, is a display rule, not a price modifier rule.

However - the energy goes somewhere different, so I try to support what's going on.

For completeness I attached my latest version of this patch.

rszrama’s picture

Thanks for more code, Al. We had people working specifically on VAT issues at the code sprint in DC today. We're making progress, and I'll review this patch when I'm back in Louisville. : )

Al01’s picture

If the CA condition I heard about last night won't add taxes to the prices (also line-items) in the order, then this patch will be somewhere between postponed and obsolete. Multi currency support we can achieve also differently ;)

rszrama’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

I'm going to go ahead and mark this as a duplicate of the other patch where cha0s / Al have been working toward a solution:

#399586: cha0s' attempt to solve the VAT display stuff