News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Disable Add to Cart when Javascript is disabled.

Started by WebStuff, July 15, 2013, 18:26:29 PM

Previous topic - Next topic

WebStuff

VM 2.0.20b
J2.5.11
PHP 5.4.6
Searched for this and whilst I've found loads of threads on disabling add to cart via templates for products and categories I have not found a solution to my problem.
I need to stop the add to cart button having any functionality if javascript is disabled but display it if javascript is enabled in the users browser.
I've tried removing the button from the template then only displaying it via javascript, therefore they need javascript enabled to see the button, but this stops the add to cart working at all as I assume jQuery can't find the button or form.

I need to only allow add to cart if javascript is enabled.

Any help greatly appreciated.

Maxim Pishnyak

Showing not usable addtocart button could show customers that they can't use web page(s).

If you'll hide button for those who has using js turned off, these people wouldn't have an idea that it's possible to buy a thing at your "web shop".
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

WebStuff

Quote from: Maxim Pishnyak on July 15, 2013, 21:47:17 PM
If you'll hide button for those who has using js turned off, these people wouldn't have an idea that it's possible to buy a thing at your "web shop".
Thanks for the reply.
I have a message that explains that they need to have Javascript and Cookies enabled in order to purchase items. On VM1 it was easy to disable the add to cart until JS was enabled but if I use the same approach on VM2 the jQuery doesn't work.

Maxim Pishnyak

Quote from: mirrorsandglass on July 16, 2013, 12:37:54 PM
I have a message that explains that they need to have Javascript and Cookies enabled in order to purchase items.
Still not functional button and displaying your message at one time on current page could do the right job.

I wish VM Team to work on more important stuff.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

WebStuff

Quote from: Maxim Pishnyak on July 16, 2013, 12:51:10 PM
I wish VM Team to work on more important stuff.
Me too. :-)
It was just if someone knew how to do it. I'll keep digging.

jenkinhill

Not in VM, but I have used this code snippet before. It does not disable things but redirects to an advice page (eg. about how to turn JS on)

<NOSCRIPT>
Java Script is disabled in your browser!
<meta http-equiv="refresh" content="0;url=(redirectedpage)">
</NOSCRIPT>
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

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

WebStuff

Thanks Jenkinhill I hadn't thought of redirecting them to a different page.
That will do nicely for now.  :D