Custumer group lscache issue

AndreyPopov

Well-Known Member
#21
as I write above, I have not ability use LiteSpeed with ESI feature.

you can use F12 (Developer Tools in Browser) choose Network tab (check Disable cache)
- press Ctrl+R (if needed)
- in left column Name choose page name, on right column choose tab Cookies and fina what cookies sets for customer A and for customer B
 
#22
Logged out guest: Cookie: language=it-It; currency=EUR; cookieconsent_status=allow; jrv=4037%2C1880%2C581%2C596%2C1023%2C2923%2C340%2C345%2C4017%2C4015%2C4019%2C4024%2C4025%2C4021%2C3997%2C3951%2C3952%2C3949%2C3505%2C3617; _gcl_au=1.1.31919614.1631615068; _ga=GA1.2.217820659.1631615069; _gid=GA1.2.577276261.1631615069; OCSESSID=85b6797cdeaa1f90ad2e6edc53; _lscache_vary=session%3AloggedOut; lsc_private=b268326b97195bdfc3ec80afb4d9f2b5


Logged-in clientA: Cookie: language=it-It; currency=EUR; cookieconsent_status=allow; jrv=4037%2C1880%2C581%2C596%2C1023%2C2923%2C340%2C345%2C4017%2C4015%2C4019%2C4024%2C4025%2C4021%2C3997%2C3951%2C3952%2C3949%2C3505%2C3617; _gcl_au=1.1.31919614.1631615068; _ga=GA1.2.217820659.1631615069; _gid=GA1.2.577276261.1631615069; OCSESSID=85b6797cdeaa1f90ad2e6edc53; _lscache_vary=session%3AloggedIn; lsc_private=b268326b97195bdfc3ec80afb4d9f2b5


Logged-in ClientB:
Cookie: language=it-It; currency=EUR; cookieconsent_status=allow; jrv=4037%2C1880%2C581%2C596%2C1023%2C2923%2C340%2C345%2C4017%2C4015%2C4019%2C4024%2C4025%2C4021%2C3997%2C3951%2C3952%2C3949%2C3505%2C3617; _gcl_au=1.1.31919614.1631615068; _ga=GA1.2.217820659.1631615069; _gid=GA1.2.577276261.1631615069; OCSESSID=85b6797cdeaa1f90ad2e6edc53; _lscache_vary=session%3AloggedIn; lsc_private=b268326b97195bdfc3ec80afb4d9f2b5
 
#23
Logged out guest: Cookie: language=it-It; currency=EUR; cookieconsent_status=allow; jrv=4037%2C1880%2C581%2C596%2C1023%2C2923%2C340%2C345%2C4017%2C4015%2C4019%2C4024%2C4025%2C4021%2C3997%2C3951%2C3952%2C3949%2C3505%2C3617; _gcl_au=1.1.31919614.1631615068; _ga=GA1.2.217820659.1631615069; _gid=GA1.2.577276261.1631615069; OCSESSID=85b6797cdeaa1f90ad2e6edc53; _lscache_vary=session%3AloggedOut; lsc_private=b268326b97195bdfc3ec80afb4d9f2b5

Logged-in clientA: Cookie: language=it-It; currency=EUR; cookieconsent_status=allow; jrv=4037%2C1880%2C581%2C596%2C1023%2C2923%2C340%2C345%2C4017%2C4015%2C4019%2C4024%2C4025%2C4021%2C3997%2C3951%2C3952%2C3949%2C3505%2C3617; _gcl_au=1.1.31919614.1631615068; _ga=GA1.2.217820659.1631615069; _gid=GA1.2.577276261.1631615069; OCSESSID=85b6797cdeaa1f90ad2e6edc53; _lscache_vary=group%3A1%2Csession%3AloggedIn; lsc_private=b268326b97195bdfc3ec80afb4d9f2b5

Logged-in ClientB: Cookie: language=it-It; currency=EUR; cookieconsent_status=allow; jrv=4037%2C1880%2C581%2C596%2C1023%2C2923%2C340%2C345%2C4017%2C4015%2C4019%2C4024%2C4025%2C4021%2C3997%2C3951%2C3952%2C3949%2C3505%2C3617; _gcl_au=1.1.31919614.1631615068; _ga=GA1.2.217820659.1631615069; _gid=GA1.2.577276261.1631615069; OCSESSID=85b6797cdeaa1f90ad2e6edc53; _lscache_vary=group%3A4%2Csession%3AloggedIn; lsc_private=b268326b97195bdfc3ec80afb4d9f2b5

sorry this is the correct one, and I only now noticed that I had inserted your code in the wrong spot, I'm super embarassed... It works correctly now, it will show the pages depending on what customer group you are part of so that means that the prices will always be correct now.
I still have the issue with the names showing on header and footer.

Does your site have any sections where it shows the customer name, and if so how do you make it work with lscache?
 

AndreyPopov

Well-Known Member
#24
and I only now noticed that I had inserted your code in the wrong spot
only one line must be added ;)

here:
PHP:
if ($this->customer->isLogged() && isset($this->lscache->setting['module_lscache_vary_login']) && ($this->lscache->setting['module_lscache_vary_login'] == '1')) {
$vary['session'] = 'loggedIn';
}
insert:
PHP:
$vary['group'] = $this->customer->getGroupId();


Does your site have any sections where it shows the customer name
no
 
#25
yes thank you now it works, I added it in the wrong place :)
regarding site crawler you sent this code:

PHP:
foreach($this->checkCustomerGroup as $customer_group_number){
$vary['group'] = $customer_group_id;
            }
is this going to generate 4 diffrent caches when site is crawled by lscache?
 

AndreyPopov

Well-Known Member
#26
regarding site crawler you sent this code:

PHP:
foreach($this->checkCustomerGroup as $customer_group_number){
$vary['group'] = $customer_group_id;
            }
is this going to generate 4 diffrent caches when site is crawled by lscache?

this example what to do.
$this->checkCustomerGroup - not exist.

by default TTL of private cache is 7200 seconds (2 hours)

if you plan generate 4 different private caches then first step increase TTL of private cache
because no sense generate cache that expired after 2 hours.

and by default crawlURLs only generate cache for logged-out:
PHP:
if ($this->lscache->esiEnabled) {
            $cookies = array('', '_lscache_vary=session%3AloggedOut;lsc_private=e70f67d087a65a305e80267ba3bfbc97');
        } else {
            $cookies = array('');
        }
 
Top