Author Topic: Virtuamart www Issue not adding anything to the Cart  (Read 330 times)

Mitsiman

  • Beginner
  • *
  • Posts: 15
Virtuamart www Issue not adding anything to the Cart
« on: September 18, 2019, 07:03:39 am »
I recently had to move my site to another address, and have now moved it back to the original address again.

The issue I am having is the site loads up fine, whether the address be www.shop.rpw.com.au or shop.rpw.com.au

But it will only add products to the cart if you are using the address shop.rpw.com.au. IF you add the www in front it just sits there thinking whenever you try to add a product to the cart.

I had siteground (Host) look into this and they changed the .htaccess file apparently to setup the redirect but it didn't make any difference, the problem still exists and they believe its a hard coded issue.

I have updated to the latest versions being

Joomla! 3.9.11 Stable [ Amani ] 13-August-2019 15:00 GMT
VirtueMart 3.6.0 10113

I really have no idea where to proceed from here. Any help would be appreciated.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4067
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Virtuamart www Issue not adding anything to the Cart
« Reply #1 on: September 18, 2019, 07:35:55 am »
Try to empty livesite in the Joomla config.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9223
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Virtuamart www Issue not adding anything to the Cart
« Reply #2 on: September 18, 2019, 13:09:44 pm »
it doesn't work because

Access to XMLHttpRequest at 'http://shop.rpw.com.au/index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json&lang=en&Itemid=896' from origin 'http://www.shop.rpw.com.au' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

try the htaccess force the other way around -- i.e. no www
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Mitsiman

  • Beginner
  • *
  • Posts: 15
Re: Virtuamart www Issue not adding anything to the Cart
« Reply #3 on: September 18, 2019, 15:54:47 pm »
Thank you very much that worked perfectly and the site is now running properly again. Is there a reason why this is happening though? Surely this is not something you would normally need to do.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4067
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Virtuamart www Issue not adding anything to the Cart
« Reply #4 on: September 19, 2019, 10:17:31 am »
It depend the apache settings. see for eg. https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin
If yuou use a cache then the links can be bad.
It's why always redirecting to non WWW should be used, to prevent this problem.
If you set livesite in the config. Then you can have same problem.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9223
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Virtuamart www Issue not adding anything to the Cart
« Reply #5 on: September 19, 2019, 13:19:22 pm »
simple explanation : ajax calls etc must to/from the identical domains - otherwise the browser will block it  .. this is for security
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation