Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Insert JavaScript into 'BUY NOW' Button


Recommended Posts

Hello all,


Forgive my longwinded first post. Trying to give you as much info as possible :)


I have just taken over the updating of a friends website. Using OSCommerce and CRE Loaded. Great product and an easy add products interface. So, I thought no worries. http://www.heybabyshop.co.uk\shop


Today I get asked to do this…. One of her suppliers needs this Javascript to run when a person clicks on the buy it now button of one of their products. It opens their site, gets you to answer 6 questions about the chair and if all correct adds to your cart. If not, it goes back to product.


They have set up a dummy site to show how it should work here




The Product in question is the Tripp-Trapp (a baby’s highchair) there is a MS Document on the site to give you a more involved explanation into what they want.


She has had to withdraw the product from the site until I can get this to work.


My Java script and the innerworkings of the cart are minimal. Will I be able to insert this code somehow? Or can I run an ‘IF product_id = <product_number> do this then add to cart ’ type statement to the ‘buy now’ button?




function openStokke(){


+'&RETURNSUCCESS=http://www.stokke.com/tripptrapp-sale/demo/return.htm' ,null,




function returnStokkeSuccess()





function tryAddToCart(showTTinfo){

if (showTTinfo)





function addToCart(){

alert('Item is now added to the demoshop cart');

// add code that adds the product to cart here, e.g. submit



The RETURNSUCESS Statement will be edited to point to her site and not back to theirs :)


Your help would be greatly received.


Many Thanks



Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...