♥Tsimi Posted May 26, 2014 Share Posted May 26, 2014 Hi My current shop setup allows the customer to choose the currency in which he wants to browse the shop. osC does not offer default currency checkout. Meaning, if your shop accepts US Dollar as default but the customer sets the currency to GBP then he can checkout in GBP currency. Now how to force the system to change to the default currency when checking out no matter what the customer chose as currency and will it show also on the invoice later on? The other thing is I would like to show "both" currencies inside the product_info.php file. The default currency and the currency the customer chose and inside brackets ( ). Same for the checkout confirmation page. Something similar done in this shop. (not an osC store i think) Sample Shop Their default currency is US Dollar. Now choose a different currency and browse through their store. View a products detail and add an item in the cart then you know what i meant. When the products are listed (product_listing) then only one currency is visible which would be OK. THAT is how i would like to setup the store. But how to do it? Link to comment Share on other sites More sharing options...
Jack_mcs Posted May 26, 2014 Share Posted May 26, 2014 For resetting to the default currency, set the "Switch To Default Language Currency" setting in admin to true. For the multiple currencies, see my Second Currency addon. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
♥Tsimi Posted May 26, 2014 Author Share Posted May 26, 2014 @@Jack_mcs Thank you for your quick answer Jack! :thumbsup: An add-on with your name = satisfaction guaranteed Just one quick question. Why set Switch To Default Language Currency to true?? Link to comment Share on other sites More sharing options...
Jack_mcs Posted May 26, 2014 Share Posted May 26, 2014 Because you said, "Now how to force the system to change to the default currency when checking out..." That's what that setting will do. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
♥Tsimi Posted May 26, 2014 Author Share Posted May 26, 2014 Doesn't that mean that it would take the currency that is set inside the *language*.php? So if a customer browse the shop in German and checksout the currency would change to euro. Or am I misunderstanding something here? I setup Japanese Yen as default currency in the admin area. With English as default language. Now i want the customer to browse the store in any currency he likes but when checking out the default currency should be Japanese Yen only. Additional to that I would like to show the currency that the customer chose before going in the checkout inside the checkout confirmation page, shopping cart, product info and the invoice as the sample shop i linked above does. I think your add-on does that or at least in the front end area it does. Don't know about the invoice yet though. Link to comment Share on other sites More sharing options...
Jack_mcs Posted May 26, 2014 Share Posted May 26, 2014 It causes the currency to switch to the default on when checking out. See here. Or just switch to a non-default currency and place an order to see how it switches back. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
♥Tsimi Posted May 26, 2014 Author Share Posted May 26, 2014 Thanks Jack. :thumbsup: Link to comment Share on other sites More sharing options...
AngusD Posted May 26, 2014 Share Posted May 26, 2014 @@Jack_mcs : Hi, no, it doesn't. This setting changes the currency depending on the language. If your store supports different languages, this setting changes to the currency you've set in the language-file, instead of the default store currency. If your store uses only one language, this setting will always jump back to the currency in the language-file, no matter which currency you select. AD Link to comment Share on other sites More sharing options...
♥Tsimi Posted May 26, 2014 Author Share Posted May 26, 2014 @@Jack_mcs : Hi, no, it doesn't. This setting changes the currency depending on the language. If your store supports different languages, this setting changes to the currency you've set in the language-file, instead of the default store currency. If your store uses only one language, this setting will always jump back to the currency in the language-file, no matter which currency you select. AD Thanks for confirming what i was thinking. That is what i thought too. That's why my question... So how to keep the default currency when checking out no matter what language? And by default currency i mean the one that YOU/I can choose inside the admin area under "Localization -> Currencies" or would it be easier if i just change the language files to the currency i would like to have as default?? And then set "Switch To Default Language Currency" = true?? Link to comment Share on other sites More sharing options...
burt Posted May 26, 2014 Share Posted May 26, 2014 $currency = DEFAULT_CURRENCY; Have not thought about it at all, that might enforce your default currency, try adding it at the top of checkout_shipping after require('includes/application_top.php'); Link to comment Share on other sites More sharing options...
♥Tsimi Posted May 26, 2014 Author Share Posted May 26, 2014 Hi burt Many thanks i'll try that. Does this has to be added only in one file or do i have to add the piece of code to all checkout files or any file that i would like to have that default currency? Link to comment Share on other sites More sharing options...
♥Tsimi Posted May 26, 2014 Author Share Posted May 26, 2014 Burt's code worked like a charm. Thanks! :thumbsup: Link to comment Share on other sites More sharing options...
AngusD Posted May 26, 2014 Share Posted May 26, 2014 $currency = DEFAULT_CURRENCY; Have not thought about it at all, that might enforce your default currency, try adding it at the top of checkout_shipping after require('includes/application_top.php'); Hi, adding this line to the checkout_shipping-script doesn't prevent a currency change in checkout_payment-script, i.e. I would enforce this in the application_top.php. // currency if (substr(basename($PHP_SELF), 0, 8) != 'checkout') { //Are we in one of the checkout-scripts? No, continue like nothing happend. if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) { if (!tep_session_is_registered('currency')) tep_session_register('currency'); if (isset($HTTP_GET_VARS['currency']) && $currencies->is_set($HTTP_GET_VARS['currency'])) { $currency = $HTTP_GET_VARS['currency']; } else { $currency = ((USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && $currencies->is_set(LANGUAGE_CURRENCY)) ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } } }else{ //Yes, switch to the default currency. if (!tep_session_is_registered('currency')) tep_session_register('currency'); $currency = DEFAULT_CURRENCY; } Maybe a bit overkill, but so I don't have to change the checkout-scripts. AD Link to comment Share on other sites More sharing options...
♥Tsimi Posted May 26, 2014 Author Share Posted May 26, 2014 wow AD thanks for that! what would/could be the downside of not having the default currency inside the checkout payment? I mean there is no price showing as far i know. I have COD, bank transfer and PayPal, none of them show a price. At the end (checkout confirmation page) i can see the correct total price in the default currency. Need to try PayPal (sandbox) just to make sure that the currency is transfered correctly to PP. Link to comment Share on other sites More sharing options...
burt Posted May 26, 2014 Share Posted May 26, 2014 So far as I recall, and I may very well be wrong, there is no way to change the currency once inside the checkout procedure (other than by tacking &language=xy onto the URL). That's definitely how it used to be, it's not an area i've looked at in recent versioning. Link to comment Share on other sites More sharing options...
greasemonkey Posted May 26, 2014 Share Posted May 26, 2014 I'm definitely no expert, so I'm not sure how correct it is... However, in catalog/includes/classes/order.php I use; //CAD Currency if Canada if($customer_address['countries_id'] == 223) { $currency = 'USD'; } elseif($customer_address['countries_id'] == 172) { $currency = 'USD'; } elseif($customer_address['countries_id'] == 38) { $currency = 'CAD'; } else { $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } //EOF CAD currency if Canada to force currency to USD if in the USA... Everyone else is forced to CAD. All happens at checkout_shipping.... You could easily modify to do as you require (if it is indeed correct). Link to comment Share on other sites More sharing options...
AngusD Posted May 26, 2014 Share Posted May 26, 2014 @@burt : Yes, that's what I meant. If you add "¤cy=xy" to the URL you would change the currency even in the checkout-scripts. The modification I posted prevents this. @@Tsimi : My store always displays the price on checkout_payment and checkout_confirmation. I don't know if there was a change (still using 2.2RC, update to 2.3.3.4 pending), but my PayPal payment-module would send the selected currency and the price in that currency to PayPal, not the default currency and the default price. That's why I modified the piece of code in the application_top-script. AD Link to comment Share on other sites More sharing options...
Bob Terveuren Posted May 26, 2014 Share Posted May 26, 2014 Hi Here's a rough idea of how to go about displaying the approximate currency relations on product_info.php 1) edit product_info.php and change the mention of $currencies->display_price to $currencies->display_product_price 2) edit includes/classes/currencies.php by adding this new function before the final curly bracket //BT new stuff function display_product_price($products_price, $products_tax, $quantity = 1) { $display_me=''; //get all the store currencies and bung them in an array $currencies_query = tep_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES); while ($currencies = tep_db_fetch_array($currencies_query)) { $display_me.=$this->format($this->calculate_price($products_price, $products_tax, $quantity),true,$currencies['code'],$currencies['value']); $display_me.=' ';//spacer or CR LF or whatever } return $display_me; } //BT end That will generate a display of the different values in the store - edit the line to display whatever you want <br /> etc etc $display_me.=' ';//spacer or CR LF or whatever You can change that display thoughout the store by altering the name of $currencies->display_price to $currencies->display_product_price You would need to enforce checkout currency as YEN to stop an unscrupulous customer from switching currencies using the URL (and hide the currencies box!) Burts suggestion would work here. Make sure that your currency exchange rates are up to date too Jack_mcs has a cron add_on that does this for you here Multi currency is a PiTA - see here Link to comment Share on other sites More sharing options...
♥Tsimi Posted May 28, 2014 Author Share Posted May 28, 2014 Thank you guys! I will take a look at every answer and see what i can put together. Link to comment Share on other sites More sharing options...
♥Tsimi Posted September 11, 2014 Author Share Posted September 11, 2014 I was trying to add more currencies to my shop so that the customer can choose which currency he wants to browse the shop with. My default currency is Japanese Yen. And i added these currencies: USD (US Dollar) GBP (Pounds) EUR (Euro) CAD (Canadian Dollar) CHF (Swiss Franc) Product with default price is Item XYZ 1200 Yen USD = 11.22 GBP = 6.98 EUR = 8.69 CAD = 12.30 CHF = 10,53 I don't know about USD, EUR, GBP and CAD but in CHF (Swiss Franc) there is no 0,53 or 0,59 there is 0,50 or 0,55 or 0,60 but nothing in between. It would be great to have the currencies round up/down to nice numbers like this USD = 11.20 GBP = 7.00 EUR = 8.70 CAD = 12.30 CHF = 10,55 Can this be done? If so where? And how? Kind regards Lambros Link to comment Share on other sites More sharing options...
♥Tsimi Posted September 11, 2014 Author Share Posted September 11, 2014 It's been a while but I found time to look into this matter again and tried out all codes and also Jack's Second Currency Add-on. @@Bob Terveuren Your code works on a vanilla osC shop but mine is a bit modified and therefore it didn't work out (yet) so I tried it out on a fresh 2.3.4 shop. Your code makes other currencies show which is great if you have let's say 2 currencies (default and second). If you add 5 currencies it lists all 5. But code wise very easy to add and it would be great if it could recognize only the selected currency and show that one next to the default one. So if I choose EUR it shows JPY and EUR, if I choose USD it shows only JPY and USD. Something like that.... Jacks Add-on didn't work for me. I was surprised how many files needed to be edited. Seems like it is not a common thing around shop owners to show two currencies in a shop therefore very few info is available. There are a lot threads regarding rounding issues though...but not display currency like I want. Anyway,...more digging to do i guess.... Kind regards Lambros Link to comment Share on other sites More sharing options...
De Dokta Posted September 11, 2014 Share Posted September 11, 2014 My default currency is Japanese Yen. And i added these currencies: USD (US Dollar) GBP (Pounds) EUR (Euro) CAD (Canadian Dollar) CHF (Swiss Franc) Product with default price is Item XYZ 1200 Yen USD = 11.22 GBP = 6.98 EUR = 8.69 CAD = 12.30 CHF = 10,53 I don't know about USD, EUR, GBP and CAD but in CHF (Swiss Franc) there is no 0,53 or 0,59 there is 0,50 or 0,55 or 0,60 but nothing in between. It would be great to have the currencies round up/down to nice numbers like this USD = 11.20 GBP = 7.00 EUR = 8.70 CAD = 12.30 CHF = 10,55 Can this be done? If so where? And how? Kind regards Lambros Hi Lambros, da war mal was: http://forums.oscommerce.de/topic/81382-runden-in-einem-osc-233/ Gruß J.J. Link to comment Share on other sites More sharing options...
♥Tsimi Posted September 11, 2014 Author Share Posted September 11, 2014 Danke dir J.J.! I knew the german forum might have something, was just to lazy to look. :blush: Link to comment Share on other sites More sharing options...
♥Tsimi Posted September 12, 2014 Author Share Posted September 12, 2014 I put something together and it does what i wished. So if anyone needs this i attached a zip file that contains the sql file and the install text file. Very simple to install no big thing. I also attached few images so you see what it looks like. File: Second Currency for 2.3.3.4 and 2.3.4.zip Screenshots: A big THANK YOU to the following gentlemen. burtDe DoktaAngusDBob Terveuren Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.