Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Insert JavaScript into 'BUY NOW' Button


Leighx

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

 

http://www.stokke.com/tripptrapp-sale/demo/tecnical.asp

 

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?

 

CODE:

 

function openStokke(){

window.open('http://www.stokke.com/tripptrapp-sale/asp/questions.asp?LANG=2'

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

'height=480,width=600,status=no,toolbar=no,menubar=no,location=no,scrollbars=

yes');

}

function returnStokkeSuccess()

{

addToCart();

}

 

function tryAddToCart(showTTinfo){

if (showTTinfo)

openStokke();

else

addToCart();

}

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

 

Leigh

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...