Discussions

Triggering a Javascript with Rules when an order is complete.

I have a weird situation that has come up and I'm wondering if anyone might have a suggestion. I'm using Drupal 7 with Drupal Commerce and it is using Paypal Standard as the payment gateway.

I am need of triggering a script (supplied by a third party for tracking a purchase) when the user completes the purchase. I have added this script to the Order Complete page (customized) which works fine. However, the problem is because Paypal doesn't seem to automatically return users to my site (the order complete page) when they use a CC# to pay (it does if they use their Paypal account) then the client side Javascript doesn't get triggered. These people have to manually click the link to return to the site (order complete page).

My idea was to trigger the Javascript using a rule when the order is complete. Similar to how it completes the order once it receives confirmation from the IPN and doesn't need the user to return to the site. So this would be Instead of requiring the script to be run client side if the user returns.

Any idea how I would make this happen? Thanks for any help or guidance.

Posted: May 29, 2013

Comments