Jump to content

[Solved]Switch to default currency on Shipping step of an order


SpyrosT

Recommended Posts

Hi,

Im trying to find a solution so that when a customer goes on the "Shipping" step of an order
the 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

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

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

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 other
than the default currency?

Link to comment
Share on other sites

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

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 currency
will 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

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

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 after
matching those codes again.
I missed the closing {/if} tag ;-)

Thanks for your help!!

Link to comment
Share on other sites

  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...