Jack_mcs Posted December 19, 2008 Share Posted December 19, 2008 (edited) This contribution allows a second currency to be displayed while still sending the default currency at checkout. This is important since some payment modules require payment in US funds. To accomplish that, the currency in the shop must be set to US prior to confirming the order, which makes it difficult for customers from different countries to realize what they are actually paying. With this contribution, both currencies can be displayed at various places in the shop, depending upon an admin setting, so that the customer always knows what he is paying. Jack Edited December 19, 2008 by Jack_mcs Quote 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...
fabian2005 Posted December 22, 2008 Share Posted December 22, 2008 great contribution, I have one problem !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> appears on my website http://www.urappearance.com Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 22, 2008 Author Share Posted December 22, 2008 Code appearing on the page usually means some control character is missing. So you probably missed a character while copying/pasting the code. Jack Quote 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...
bjcworks Posted December 23, 2008 Share Posted December 23, 2008 Great contribution Jack. I noticed a typo "$currecny" at line 175 of the install.txt for boxes/curriencies.php and also in the catalog/includes/boxes/curriencies.php: $activeCurrency = tep_not_null($currecny) ? $currency : $currency_alt; If you leave the spelling of $currecny as is $currency_alt will always be selected which displays correctly. If you correct the spelling of $currecny then $currency will always be selected (because of the settings in application_top.php) which doesn't display correctly. I have changed mine to $activeCurrency = tep_not_null($currency_alt) ? $currency_alt : $currency; What do you think? Byron Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 23, 2008 Author Share Posted December 23, 2008 Good catch. Thanks for pointing it out. Your code change is correct and will be added to the next version. Jack Quote 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...
bjcworks Posted December 27, 2008 Share Posted December 27, 2008 I have a question re the behaviour of the curriencies box. I have 2 currencies, CAD (default) and USD. When changing from CAD to USD in the currencies box, page displays change to USD. If you then click on a Category menu or What's New, the page displays change to USD (CAD). Is this the design intent? The code in question is in application_top.php if (isset($_GET['currency']) && $currencies->is_set($_GET['currency'])) { $currency = $_GET['currency']; $currency_alt = $_GET['currency']; } else { $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; if (! tep_not_null($currency_alt)) $currency_alt = $currency; } I changed my version to the following so that when changing from CAD to USD in the currencies box, page displays change to USD (CAD) immediately. if (isset($_GET['currency']) && $currencies->is_set($_GET['currency'])) { $currency_alt = $_GET['currency']; $currency = ($currency_alt != DEFAULT_CURRENCY) ? DEFAULT_CURRENCY : $currency_alt; } else { $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; if (! tep_not_null($currency_alt)) $currency_alt = $currency; } Please advise, Byron Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 27, 2008 Author Share Posted December 27, 2008 Are you asking if they both should be shown or did you want the order reversed? If the former, that is controlled by the setting in admin. For the latter, you would need to edit the code. Jack Quote 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...
bjcworks Posted December 27, 2008 Share Posted December 27, 2008 Are you asking if they both should be shown or did you want the order reversed? If the former, that is controlled by the setting in admin. For the latter, you would need to edit the code. Jack I didn't want the order reversed but rather the currency change to occur on the prices immediately if I was switching from CAD to USD, i.e. show as USD (CAD) rather than just USD. The original code required an additional action such as a display of a category to invoke a currency class function to display USD (CAD). My code change still works for the setting in admin. Regards, Byron Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 27, 2008 Author Share Posted December 27, 2008 As long as you only offer the two currencies, that shouldn't be a problem. But I didn't test your code change so you should run through an order and make sure everything works correctly. Jack Quote 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...
bjcworks Posted December 27, 2008 Share Posted December 27, 2008 As long as you only offer the two currencies, that shouldn't be a problem. But I didn't test your code change so you should run through an order and make sure everything works correctly. Jack I added the EUR currency for further testing and my code works fine through the life cycle of orders. I use SPPC Quantity Price Breaks and have made 2nd currency "title" and "display" changes to PriceFormatter, product_listing, shopping_cart, specials, whats_new, featured and associated boxes and had to make sure the formatting works throughout as well. Currency title and displays work correctly for all 3 modes, CAD, EUR, EUR(CAD) and any other currency set in admin. Byron Quote Link to comment Share on other sites More sharing options...
Guest Posted April 14, 2009 Share Posted April 14, 2009 Hi there awesome contribution but it seems I'm facing some issues! My default currency is Canadian dollars but I also wish to display US dollars at the same time. Once I installed this it seemed to be fine, once you log on to my site www.mygamingmart.com both prices appeared simultaneously Now if you log onto the site, ONLY prices in USD is shown, then if you change to Canadian dollar from the currency panel it ONLY shows CAD. THEN if you go click on "top" - it shows the DUAL prices! Very weird I want to make it so that when someone visits the site, BOTH currencies will be displayed at all time! Plz help! Thanks MR! Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted April 15, 2009 Author Share Posted April 15, 2009 Be sure all of the pages are listed in the option in admin. Jack Quote 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...
Guest Posted April 15, 2009 Share Posted April 15, 2009 Be sure all of the pages are listed in the option in admin. Jack Jack not sure what you mean by this - I thought the admin thing was for it NOT to show dual currency - I noticed in the default one it was "shopping_cart.php" Plz advise! Thanks Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted April 15, 2009 Author Share Posted April 15, 2009 I meant to say that if you have a page listed it won't show so be sure that only those pages are listed. Jack Quote 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...
Guest Posted April 22, 2009 Share Posted April 22, 2009 I meant to say that if you have a page listed it won't show so be sure that only those pages are listed. Jack Jack thanks always for the prompt replies, but I'm gonna have to trouble you again mate! :( It's not working, till I do all those steps on my site!! Now if you go into my site, it always shows US dollars as default currency, in order for your dual currency to work, someone has to choose CAD$ THEN go to "top" page - then it only starts to show dual currency! :( Let me explain what I wish for: As soon as someone logs onto my site, BOTH currencies should be displayed right off the bat - with CAD$ being Default and the US$ value displayed as the second one! Pls suggest! Thanks! Monty Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted April 23, 2009 Author Share Posted April 23, 2009 You could change the code in includes/application_top.php to pre-set that. It isn't something that would work in many shops since there are more than two currencies. But this might get you started. I haven't tested it. In includes/application_top.php, find $currency_alt = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } /***** End Second Currency *****/ and change to $currency_alt = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } $currency_alt = CAD; /***** End Second Currency *****/ Jack Quote 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...
Guest Posted April 23, 2009 Share Posted April 23, 2009 You could change the code in includes/application_top.php to pre-set that. It isn't something that would work in many shops since there are more than two currencies. But this might get you started. I haven't tested it. In includes/application_top.php, find $currency_alt = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } /***** End Second Currency *****/ and change to $currency_alt = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } $currency_alt = CAD; /***** End Second Currency *****/ Jack Fantastic tip! it is working now but one little problem has been created! The box where you choose currency now continually highlights the US Dollar one! I don't know why though!!! Because all the prices are in CAD!! any suggestions or should I just remove that box completely and keep your option!! Thanks a million Jack! cheers monty Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted April 23, 2009 Author Share Posted April 23, 2009 I don't see any reason to keep the infobox since both currencies are showing. That makes the infobox not work correctly and would confuse the customers. Jack Quote 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...
tunaslım Posted May 5, 2009 Share Posted May 5, 2009 Thanks Jack this contribution is very useful! Quote Link to comment Share on other sites More sharing options...
salimmohd82 Posted May 28, 2009 Share Posted May 28, 2009 Hi Jack , This is a great contribution I have used it myself. Thanks But i have a few doubts My Default currency is INR, and in admin->Configuration->My Store, set the "Switch To Default Language Currency" option to false. So the prices are shown in INR. What should i do to display the equivalent USD also. I need to display like this INR (USD) Thanks in advance Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted May 28, 2009 Author Share Posted May 28, 2009 You need to add USD as a currency. It should display that way then unless you have the pages excluded in the settings of this contribution. Jack Quote 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...
salimmohd82 Posted May 29, 2009 Share Posted May 29, 2009 Thank you Jack for your quick reply. Actually i dint tell the full story here. I already had added USD in my store as a second currency. Since my default currency is INR all the prices are shown in INR when the site is loaded first time. I want to show INR(USD) when site is loaded first time. But when i switch the currency from INR to USD from the currencies dropdown it shows both. That is like this INR (USD). Is there any way to show both like this INR (USD) when the site is loaded for the first time. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted May 29, 2009 Author Share Posted May 29, 2009 Hmm, I realize this is a very long thread but if you start at the beginning and read through it, you may find the answer. Jack Quote 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...
Kummi Posted October 26, 2009 Share Posted October 26, 2009 Hmm, I realize this is a very long thread but if you start at the beginning and read through it, you may find the answer. Jack Hello Jack, Nice contrib, i habe only one problem: I cant't see in admin> admin->Configuration->My Store, set the "Switch To Default Language Currency" option. Your Install Sql script : TABLE `orders` ADD `currency_alt` CHAR( 3 ) NULL AFTER `currency` ; ALTER TABLE `orders` ADD `currency_value_alt` DECIMAL( 14, 6 ) NULL AFTER `currency_value` ; INSERT INTO `configuration_group` ( `configuration_group_id` , `configuration_group_title` , `configuration_group_description` , `sort_order` , `visible` ) VALUES ('544', 'Second Currency', 'Second Currency site wide options', '30' , '1'); INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, use_function) VALUES (NULL,'Disable Dual Display on these pages', 'SECOND_CURRENCY_DISABLE_DISPLAY', 'shopping_cart.php', 'Enter a comma separated list of the files that should not display both currencies.', '544', '10', NULL, now(), NULL); I cant see this option! Regards Kummi :huh: Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 26, 2009 Author Share Posted October 26, 2009 If you didn't get an error when making the database changes, then you will need to search your database to see what the problem is. If it did fail, it is probably due to configuration group ID being a duplicate. In that case, change the 544 to something else and try again. Quote 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...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.