News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Product not being added to cart in chrome on PC, and all browsers on mobiles

Started by AzMandius, March 28, 2019, 21:40:51 PM

Previous topic - Next topic

AzMandius

Hello,
There is an non-ordinary issue with product not being added to cart, mostly chrome on desktop PC, and any browser on mobile devices. Please try to add some products from here for example: http://npcriz-sklad.ru/vibor/po-kategoriyam/chaj
I also noticed that if i clean browser cache, and add first product, it adds to cart successfully, but second or third product does not add. Also even if i delete the very first product added cart after cache clean, and try to add another product, the old product appears in cart again, while no other product is added to cart.

I have read tons of information about this issue, and in most cases it has to do with jquery versions conflict, or some other js files like mootools. I have looked over my site code, but not really sure which js file could be causing the issue, or just should not be there in the code.

Any help highly appreciated :)

Joomla 2.5.19
VirtueMart 2.0.8e
AzBlog.me | Mentally healthy content & lnks.

Studio 42

You should solve your javascript error before trying to solve this.
In the console i see
Failed to load resource: the server responded with a status of 404 (Not Found)
tracker.convead.io/widgets/1553731200/widget-ada37dbf5154040175d4ed447347044a.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
chaj:74 Uncaught TypeError: $(...).setStyle is not a function
    at chaj:74
    at d (mootools-core.js:367)
    at e (mootools-core.js:368)
chaj:75 Uncaught TypeError: $(...).setStyle is not a function
    at chaj:75
    at d (mootools-core.js:367)
    at e (mootools-core.js:368)
css3_notjs.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
You have a ocnflict with jquery and mootools, try to remove the script used

jenkinhill

Quote from: AzMandius on March 28, 2019, 21:40:51 PM
Joomla 2.5.19
VirtueMart 2.0.8e

I would be concerned about the use of very old and critically insecure software for a website. Joomla 2.5.19 dates from over 4 years ago, VirtueMart 2.0.8e is nearly 7 years old.
http://forum.virtuemart.net/index.php?topic=118683.0

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

AzMandius

Quote from: Studio 42 on March 28, 2019, 21:54:43 PM
You should solve your javascript error before trying to solve this.
You have a ocnflict with jquery and mootools, try to remove the script used
Thank you for reply. I have tried disabling every single .js file that could cause the problem, like mootools-core.js, mootools-more.js, jquery-1.9.0.js, jquery.min.js, modal.js etc. and the issue was still there, and then i accidentally found out that it is actually a cart CACHE issue. I mean the product IS actually added to cart every time i hit the add button, but it just does not appear in the cart, unless you hit a CTRL - F5 refresh, if you do that advanced refresh - all previously added products appear in cart.

So now i am wondering how could i solve that cart cache issue. Because if on PC you may do a CTRL - F5, on smartphone that is more complicated to do.

Any ideas?

Thanks.
AzBlog.me | Mentally healthy content & lnks.

Studio 42

Disable Joomla page cache, perhaps it help.
If not, check your .htacces about cache rules for html/php and json files

AzMandius

Thanks for reply, cache is initially disabled, .htaccess contains no cache rules, its a default joomla .htaccess file, so must be something else preventing products appearing in cart right after them being added there.

Anyone encountered same issue with cart cache?
AzBlog.me | Mentally healthy content & lnks.

AzMandius

Hi again and sorry for bumping the thread, but i still haven't managed to solve the issue.

I noticed an hopefully useful fact, if i disable browser cache using Chrome's web developer tools - the cart works perfectly. So it is something with the browser caching incorrectly Joomla's content.
AzBlog.me | Mentally healthy content & lnks.

Studio 42

In some PHP release the json are cached.
You can force using .htaccess to not cache the json files
For eg :
<IfModule mod_expires.c>

    ExpiresActive on

  # Data interchange
    ExpiresByType application/json                      "access plus 0 seconds"
    ExpiresByType application/ld+json                   "access plus 0 seconds"
    ExpiresByType application/vnd.geo+json              "access plus 0 seconds"
    ExpiresByType application/xml                       "access plus 0 seconds"
    ExpiresByType text/xml                              "access plus 0 seconds"

</IfModule>

AzMandius

Tried that also, didn't help, because the reason was actually, a portion of code, that i don't know so far what was used for by the previous site admin:
$LastModified_unix = strtotime(date("D, d M Y H:i:s", filectime($_SERVER['SCRIPT_FILENAME'])));
$LastModified = gmdate("D, d M Y H:i:s \G\M\T", $LastModified_unix);
$IfModifiedSince = false;
if (isset($_ENV['HTTP_IF_MODIFIED_SINCE']))
$IfModifiedSince = strtotime(substr($_ENV['HTTP_IF_MODIFIED_SINCE'], 5));
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
$IfModifiedSince = strtotime(substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 5));
if ($IfModifiedSince && $IfModifiedSince >= $LastModified_unix) {
header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
exit;
}
header('Last-Modified: '. $LastModified);
$expires = 30;
if ($_SERVER['REQUEST_URI'] == '/') {
  $expires = 5;
}
else if (in_array($_SERVER['REQUEST_URI'], array('/company/', '/projects/', '/info/', '/articles/'))) {
  $expires = 14;
}
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $expires*24*60*60));


it took me weeks to realize that removing it solves all cache problems on the site.

Solved, thank all for help!
AzBlog.me | Mentally healthy content & lnks.

AzMandius

Quote from: johnnydel on May 16, 2019, 17:40:05 PM
I had this problem.. Thank you so much
which solution from those mentioned in this thread has helped you?

Mod edit: the message you quote from was from a suspected spam source and has been removed.
AzBlog.me | Mentally healthy content & lnks.

Milbo

I know this problem with a ngnix server. I changed the session handling in joomla from file to memory.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/