Question

The problem is that I have a complete working shopping cart but it's not coded for BOTH Paypal and Google Checkout, it's coded for one or the other.

Demo of shopping cart set to Paypal checkout: http://shoppingcart-bthub.blogspot.com/

The javascript in the demo above: http://shopppingcart.googlecode.com/files/simplecart.js

As you can see in the javascript above, it has options of Paypal OR Google checkout, hence:

var NextId=1,Custom="Custom",GoogleCheckout="GoogleCheckout",PayPal="PayPal",Email="Email", 

And within the "/head" you can pick your option by doing this:

<script src='http://shopppingcart.googlecode.com/files/simplecart.js' type='text/javascript'></script>
<script type='text/javascript'>
simpleCart.email = "example@gmail.com";
simpleCart.checkoutTo = PayPal;
simpleCart.currency = USD;

simpleCart.cartHeaders = ["thumb_image" , "Quantity_input" ,   "Total", "remove" ]; 
</script>

However, you can't pick BOTH options. Hence there is only one checkout button that links to the javascript:

<a class='simpleCart_checkout' href='javascript:;'>Checkout</a>

Does anyone have any good idea on how to get BOTH checkout options working?

P.S. I have skills in HTML, CSS, jQuery but limited javascript.

Was it helpful?

Solution

Taken from: SimpleCart-JS GitHub

comment out all your checkoutTo:

// simpleCart.checkoutTo = GoogleCheckout;

and add a function: I created an easy function:

function passPaypal(){ simpleCart.checkoutTo = PayPal; } function passGoogle(){ simpleCart.checkoutTo = GoogleCheckout; }

And then my checkout options:

<a href="javascript:;" class="simpleCart_checkout" onclick="passPaypal();" >checkoutpaypal</a>

<a href="javascript:;" class="simpleCart_checkout" onclick="passGoogle();" >checkoutgoogle</a>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top