My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 81: Currency
3 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Aug 2008


 
Reported by sujoyk...@gmail.com, May 3, 2008
Substruct needs an entry in preference to set the currency to be used
throughout the application.

At present, currency is in $.  And to change the currency, you need to 
provide extra option :unit to number_to_currency ActionView method.

There was an introduction of a new helper method "sub_number_to_currency". 
I had tried to insert a new currency here. But this method is not used at
all places, so i had to go to each .rhml view pages and change
number_to_currency to sub_number_to_currency.

But, even if you use this method, it will not work on
order_mailer/_order.html view. Rails seems to be throwing error that it can
not find sub_number_to_currency

Also, on the PayPal page, the currency doesn't get send from Substruct.

Considering this point, i will suggest that, on "Preference" page of
Administrator panel, two field are required

1)Currency Code (like GBP, USD, )
2)Currency Symbol (like $,£ )

Currency Symbol will be used when displaying product price and Currency
Code will be used in orders, PayPal (,CC_PROCESSOR ?)


This little bit of addition will make life more easy with currency :)
May 5, 2008
Project Member #1 subim...@gmail.com
Sounds good, someone submit a patch.
Status: Accepted
Jun 19, 2008
#2 ruethoma...@gmail.com
Warning: In certains controllers & views, some 'USD' texts are still right in the code.

We prefer to use the plug-ins Globalite for localization. Currency are corrected automatically depending on a 
setting in environment.rb and error messages & dates are translated also.




Jun 28, 2008
#3 edmundo...@gmail.com
Follows a patch and the location of all changes if someone has a better idea to
modify it.

I just changed all places to use sub_number_to_currency and did not created any
preference, with this patch the method can be given default options to be customized.


Changed:

Change $ to sub_number_to_currency()
./vendor/plugins/substruct/app/views/admin/orders/edit.rhtml:146:

Change number_to_currency() to sub_number_to_currency()
./vendor/plugins/substruct/app/views/orders_mailer/_order.rhtml:41:
./vendor/plugins/substruct/app/views/orders_mailer/_order.rhtml:42:
./vendor/plugins/substruct/app/views/orders_mailer/_order.rhtml:48:
./vendor/plugins/substruct/app/views/orders_mailer/_order.rhtml:50:
./vendor/plugins/substruct/app/views/store/show_cart.rhtml:2:
./vendor/plugins/substruct/app/views/store/show_cart.rhtml:63:
./vendor/plugins/substruct/app/views/store/show_cart.rhtml:65:
./vendor/plugins/substruct/app/views/store/show_cart.rhtml:87:
./vendor/plugins/substruct/app/views/store/_cart_contents.rhtml:11:
./vendor/plugins/substruct/app/views/store/_cart_contents.rhtml:14:
./vendor/plugins/substruct/app/views/store/_cart_contents.rhtml:25:
./vendor/plugins/substruct/app/views/store/_cart_contents.rhtml:31:
./vendor/plugins/substruct/app/views/store/_cart_contents.rhtml:36:
./vendor/plugins/substruct/app/views/store/_big_totals.rhtml:18:
./vendor/plugins/substruct/app/views/store/_big_totals.rhtml:22:
./vendor/plugins/substruct/app/views/store/_big_totals.rhtml:26:
./vendor/plugins/substruct/app/views/store/display_product.rhtml:3:
./vendor/plugins/substruct/app/views/store/select_shipping_method.rhtml:13:
./vendor/plugins/substruct/app/views/store/select_shipping_method.rhtml:15:
./vendor/plugins/substruct/app/views/store/_cart.rhtml:13:
./vendor/plugins/substruct/app/views/store/_cart.rhtml:44:
./vendor/plugins/substruct/app/views/store/show.rhtml:85:
./vendor/plugins/substruct/app/views/admin/promotions/show_orders.rhtml:30:
./vendor/plugins/substruct/app/views/admin/promotions/list.rhtml:48:
./vendor/plugins/substruct/app/views/admin/promotions/list.rhtml:54:
./vendor/plugins/substruct/app/views/admin/products/list.rhtml:34:
./vendor/plugins/substruct/app/views/admin/orders/list.rhtml:68:
./vendor/plugins/substruct/app/views/admin/orders/edit.rhtml:88:
./vendor/plugins/substruct/app/views/admin/orders/edit.rhtml:135:
./vendor/plugins/substruct/app/views/admin/orders/edit.rhtml:137:
./vendor/plugins/substruct/app/views/admin/orders/show.rhtml:79:
./vendor/plugins/substruct/app/views/admin/orders/show.rhtml:82:
./vendor/plugins/substruct/app/views/admin/orders/show.rhtml:95:
./vendor/plugins/substruct/app/views/admin/orders/show.rhtml:99:
./vendor/plugins/substruct/app/views/admin/orders/totals.rhtml:34:
./vendor/plugins/substruct/app/views/admin/orders/totals.rhtml:35:
./vendor/plugins/substruct/app/views/admin/orders/totals.rhtml:36:
./vendor/plugins/substruct/app/views/admin/orders/totals.rhtml:42:
./vendor/plugins/substruct/app/views/admin/orders/totals.rhtml:43:
./vendor/plugins/substruct/app/views/admin/orders/totals.rhtml:44:
./vendor/plugins/substruct/app/views/customers/orders.rhtml:24:
./vendor/plugins/substruct/app/helpers/application_helper.rb:21:
./vendor/plugins/substruct/app/helpers/application_helper.rb:29:
./vendor/plugins/substruct/app/helpers/application_helper.rb:33:

Change US to nothing
./vendor/plugins/substruct/app/helpers/application_helper.rb:59:

Change USD to sub_number_to_currency()
./vendor/plugins/substruct/app/views/admin/preferences/_shipping_type.rhtml:30:
./vendor/plugins/substruct/app/views/admin/preferences/_shipping_variation.rhtml:30:
./vendor/plugins/substruct/app/views/admin/promotions/_form.rhtml:63:
./vendor/plugins/substruct/app/views/admin/products/_form.rhtml:20:
./vendor/plugins/substruct/app/views/admin/products/_variation.rhtml:15:

use_always_sub_number_to_currency.patch
23.0 KB   View   Download
Jun 28, 2008
#4 edmundo...@gmail.com
One more thing, the mailer model needs to use the application helper, just add the line:
helper :application

Jun 29, 2008
#5 sujoyk...@gmail.com
awesome! 
Jun 29, 2008
#6 edmundo...@gmail.com
Another thing these three entries was modified but in other lines, the patch is right:

./vendor/plugins/substruct/app/helpers/application_helper.rb:27:
./vendor/plugins/substruct/app/helpers/application_helper.rb:30:
./vendor/plugins/substruct/app/helpers/application_helper.rb:31:
Aug 11, 2008
Project Member #7 subim...@gmail.com
Thanks for the patch. Cleaned it up a little bit, and the result is in r111 and r112
Status: Fixed
Mar 10, 2009
#8 alanom...@gmail.com
To clarify for other newbies like me, as of revision 112, the (best?) way to change
currencies in Substruct is:

1: Change the symbol displayed to customers in all views at once. 
Edit :unit in application_helper.rb, def sub_number_to_currency.

2: (if using PayPal) Change the currency submitted to PayPal with each order. 
Add the following to /views/store/confirm_order.rhtml, right after <form action="<%=
@paypal_url %>" method="POST"> with your currency code instead of GBP:

<input type="hidden" name="currency_code" value="GBP">

Powered by Google Project Hosting