News:

Support the VirtueMart project and become a member

Main Menu

Error updating cart

Started by thefbi, December 19, 2016, 18:10:01 PM

Previous topic - Next topic

thefbi

Hello,

i know this question is current, but i have an error when updating cart.
I have make a new template with Themler, and when put a product in cart, it use the javascript method.

I have tested my site in local mode, and the function work fine, but when i am in live, i have the error :
XMLHttpRequest cannot load https://www.energie-sante.ch/index.php?option=com_virtuemart&nosef=1&view=c...ty%5B%5D=1&option=com_virtuemart&view=cart&virtuemart_product_id%5B%5D=340. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://energie-sante.ch' is therefore not allowed access.

But i dont understand why it work on local and not in live ???

Any idea ?

I have VM 3.0.18 and Joomla 3.6.5

Regards

thefbi

Is the https can be cause problem ?

thefbi

Hello again, i have find the problem. It is www and non www conflict.
I have to find how i can fix it now

thefbi

Here we are !

I have make a htaccess redirection (http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/) and now all my non www is redirected at www and my problem is gone. :)

Milbo

You should do it exactly the opposite. Dont use www, it is old. And please be a aware, the add to cart for the product works with the form. So using a js should just fire the form
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

thefbi

Hello, i have say JavaScript but I don't know anything in coding...
If a put non www, it don't work because VM try to call a www URL.
But I don't know where I can change this. You have the URL in my post before.

thefbi

#6
Hello again, i have made some tests and i can't find where is the configuration for this call.

The problem is here : If i am in the site wit URL without www, i can't load to cart. If i am with www, it is OK.
You can see in my screenshot the error when i am in non www url. You see Virtuemart can't load https://www.energie-sante.ch...... Because origin (i dont understand what is it) is https://energie-sante.ch

So for now, the only way i have is to force non www to www.

Can somebody tell me an idea to find where i can define it will be the https://energie-sante.ch wich is called for load ?

I can't load attachment... upload folder is full... So link to my screenshot : http://energie-sante.ch/media/energie-sante-2.jpg

GJC Web Design

if u force no www doesn't it work?

the 'call' is the add to cart form which should take your "root" url

<form method="post" class="product" action="#">
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

thefbi

Hello,
no, i have already tested it :)

OK, but the "Root" url, i can define it ?
I have try in the "Live site" in the configuration.php but dosent work...

GJC Web Design

if u set it by htaccess it should be global

it takes what was requested

remove "Live site" -- only causes problems
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

thefbi

OK, but how can i set in htaccess ?

thefbi

Here is my htaccess :

### ===========================================================================
### Security Enhanced & Highly Optimized .htaccess File for Joomla!
### automatically generated by Admin Tools 3.6.6 on 2015-12-18 09:56:02 GMT
### Auto-detected Apache version: 2.5 (best guess)
### ===========================================================================
###
### The contents of this file are based on the same author's work "Master
### .htaccess", published on http://snipt.net/nikosdion/the-master-htaccess
###
### Admin Tools is Free Software, distributed under the terms of the GNU
### General Public License version 3 or, at your option, any later version
### published by the Free Software Foundation.
###
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
### !!                                                                       !!
### !!  If you get an Internal Server Error 500 or a blank page when trying  !!
### !!  to access your site, remove this file and try tweaking its settings  !!
### !!  in the back-end of the Admin Tools component.                        !!
### !!                                                                       !!
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
###

##### RewriteEngine enabled - BEGIN
RewriteEngine On
##### RewriteEngine enabled - END

## Send ETag (selected method: )
##### Rewrite rules to block out some common exploits -- BEGIN
RewriteCond %{QUERY_STRING} proc/self/environ [OR]
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_(en|de)code\(.*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
##### Rewrite rules to block out some common exploits -- END
##### Advanced server protection rules exceptions -- BEGIN
##### Advanced server protection rules exceptions -- END

##### Advanced server protection -- BEGIN

##### Advanced server protection -- END

##### Joomla! core SEF Section -- BEGIN
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
##### Joomla! core SEF Section -- END

#RewriteCond %{HTTP:X-Forwarded-Proto} !https   
#RewriteRule (.*) https://www.energie-sante.ch/$1 [R=301,L]

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]



#Force non-www:
#RewriteCond %{HTTP_HOST} ^www\.energie-sante\.ch [NC]
#RewriteRule ^(.*)$ http://energie-sante.ch/$1 [L,R=301]

GJC Web Design

#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]



#Force non-www:
RewriteCond %{HTTP_HOST} ^www\.energie-sante\.ch [NC]
RewriteRule ^(.*)$ http://energie-sante.ch/$1 [L,R=301]
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

thefbi

Yes, I have already try this, that's why it is in my htaccess, but VM still want call www.

GJC Web Design

then needs further investigation on YOUR site.. no one else reports this problem so it is site specific, -- template, plugin etc etc
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation