Page 1 of 1

Add to Cart button on home page does not work from some browsers

Posted: Sat Mar 18, 2017 9:56 pm
by TROLL
site url: flashgels.com

I am experiencing an issue where the "Add to Cart" button for products on the home page does not work with certain browsers. It works everywhere else, but just on the home page it does not work.

The buttons do work when using iOS on my iPhone or Safari from my MacBook, however the buttons do not work when using IE, Firefox, and Chrome. I have not tested others. When trying to click the button, there is no response when using these browsers.

Do you know what the issue might be here? Any help is appreciated, I wasn't able to find much specific to this browser issue searching the forums.

Please let me know if you need any other info, thank you.
Bryan

Re: Add to Cart button on home page does not work from some browsers

Posted: Sat Mar 18, 2017 10:57 pm
by Johnathan
The error showing up in the browser console is this:

XMLHttpRequest cannot load https://flashgels.com/index.php?route=checkout/cart/add. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://flashgels.com' is therefore not allowed access.
It means you have something on your server that is blocking HTTP requests to non-https URLs. You'll either need to remove that, or force all your URLs to be https. You can find directions on that by searching on Google for "htaccess force URLs to https".

Re: Add to Cart button on home page does not work from some browsers

Posted: Sun Mar 19, 2017 4:20 am
by victorj
There is a error in how you set up your config files.

in both config files (root and folder admin) all http should be edited so they become https.

next add a new rewrite rule in your .htacces file at the beginning

Code: Select all

RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://flashgels.com/$1 [R=301,L]

Re: Add to Cart button on home page does not work from some browsers

Posted: Tue Mar 21, 2017 7:20 am
by TROLL
Thank you for the replies, I am happy to say that it looks like I have been able to correct the issue.
The opencart support ticket I opened was surprisingly unhelpful, but the community forums have saved the day. Much appreciated!