How can you get Magento extension to run javascript when an item is added to the cart?

  • <checkout_cart_product_add_after> <reference name=»footer»> <block type=»core/templates» name=»INSERT_CUSTOM_NAME_HERE» template=»path/to/your/phtml/file.phtml» /> </reference> </checkout_cart_product_add_after>

  • <catalog_product_view> <reference name=»footer»> <block type=»core/template» name=»INSERT_CUSTOM_NAME_HERE» template=»path/to/your/phtml/file.phtml» /> </reference> </catalog_product_view>

  • <checkout_cart_product_add_after> <reference name=»footer»> <block type=»core/template» name=»INSERT_CUSTOM_NAME_HERE» template=»path/to/your/phtml/file.phtml» /> </reference> </checkout_cart_product_add_after>

  • All of the above

stackoverflow.com/a/16471219