Author Topic: Add to cart button not working  (Read 459 times)

centinela

  • Beginner
  • *
  • Posts: 20
  • A beginner
Add to cart button not working
« on: September 28, 2020, 13:32:51 pm »
Joomla 3.9.12
Virtuemart 3.8.4
PHP 7.3

Hello,

In my shop https://www.jcmackintosh.es/vm.html?lang=es the add to cart button does not work for any product. Any ideas please? Thank you.


jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27886
  • Always on vacation
    • Jenkin Hill Internet
Re: Add to cart button not working
« Reply #1 on: September 28, 2020, 13:50:00 pm »
Console shows a JavaScript problem. You are loading a version of jQuery through your phocaupgrade plugin which I think is incompatible with VirtueMart.

Try to disable that plugin and enable VM jQuery
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VM 3.8.5 10338 on Joomla 3.9.22 PHP 7.4.9

centinela

  • Beginner
  • *
  • Posts: 20
  • A beginner
Re: Add to cart button not working
« Reply #2 on: September 28, 2020, 14:36:48 pm »
Thank you Jenkinhill,

I disabled Phocaupgrade plugin, and VM JQuery UI scrips in Core Css Styels & Javascritps under templates in configuration was already enabled. As a result a thinking rotating wheel shows up (for the first time, I think), but it seems to get stuck there.  :-\ Any ideas please? Thank you,

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9815
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Add to cart button not working
« Reply #3 on: September 28, 2020, 15:16:23 pm »
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://jcmackintosh.es/index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json&lang=es&Itemid=429. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

you need to force either www or no www

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

in your .htaccess
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

centinela

  • Beginner
  • *
  • Posts: 20
  • A beginner
Re: Add to cart button not working
« Reply #4 on: September 29, 2020, 10:36:03 am »
Thank you GJC, in order to force www I added the the .httaccess file

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

but the add to cart button keeps on not wanting to work.

Is there anything I did wrong? Thank you,

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9815
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Add to cart button not working
« Reply #5 on: September 29, 2020, 13:36:34 pm »
it is still showing

The Same Origin Policy disallows reading the remote resource at https://jcmackintosh.es/index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json&lang=es&Itemid=429.
 (Reason: CORS request did not succeed).

I have no idea why the ajax call isn't using www

you could try forcing no www

# 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]

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

Jumbo!

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 706
  • Full-stack Web Developer
    • www.virtueplanet.com
  • VirtueMart Version: Always latest
Re: Add to cart button not working
« Reply #6 on: September 29, 2020, 18:56:52 pm »
Open the configuration.php file located at the root of your site. Find the following codes -

Code: [Select]
public $live_site = 'https://jcmackintosh.es';
Replace above by:

Code: [Select]
public $live_site = '';
Save the file. This will resolve the problem.


centinela

  • Beginner
  • *
  • Posts: 20
  • A beginner
Re: Add to cart button not working
« Reply #7 on: September 30, 2020, 09:43:00 am »
Thank you Jumbo!, problem solved!  :D

Jumbo!

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 706
  • Full-stack Web Developer
    • www.virtueplanet.com
  • VirtueMart Version: Always latest
Re: Add to cart button not working
« Reply #8 on: October 02, 2020, 14:58:55 pm »
Thank you Jumbo!, problem solved!  :D


No problem. :)