Post by Zezoiaj » Fri Jul 26, 2019 9:46 pm

Hello guys , i have an issue of my website .

When Add a new item to cart and go to homepage or any-other page the cart goes to be 0 and when go product page the cart refresh again ..

i tried everything i could
1- turn the host cache off
2- clear cpanel cache
3- clear opencart admin cache
4- restore htaccess to default
5- clear browser cache

nothing helped me out .

i didn't install any new extensions
i use journal 3 theme
opencart 3.0.3.2 latest version
my website link e-electra.com

please help me

New member

Posts

Joined
Fri Apr 12, 2019 10:49 pm

Post by letxobnav » Fri Jul 26, 2019 10:32 pm

sounds like a browser cache issue.
open chrome developer tools->network->disable cache and try again.
if the issue is gone, you are not sending the correct caching headers to the browser.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Zezoiaj » Fri Jul 26, 2019 11:10 pm

Thanks for reply , i did that and tried with 5 deferent browsers but still the same ..

New member

Posts

Joined
Fri Apr 12, 2019 10:49 pm

Post by by mona » Sat Jul 27, 2019 12:01 am

A site on OC1.5.5.1 had a similar issue.
Turns out we were moved onto a Varnish server - absolutely wonderful for speed, but nothing we tried made it useable for a cart. It is supposed to work - we didn’t find anything for opencart, but there is info about it for wordpress ( for example - https://docs.easydigitaldownloads.com/a ... th-varnish) - None of these worked, at least not a few years ago. Finally, we move off the varnish server and voila - worked ..

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by letxobnav » Sat Jul 27, 2019 8:03 am

well, in any event, the cache control header is wrong, cloudflare and litespeed may also have a part in it.

cache-control: public, max-age=1
cf-ray: 4fca51a88dc8784e-LAX
content-encoding: br
content-type: text/html; charset=utf-8
date: Fri, 26 Jul 2019 23:57:59 GMT
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-c ... /expect-ct"
expires: Fri, 26 Jul 2019 23:58:00 GMT
server: cloudflare
set-cookie: OCSESSID=4be54b63b49cb7ff1c0feed7ab; path=/
status: 200
vary: Accept-Encoding
x-powered-by: PHP/7.0.33
x-turbo-charged-by: LiteSpeed

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Zezoiaj » Sat Jul 27, 2019 9:51 am

Thank you guys for your help , the problem has been solved by deleting all cache files from the storage

New member

Posts

Joined
Fri Apr 12, 2019 10:49 pm

Post by by mona » Sat Jul 27, 2019 12:25 pm

@Zezoiaj your welcome although I had to laugh ..
@letxobnav thank you for that - may I pick your brains on that please. How would you set that up specifically for the cart dropdown OC3.0.3.2 for example?

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by letxobnav » Sat Jul 27, 2019 3:32 pm

well, you basically do not want anything produced by the response class to be cached, not in a proxy and not in the browsers.
So you could send no-cache headers on each individual page and each individual ajax call result like the cart info popup but you might as well set those headers in the response class itself in framework.php

Code: Select all

// Response
$response = new Response();
$response->addHeader('Content-Type: text/html; charset=utf-8');
$response->setCompression($config->get('config_compression'));
$registry->set('response', $response);
would become

Code: Select all

// Response
$response = new Response();
$response->addHeader('Content-Type: text/html; charset=utf-8');
$response->addHeader('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
$response->addHeader('Pragma: no-cache');
$response->setCompression($config->get('config_compression'));
$registry->set('response', $response);
that will prevent caching of output produced by response, including ajax call results, so it will not affect other assets like js,css,images which go via expire headers etc.

On a side note, if you install 3rd party cache extensions which circumvent the standard response class or start caching after that class has produced it output or starts sending cache headers that override previously send cache headers, then all bets are off.
Journal themes seem to have a knack for over-caching to compensate for their poor performance due to their bulk designs.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by letxobnav » Sat Jul 27, 2019 6:48 pm

I see that electera is using cache-control: public, max-age=1 which states that anybody may cache this page even shared caches but only for 1 second.
That works as well.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by by mona » Sat Jul 27, 2019 7:52 pm

AWESOME

Thank you so very much

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am
Who is online

Users browsing this forum: Amazon [Bot] and 18 guests