VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: Stevejl321 on January 26, 2015, 23:13:26 PM

Title: Items fail to add to cart in https ssl
Post by: Stevejl321 on January 26, 2015, 23:13:26 PM
Regardless what option I use in configuration for items to be added to cart, while in https, items fail to add to cart after clicking on "ADD TO CART". I've had various experts investigate the issue and we came to the conclusion that it's a Virtuemart bug which needs to be researched and solved by the developers.
Title: Re: Items fail to add to cart in https ssl
Post by: AH on January 27, 2015, 09:13:29 AM
http://forum.virtuemart.net/index.php?topic=79799.0 (http://forum.virtuemart.net/index.php?topic=79799.0)

QuoteVirtuemart bug which needs to be researched and solved by the developers.

You  can also subscribe to Vm support
http://extensions.virtuemart.net/support/virtuemart-supporter-membership-detail (http://extensions.virtuemart.net/support/virtuemart-supporter-membership-detail)
Title: Re: Items fail to add to cart in https ssl
Post by: GJC Web Design on January 27, 2015, 16:46:15 PM
Just to add - I manage several completely https VM2 sites and all run flawlessly.. not tested VM3 on https yet
Title: Re: Items fail to add to cart in https ssl
Post by: rage76 on January 02, 2017, 18:48:39 PM
I am on latest J3.6 / VM3.0.18

As soon as I enable SSL, the "Continue Shopping / Show Cart" fancybox stop showing and the add to cart stops working.

Please suggest the correct way to enable SSL on entire site without breaking it.

Title: Re: Items fail to add to cart in https ssl
Post by: GJC Web Design on January 02, 2017, 20:18:31 PM
have u checked your JS console and network tabs of firebug to discover why?
Title: Re: Items fail to add to cart in https ssl
Post by: Jumbo! on January 02, 2017, 20:33:53 PM
Can you share your site link?
Title: Re: Items fail to add to cart in https ssl
Post by: rage76 on January 03, 2017, 08:59:05 AM
Hello Jumbo

Here is my site link:

www.techsolute.com

I shall be grateful for your support.
Title: Re: Items fail to add to cart in https ssl
Post by: Studio 42 on January 03, 2017, 14:49:47 PM
I tested using https://www.techsolute.com/
And it work.
Simply use .htacces to force redirection to https and all should work. You don't need to force it in your Joomla back-end
Title: Re: Items fail to add to cart in https ssl
Post by: rage76 on January 03, 2017, 15:55:28 PM
Hello Studio42

This is what I added to .htaccess

RewriteEngine On
RewriteCond %{HTTPS} OFF
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Plus, I changed the "live site url" to https:// in configuration.php & in Joomla global config, enabled "Force SSL"

Please correct me where I am wrong or what I need to change.

best wishes

Title: Re: Items fail to add to cart in https ssl
Post by: Studio 42 on January 03, 2017, 16:02:39 PM
Quote from: rage76 on January 03, 2017, 15:55:28 PM

Plus, I changed the "live site url" to https:// in configuration.php & in Joomla global config, enabled "Force SSL"

This is not needed, only the http to https rule in .htaccess
Title: Re: Items fail to add to cart in https ssl
Post by: rage76 on January 03, 2017, 17:17:13 PM
OK, I tried what you suggested and it seems to be working !! You are awesome Studio 42.

I hope this doesn't cause any other problems. Plus, Google product ads require HTTPS. I hope this would be acceptable to them!!

One more question, why are the URLs showing https://techsolute.com/.... instead of https://www.techsolute.com/.... ???
Title: Re: Items fail to add to cart in https ssl
Post by: Studio 42 on January 03, 2017, 17:50:53 PM
Because you dont forced WWW in .htaccess, you can eg using :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^techsolute.com [NC]
RewriteRule ^(.*)$ https://www.techsolute.com/$1 [L,R=301,NC]
Title: Re: Items fail to add to cart in https ssl
Post by: Milbo on January 26, 2017, 00:31:13 AM
No one needs www anylonger, since years. I would also redirect any www to your domain. www is just a subdomain and has no technical background. In the 90s, there was the idea to indicate with www, that a http server runs in on that domain.

ofc besides other conspiracy theories
Title: Re: Items fail to add to cart in https ssl
Post by: rage76 on May 25, 2017, 19:25:56 PM
Hello again Studio 42

how do I keep the back end (admin) without SSL? Or is it advisable to have SSL enabled for admin too?

