I have a store where the only relevant currency for payment will be user points. Therefore I only want users to see the prices of products in points.

I thought setting this would be all I needed to do:
Display currency, points, or both: Points

The points are displayed on the product node pages, but everywhere else including the invoices, product listings (views), and emails sent to the users the prices are listed in $ currency.

I tried creating a custom price_handler callback to override the formatting options but it only works if this bug I found in uc_price.inc is fixed:
#956528: Custom price_handler options don't work

For the moment I ended up changing the currency symbol from '$' to ' Points' and ticked the box that places it after the price. Dirty hack but it works everywhere. However, it always has to be plural so we can't make anything cost 1 Point, and I presume it is not translatable.

Also related, the part of this module that actually does replace the $ price with points on a product page - uc_userpoints_payment_nodeapi - directly overwrites the node contents with e.g. 'Points: 10' so there is no chance to theme or alter it.

Comments

codi’s picture

Did you create your own module for the custom price handler? Or did you add it to the userpoints_ubercart module?

mr.j’s picture

I tried both. It works in either, as long as the bug in uc_price.inc I linked to is fixed.
I think the module should be doing it that way instead of the direct $node overwrite that it is now doing.

mwangi’s picture

I'd want to have both prices in cash and points but have nowhere to start.

I've already set up multicurrency and its working ok - is it possible to add points as a price. is there an easy way to do this?

torgosPizza’s picture

Check settings here:admin/settings/userpoints (under Ubercart Payment Options). If you don't have the Userpoints Payment module enabled, you need to do so.

Make sure you are printing the correct "add to cart" content in your node's template file, if your theme is customized.

Finally, check out the bug I mention here. Will create a separate Issue thread for that asap.
http://drupal.org/node/555328#comment-3767300

bmagistro’s picture

Status: Active » Postponed

I am going to mark this as postponed for now. After a little bit of looking at other issues out there that relate to how prices are displayed/handled within ubercart I think this one will need to wait a little bit. If I missed a newer discussion where this is now available in the 2.x release please let me know.

@mr.j, Ideally the setting you mention would have been all you needed to change but as you've noticed there are places where it does not change anything...

mr.j’s picture

Just a note we ended up completely deleting the uc_userpoints_payment_nodeapi function because of the way it was directly overwriting the themed prices on a node object.

If you use the solution that I mentioned above and change the currency symbol from $ to ' Points' then by the time uc_userpoints_payment_nodeapi is hit the prices are already formatted like "Price: 200 Points" which is what we want, but then this module overwrites them with "Points: 300" and you can't theme it. Easiest solution was to delete the function.

torgosPizza’s picture

Interesting that the hook_nodeapi() call doesn't put it out to a theme function? Sounds like a good patch candidate.

mr.j’s picture

I received a couple of emails on this so here is a simple summary of how you can use points instead of $ prices everywhere:

At /admin/settings/userpoints > Ubercart Payment Options:
- Points per currency unit: 1 <--- makes it easy to substitute points for dollars/pounds/whatever
- Display currency, points, or both: Points

These settings work around the bug in this issue:

At /admin/store/settings/store/edit/format > Currency format:
- Currency sign: ' Points' <--- put the name of your points there, including a space before
- Display currency sign after amount: Checked <--- Ensures prices will be like '35 Points'

Optional: the default ubercart price theme functions now output something like "Price: 35 Points". However this module will then go and change that to "Points: 35" when hook_nodeapi is called, and you can't theme or alter it. So to stop that from happening:
- Comment out the whole uc_userpoints_payment_nodeapi function in uc_userpoints_payment.module

atin81’s picture

Does anyone know how can I make views display the sell price on userpoints instead on currency¿?