SpyrosT Posted September 30, 2010 Share Posted September 30, 2010 Hi,Im trying to find a solution so that when a customer goes on the "Shipping" step of an orderthe system will ask him to switch to € Euro, which is the default currency, before the payment page.Something like the "I agree with the terms...." checkbox.The main reason Im asking for this is because of the currency convertion bug.I found a semi-solution by a Rocky's post but it does not work 100%.Many tnx. Link to comment Share on other sites More sharing options...
rocky Posted October 1, 2010 Share Posted October 1, 2010 Is it my post here that you tried? Link to comment Share on other sites More sharing options...
SpyrosT Posted October 1, 2010 Author Share Posted October 1, 2010 Yes Rocky, that's the code I put.It makes the job for COD and Wire payments (with a small bug)but it doesn't work for paypal since it's an external link.That's why I need something to switch in EURO one step before your code is switching currency.Tnx Link to comment Share on other sites More sharing options...
rocky Posted October 2, 2010 Share Posted October 2, 2010 Then trying adding this line to the displayCarrier() function: $cookie->id_currency = 2; Link to comment Share on other sites More sharing options...
SpyrosT Posted October 2, 2010 Author Share Posted October 2, 2010 You mean here right? /* 4 steps to the order */ switch (intval($step)) { case 1: displayAddress(); break; case 2: if(Tools::isSubmit('processAddress')) processAddress(); autoStep(2); displayCarrier(); break; case 3: if(Tools::isSubmit('processCarrier')) processCarrier(); autoStep(3); checkFreeOrder(); displayPayment(); break; default: $smarty->assign('errors', $errors); displaySummary(); break; } The code shall go between the () or anywhere else?And the number should be my currency id right? Link to comment Share on other sites More sharing options...
rocky Posted October 2, 2010 Share Posted October 2, 2010 No, after lines 315-318: /* Carrier step */ function displayCarrier() { global $smarty, $cart, $cookie, $defaultCountry, $link; Link to comment Share on other sites More sharing options...
SpyrosT Posted October 3, 2010 Author Share Posted October 3, 2010 Hey Rocky, it worked great, but I need one small function, if it's possible.As this auto-switching may be a bit confusing for the customers, I put an extra message just before the next button. {l s='**ATTENTION**'} {l s='On next step the currency will auto switch in EURO'} Is there a way so that this message will show up only if a customer is using otherthan the default currency? Link to comment Share on other sites More sharing options...
rocky Posted October 3, 2010 Share Posted October 3, 2010 It's difficult to display a message on the step before, because the customer may change the currency, so you would need to use Javascript to show or hide the message when the customer changes currency.I suggest that you instead just displayed a message after the currency was changed. To do that, use the following code in the displayCarrier() function: $smarty->assign('currencyChanged', intval($cookie->id_currency) != 2); $cookie->id_currency = 2; You should then be able to use the following in order-carrier.tpl: {if $currencyChanged} {l s='**ATTENTION**'} {l s='The currency was automatically switched to EURO for payment processing.'} {/if} The only problem is that the customer can change the currency back at any time. You might need to add the following to the displayPayment() function and possibly the payment modules too to ensure the currency is EUROS: $cookie->id_currency = 2; Link to comment Share on other sites More sharing options...
SpyrosT Posted October 4, 2010 Author Share Posted October 4, 2010 I forgot to tell you that the "attention currency...." message was insert in the order-carrier.tpl.That is why I put "the currency WILL auto-switch......" .If I change the message like you suggest then the customer will see that message but the currencywill still be USD or whatever.And because your attention message looks more "pro" the best way is to use it in the order-payment.tpl Link to comment Share on other sites More sharing options...
SpyrosT Posted October 11, 2010 Author Share Posted October 11, 2010 Hey Rocky, There is something wrong with the smarty assign code you gave me.Can you please check it. Link to comment Share on other sites More sharing options...
SpyrosT Posted October 18, 2010 Author Share Posted October 18, 2010 Hey Rocky,Sorry for asking the same thing twice, but can you please checkthe smarty assing code??It gives me a half blank page error.Tnx Link to comment Share on other sites More sharing options...
rocky Posted October 19, 2010 Share Posted October 19, 2010 I just tested the code on my v1.3.1 test site and it worked fine. I'm not sure why it isn't working for you. Try editing config/config.inc.php and temporarily changing 'display_errors' from 'off' to 'on' so you get an error message instead of a blank page. Post the error message here. Link to comment Share on other sites More sharing options...
SpyrosT Posted October 19, 2010 Author Share Posted October 19, 2010 Hey Rocky,I have a copy of my error log and this is what it gave me. PHP Fatal error: Smarty error: [in C:\Webs\......\DIGIWAY-CY.COM/themes/digi/order-carrier.tpl line 124]: syntax error: unclosed tag (opened line 116) I also had a copy of your code and I thing I found the error reason aftermatching those codes again.I missed the closing {/if} tag ;-)Thanks for your help!! Link to comment Share on other sites More sharing options...
dragon123 Posted December 7, 2011 Share Posted December 7, 2011 This worked for me in 1.4: // check currency of payment and force to Canadian dollar*********************** if ($currency_order->id != 4) { $cookie->id_currency = 4; $cart->id_currency = 4; $cart->update(); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now