Also, should I "enable SSL for sensitive areas" option in Virtuemart? 
Title: Re: Items fail to add to cart in https ssl
Post by: GJC Web Design on May 25, 2017, 22:51:05 PM
just use ssl every where with the htaccess snippet

"enable SSL for sensitive areas"  is not needed
Title: Re: Items fail to add to cart in https ssl
Post by: jenkinhill on May 26, 2017, 13:13:08 PM
I don't make any config settings in Joomla/VirtueMart, I just use .htaccess to force all pages to SSL - I also drop the www. for all sites now.

# match any URL with www and rewrite it to https without the www
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]

# match urls that are non https (without the www)
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Title: Re: Items fail to add to cart in https ssl
Post by: rage76 on May 26, 2017, 17:54:08 PM
Thanks GJC & Jenkinhill

This is what I am using in my .htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ https://www.mysite.com/$1 [L,R=301,NC]

When I disable SSL in virtuemart, it leads to http page, so some modification is required. Please help me with it.

Also I would like to know any benefits of dropping the "www"?

best wishes
Title: Re: Items fail to add to cart in https ssl
Post by: AH on May 27, 2017, 12:17:01 PM
Many sites  dont use www any more,  it is often seen as outdated

and it helps in your marketing if you drop it

www.yoursitename.com

vs

yoursitename.com


Title: Re: Items fail to add to cart in https ssl
Post by: jenkinhill on May 27, 2017, 12:49:46 PM
In the good old days (1900s) www. was just a domain protocol, just like ftp. telnet. or mail.  Some servers actually required the use of www. as a subdomain for a website.But that is history. There is no need at all for the www. now, and for people typing in a web address it is 4 extra keys to push. Of course there are still people who type http:// in front of the domain as well.................
Title: Re: Items fail to add to cart in https ssl
Post by: rage76 on May 27, 2017, 18:21:24 PM
When I disable "Enable SSL for sensitive areas" in virtuemart, it leads to http page, so some modification is required.

Please guide me to resolve this issue.
Title: Re: Items fail to add to cart in https ssl
Post by: AH on May 28, 2017, 11:13:32 AM
Just set the .htaccess as Jenkin has shown you

It should be SSL everywhere thereafter.

At least set this to force https everywhere



RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Title: Re: Items fail to add to cart in https ssl
Post by: rage76 on May 28, 2017, 16:39:15 PM
Dear AH

Thank you for the input. Your suggestion seems to be working !!

Hope it wont cause any untoward issue.

Warm regards
Title: Re: Items fail to add to cart in https ssl
Post by: AH on May 28, 2017, 18:48:31 PM
Thanks for the update

You should be fine - as long as you don't hard code urls in your site with HTTP:// as you will get a mixed content message in the browser
Title: Re: Items fail to add to cart in https ssl
Post by: rage76 on August 13, 2018, 12:37:14 PM
Assistance required again for the same issue (automatic redirection from http to https)

mysite.com & http://mysite.com redirect to https://www.mysite.com ---> fine
www.mysite.com or http://www.mysite.com doesn't ---> how to make this happen?

Title: Re: Items fail to add to cart in https ssl
Post by: Studio 42 on August 13, 2018, 15:04:23 PM
Quote from: rage76 on August 13, 2018, 12:37:14 PM
Assistance required again for the same issue (automatic redirection from http to https)

mysite.com & http://mysite.com redirect to https://www.mysite.com ---> fine
www.mysite.com or http://www.mysite.com doesn't ---> how to make this happen?
# match any URL with www and rewrite it to https without the www
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]

# match urls that are non https (without the www)
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This redirect any to https://yoursite.com
And dont redirect to WWW, it's completly stupid to use this, if you dont need for technical reason!!!!
Title: Re: Items fail to add to cart in https ssl
Post by: rage76 on August 13, 2018, 17:48:22 PM
Thanks for a quick response Studio 42.

After going through numerous popular websites, I feel it is better to have www prefixed to the domain, as all of them are still using it; don't you think?

So, as per you I need to use this:

# match any URL with www and rewrite it to https without the www
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]

How do I change it to include www?
Title: Re: Items fail to add to cart in https ssl
Post by: Studio 42 on August 13, 2018, 17:57:32 PM
Try
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301,NC]
Title: Re: Items fail to add to cart in https ssl
Post by: rage76 on August 13, 2018, 18:49:34 PM
www.mysite.com is still not getting redirected to https://www.mysite.com
Title: Re: Items fail to add to cart in https ssl
Post by: Studio 42 on August 13, 2018, 20:26:40 PM
Have you this rules at begin of .htaccess?
Try then
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.yoursite.com [NC]
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301,NC]