Jump to content

Currency Block not working: Can't change currency?!?


Recommended Posts

Hi,

 

Somewhere after my store update to version 1.6.1 (not sure if this is related), I lost the ability to change the currency on the store.

 

What I already did:

 

1. Changed theme to default;

2. Disabled overrides;

3. Cleared caches and cookies;

4. Uninstalled/Installed Currency Block.

 

No results, so far. How far did I get:

 

1. On setCurrency() call, ajax call is returning 1... so I believe it's working that far.

2. The page is reloading, but the currency remains the same.

 

What I believe it's happening: Cookie is not being set!

 

In this function on ChangeCurrencyController.php, I believe something is not working (maybe the line before ajaxDie('1') where cookie is set):

 

public function initContent()
{
$currency = new Currency((int)Tools::getValue('id_currency'));
if (Validate::isLoadedObject($currency) && !$currency->deleted)
{
$this->context->cookie->id_currency = (int)$currency->id;
$this->ajaxDie('1');
}
$this->ajaxDie('0');
}

There's a friend's computer where the cookies weren't cleared since the last updates, where this is working. I believe he has a cookie that is updated on currency change. If I delete his cookies I guess it will stop working. Or is this nonsense?

 
Can someone give me a hand here?
 
Can it be something else that has nothing to do with the cookies?
 
Thanks,
Edited by hinteractive (see edit history)
Link to comment
Share on other sites

@El Patron: I'm afraid I can't post the URL yet. The site is still private and I don't have permission to post it. That's why I tried to be the most detailed as possible on my post.

 

I can add that I didn't find anything in the Javascript Console, but I do have a couple of warnings that I believe to be unrelated:

The "fb-root" div has not been created, auto-creating

jquery-1.11.0.min.js:3 GET http://mydomain.com/themes/cws/css/images/bx_loader.gif 404 (Not Found)
Given URL is not allowed by the Application configuration: One or more of the given URLs is not allowed by the App's settings.  It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

After deleting all the cookies, when I try to change currency, the site creates a cookie - however the currency doesn't change. When I retry to change the currency, the value in the cookie never changes. Unfortunately, the cookie value is encoded and unreadable.

 

 

If there's any idea of something that I could try to solve this, it would be appreciated, thanks. 

 

 

 

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

Thanks for your input, Muha.

 

I really didn't want to start all over, but if I have to, then I will.

 

When I have the time I'll try a new installation and will carefully add things until I find what's going on.

 

On an unrelated note, my pagination stopped working - it was loosing applied filters - because I removed the <b> tags on the buttons, which should be completely unrelated. I hope this is not something like that.

Link to comment
Share on other sites

I managed to get it working. What was wrong? I have no idea! :P

 

Here's what I did....

 

1. New Prestashop installation with all defaults;

2. Added some currencies (currency change working);

3. Added my customized theme (currency change working);

4. Added overrides (currency change working);

5. Updated the new database with an SQL dump I made from the old installation (currency change working).

 

What happened for it to stop working on the old instalation? Probably, the Prestashop upgrade messed up something! :P

In the process I also lost some CSS styling, which is weird.

 

It's very frustrating because you're building a web site and you think "ok, this is taken care of", but later down the road you have stuff that was working fine, suddenly gone to hell with no apparent reason! :(

 

So I spent hours chasing "gambusinos". ("Gambusinos" is a portuguese word that represents something that doesn't exist)

 

@Muha: I guess you'll have to do the same - new installation. Be careful not lose stuff, specially uploaded images - make a full backup of your site. Thanks for your help. Best of luck!

 

This is not working yet!

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

@Muha: Thanks for your input. Unfortunately my problem wasn't in there.

 

I'm using the default template, that I customized to my needs. But I finally found out what the problem was: You can't have the option "Set default country from browser language" turned to "Yes" on the backoffice. When you choose a different currency, the cookie is set for the new currency, but after that, the browser language is detected and Prestashop resets the cookie for the currency of that language.

 

I consider this a bug, because I might be in France but want to pay in pounds and it's impossible. Turning on the language detection is a nice customer service, but ultimately, the customer must be able to change his settings.

 

Well, for now it's working, it's just a shame that I had to spend so much time to figure it out.

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

  • 2 months later...

Hi guys, I was experiencing a similar problem where I could create a new currency but wasn't being saved, not even modifying the default one was doing anything until I turned the default country from browser language to NO. And this solved the issue, I was then able to create and modify currencies.

Link to comment
Share on other sites

In my case the problem was detected change in location -> Location Settings, then turn off Set the default browser language from the country and solved!

 

En mi caso el problema lo detecte cambiando en localización -> localización  luego en configuración desactivar la opción Establece el país predeterminado desde el idioma del navegador y solucionado!

 

 

post-847242-0-90285900-1445463298_thumb.png

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
  • 4 months later...
open config.inc.php

 

find these lines

 


if (defined('APS')) {

    $cookie->id_currency = Configuration::get('PS_CURRENCY_DEFAULT');

}


 

add // as below

 

 

//if (defined('APS')) {

    //$cookie->id_currency = Configuration::get('PS_CURRENCY_DEFAULT');

//}

 

 

adding the // in the lines above solved my issue

Link to comment
Share on other sites

×
×
  • Create New...