Jump to content

Add Currency Selector on the payment step - PS 1.7


Recommended Posts

Hello. I need to add a currency selector on the payment step, that is the fourth step on the native PS 1.7 checkout. (some people call this a one step checkout but is clearly divided in four parts)

Currently, i'm trying to reuse the ps_currencyselector free module. This native PS module works by POST request with the parameters "SubmitCurrency=...&id_currency=...".

The problem is that when the user changes the currency, the page is refreshed and it goes back to the second step (delivery address). Maybe this behavior makes sense in general (if not a bug...), because the third step could involve a carrier with different costs or something like that. I noted that if the currency selected is the same as the current one, after page reload it will be still in step four which is the behavior i expect. 

Anyway, in my case there should be no need to go two steps back. This is annoying for the user. I wonder if currency change could be done completely by ajax without page refresh. Any idea if this could be doable?.

At least, i expect the checkout to be in the same step after a page refresh. Where does PS process the "SubmitCurrency" option?.

Thanks

Link to comment
Share on other sites

12 hours ago, ComGrafPL said:

Isnt better add currency selector at the top of the page? Before checkout. It is better for clients. Probably refreshing because of currency is bound to specific countries. Not sure tho.

One thing is the currency in which you see the prices. Another thing is the currency you actually use to buy. In the country where this project operates, people usually see prices in dollars (because merchant's suppliers sell in dollars), but then usually (not always) pay in the local country currency. Of course, to buy in dollars is also possible (... and more convenient from the customer point of view, as there is no exchange of currency). 

If the selector is at the top of the page or not is not really that important, the problem is after refreshing the page it goes back two steps.

Link to comment
Share on other sites

On 1/29/2022 at 5:39 PM, El Patron said:

Get geo targeting pro module, use maxmind commercia db.  Set country default curriecies you want to use.  They will then be served their currency.

Note: currency selector should be in footer same with language, this is current best practice.

 

Also please do not double post. The other was hidden.

Well, thank for the suggestion but it seems overkill for the task. Just a little tweak should be enough for this.

On 1/29/2022 at 10:40 PM, luishuaymana said:

add your web link ... version of Prestashop ... theme of your website .. in order to help you 

Currently under development. I'm using PS 1.7.8.1 with default theme. 

It would be great to hear some pointers to where to look at in PS codebase.

Right now, I'm studying the FrontController.php file. In this file, the init() function have this line (384):

...
$currency = Tools::setCurrency($this->context->cookie);
...

Later in the same function, we have this condition (415):

if ( ... $currency->id != $cart->id_currency) {
    ...
    $cart->update();
}

Which could explain why if the selected currency is the same as the current one, the checkout behaves differently (stay in the same step) than otherwise.

However... this function is insanely long and surely will take me some time before i really understand what is going on.

Edited by jesg (see edit history)
Link to comment
Share on other sites

8 hours ago, jesg said:

Well, thank for the suggestion but it seems overkill for the task. Just a little tweak should be enough for this.

Currently under development. I'm using PS 1.7.8.1 with default theme. 

It would be great to hear some pointers to where to look at in PS codebase.

Right now, I'm studying the FrontController.php file. In this file, the init() function have this line (384):

...
$currency = Tools::setCurrency($this->context->cookie);
...

Later in the same function, we have this condition (415):

if ( ... $currency->id != $cart->id_currency) {
    ...
    $cart->update();
}

Which could explain why if the selected currency is the same as the current one, the checkout behaves differently (stay in the same step) than otherwise.

However... this function is insanely long and surely will take me some time before i really understand what is going on.

Overkill?  It's how it's done correctly if you want a professional shop.   It's not a little tweak if you cannot do it yourself.

Link to comment
Share on other sites

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...