budgetneon / v2pagecache

Page Cache for OpenCart V2.X
58 stars 26 forks source link

I can't change language in frontend with this extension #5

Closed VladyslavTkach closed 8 years ago

budgetneon commented 8 years ago

We can't really help without a lot of detail, screenshots, opencart version, what theme you're using, other installed plugins, etc, etc, etc.

VladyslavTkach commented 8 years ago

I have opencart v. 2.1.0.1, and optimus theme (http://themeforest.net/item/optimus-flexible-responsive-opencart-theme/9910757). And I also have memcached extension and settings for caching in .httaccess file.

budgetneon commented 8 years ago

I don't see anything obvious.

You might try setting a default locale and character set, as described here: https://github.com/budgetneon/v2pagecache#locales-and-charsets

Note that the example is for Turkish. I'm not sure what you would want for your default locale and charset. Maybe 'english' and 'utf-8' ?

VladyslavTkach commented 8 years ago

I have 2 langueges: russian and ukrainian. I set the default language is ru in v2pagecache.php. I tried to set locale in config.php but I have the same. May be th issue in SEO plugin? My site: http://checkroom.com.ua/

budgetneon commented 8 years ago

You say you set the locale in config.php, but did you set the charset? (utf-8 ? )

As for what the problem exactly is, it's very difficult to tell from my side. The default opencart theme does not have a language pulldown in it. I don't see any javascript errors in the console, etc.

VladyslavTkach commented 8 years ago

Yes I set lacle and utf-8 in config.php.

budgetneon commented 8 years ago

Okay. That's about as much as I know. With 3rd party themes, there's any number of things they could be doing which doesn't work with a pagecache. It's not feasible for us to install and troubleshoot all of the different themes.

VladyslavTkach commented 8 years ago

OK, Thank you for this.

RemusDevelop commented 7 years ago

I encountered the same issue and found a dirty fix that temporarely did the job. I think it would be usefull if I bring this to your attention. It seems that the $_SESSION parameter has an id assigned in opencart and on line 105 in v2pagecache.php it tries to read it directly. I had to loop the session parameter and did a messed up thing like this that works for now.

public function GetSessionVar() { foreach ($_SESSION as $session_data){

        $session_information = $session_data;
    }

    return $session_information;
}
budgetneon commented 7 years ago

I'd need more detail to do anything with this.

There are currently 2 codebases, one for Opencart 2.x through 2.2x, and one for Opencart 2.3 and greater.

Opencart does things differently with sessions even within a single major/minor release.

You can see some accounting for that, here: https://github.com/budgetneon/v2pagecache/blob/master/oc23/upload/system/library/v2pagecache.php#L105

Note that it's checking both $_SESSION in general and $_SESSION['default'] for some versions.

So, there's not one single "answer" on how to resolve issues.

I would specifically need to know which exact version of Opencart you're having trouble with, and which exact codebase of v2pagecache you're using, what key opencart is using in $_SESSION, etc.

Short of that, I wouldn't push any changes, as it would likely break things for someone else.