0

I am facing a strange problem and have no idea how to fix this since i am new to magento. The Add-to-cart button is not working on the product details page here

http://www.eyaas.com/products/home/decor/thai-benjarong/benjarong-dainty-cats.html

But it's working on the category page here

http://www.eyaas.com/products/home/decor/thai-benjarong.html

Why can this be happening. I have given the links above so that you can see the button code and tell me if somethings getting wrong.

EDIT

I removed the declaration for jquery library and my navigation file. Then the add to cart button started working. What i need to know is why does thing works well in localhost. Same files, same library and same code, but they just seem to encounter a conflict on server. Please suggest something

Pankaj Upadhyay
  • 12,966
  • 24
  • 73
  • 104
  • Probably a JS error stopping the JavaScript. Checking the error console shows some errors, starting with `jQuery is not defined` in superfish.js. – Jürgen Thelen Jun 19 '12 at 09:50
  • ohh k.....thanks , i dont know how to deal with jquery. All i know is that i added jquery for menu. Will check to see if i haven't commented out the superfish.js – Pankaj Upadhyay Jun 19 '12 at 09:59
  • LOL...I don't know what to do....I haven't commented out or removed anything else other than adding the javascript for menu. If it had to do with the menu, then why would it had worked on the categories page – Pankaj Upadhyay Jun 19 '12 at 10:06
  • [Related](http://stackoverflow.com/a/8933330/693207). Also, you need to fix your JS errors first. Any JavaScript code defined after a line where a JS error occured will _not_ be executed. If such error happens before defining the submit handler for your "Add to cart" button, no submit handler will be bound, hence button broken. – Jürgen Thelen Jun 19 '12 at 10:33
  • its working good in the localhost environment. No error can be seen there. BTW, can you please tell me as to how did you check for the javascript error – Pankaj Upadhyay Jun 19 '12 at 11:11
  • Using Firefox you just need to press `Ctrl+Shift+J` to see the error console. Other browsers may, or may not, have [equivalents](http://stackoverflow.com/a/1648614/693207) to show the error console. – Jürgen Thelen Jun 19 '12 at 11:23
  • none of that is the reason. I removed the reference to superfish and others. Also, everything is working good in localhost, so the problem lies somewhere else – Pankaj Upadhyay Jun 20 '12 at 12:52

4 Answers4

0

I can't see that you've added the jquery library in your code - the error seems to say jQuery is undefined - I think either remove all jquery or add the library should solve it

Rob Kent
  • 39
  • 2
  • jquery.1.4.2 is added. Besides everything work great on the localhost – Pankaj Upadhyay Jun 19 '12 at 11:12
  • Yes jQuery is added but it is added AFTER your superfish.js is called. Therefore any references to jQuery in superfish.js will error... – sulman Jun 19 '12 at 16:07
  • none of that is the reason. I removed the reference to superfish and others. Also, everything is working good in localhost, so the problem lies somewhere else – Pankaj Upadhyay Jun 20 '12 at 12:52
0

jQuery is added after your calling scripts. Make sure you add your jQuery to the page BEFORE any other script that relies on it.

sulman
  • 2,431
  • 7
  • 40
  • 62
0

The reason for all this was the conflict between the jquery and prototoype.js library. I solved the same by using jQuery.noConflict() function and then replacing all the $ references in my javascript code with the jQuery

Pankaj Upadhyay
  • 12,966
  • 24
  • 73
  • 104
0

Just disable the js files added in page.xml and head.phtml added for that particular theme.

things will work :-)

CloudyMarble
  • 36,908
  • 70
  • 97
  • 130
Chiragit007
  • 1,646
  • 2
  • 16
  • 31