Closed Rekords closed 9 years ago
See the answer to this issue:
I tried that. It does'nt work. The thing is that I have an extension that detects the IP and sets language and currency, but this page cache extension overrules that extension and forces the default even from a guest with an IP from another country.
I would think that theres a simple way to just remove everything in this page cache extension about language and currency? Or to make it skip cache for language and currency? So that my ip location extension will work.
but this page cache extension overrules that extension and forces the default even from a guest with an IP from another country.
The base part that you're missing is that the whole point of a page cache is NOT to run the opencart code, but rather, to serve a cached page.
You're basically asking me to change the page cache so that it runs opencart code, even when a cached page exists. That would defeat the whole purpose of a page cache.
What you would actually need to do is to pull the ip detection / set language currency functionality OUT of opencart, and into some place where the page cache could see it.
It's the same problem as, for example, putting a non-opencart php file into the opencart directory. It wouldn't be able to see things that an opencart module was doing either.
If you could pull the functionality up to the very top of your opencart index.php file, it may work, assuming that it does the things that the pagecache module is looking for, like setting the session variables for language and currency...before the pagecache code runs.
Okay, I see. I was thinking that it might be able to run some of the page cached but load language and currency everytime. So I will try your other methods.
To be honest I don't know how to do either of them, but your second method seems to be the easier way.
It's a vqmod that changes catalog/controller/module/currency.php and language.php :
if (!isset($this->session->data['ip2location_currency'])) { $this->load->model('tool/ip2location'); $currency = $this->model_tool_ip2location->lookupCurrency(); if (isset($currency)) { $this->currency->set($currency); $this->session->data['ip2location_currency'] = $currency; header('Location: '.html_entity_decode($_SERVER['REQUEST_URI'])); } }
I don't know how I would be able to make that run in the top of the index? I see a Language and a Currency part of the index.php, would I just need to pull that all the way to the top? I'm sorry for being helpless, I've just had some problems with my webshop being very slow and this page cache helps a ton, so I really want it to work with the detection extension.
Sorry, this isn't really something we can help much with.
This is something where you probably need to hire your own developer to resolve.
Okay. Thanks for the fast answers!
Hey
Can I somehow fix this so it never cache the language and currency.
I use an extension that sets lang and currency from the IP of the visitor. But when I use this Page Cache extension, it always sets the webshop to english lang and eur currency.