<form action="{paypal_url}" method="post" id="checkout" name="checkout">
<!--<input type="hidden" value="_xclick" name="cmd">-->
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" value="2" name="rm">
<input type="hidden" value="{business}" name="business">
<span id="products_sale">
</span>
<input type="hidden" name="tax_cart" id="tax_cart" value="0">
<input type="hidden" name="email" value="{logged_email}" />
<input type="hidden" name="first_name" value="{first_name}" />
<input type="hidden" name="last_name" value="{last_name}" />
<input type="hidden" value="{currency}" name="currency_code">
<input type="hidden" value="IC_Sample" name="bn">
<input type="hidden" value="{image_url}" name="image_url">
<input type="hidden" name="notify_url" value="{notify_url}" />
<input type="hidden" value="{confirm_order}" name="return">
<input type="hidden" value="Click here to Confirm Order to {domain_url}" name="cbt">
<input type="hidden" value="{invoice_no}" name="invoice">
<input type="hidden" value="{cancel_order}" name="cancel_return">
<input type="hidden" name="paymentaction" value="sale" />
<img height="50" width="100" src="{submit_btn}" alt="Paypal" onclick="$('#checkout').submit();" style="cursor:pointer;" />
</form>
Multiple Products List Filling with JQuery in Paypal Form
$('.payment').bind("mousemove click mouseup",(function(){
var prices_of_tickets = $('.prices_of_tickets');
var units_of_tickets = $('.units_of_tickets select');
var total_price = 0;
var products_sale = '';
var product_name = '{event_name}';
$.each(prices_of_tickets, function(i, item) {
if(i!='undefined' && item!='undefined')
{
var ticket_price = parseFloat(($(this).html()));
var ticket_unit = 0;
$.each(units_of_tickets, function(j, items) {
//alert(i+'~'+j);
if(j!='undefined' && item!='undefined' && i==j)
{
var select_id = ($(this).attr('id'));
ticket_unit = parseInt($('#'+select_id+' :selected').text());
var calc_price = ticket_price*ticket_unit;
var names_of_tickets = 'Event: '+product_name+', Ticket: '+$('#names_of_tickets_'+(i+1)).html();
total_price+=calc_price;
if(calc_price>0)
{
$('#put_price_'+(i+1)).html(calc_price);
products_sale+='<input type="hidden" name="item_name_'+(i+1)+'" value="'+names_of_tickets+'"><input type="hidden" name="amount_'+(i+1)+'" value="'+calc_price+'"><input type="hidden" name="quantity_'+(i+1)+'" value="'+ticket_unit+'">';
}
}
});
}
});
$('#total_price').html(total_price);
var tax_amount = 0;
if('{currency}'=='CAD')
{
tax_amount = ((total_price*{tax})/100);
}
$('#tax_id').html(tax_amount.toFixed(2));
var grand_total = tax_amount+total_price;
$('#grand_price').html(grand_total.toFixed(2));
$('#tax_cart').val(tax_amount);
$('#products_sale').html(products_sale);
}));
Last updated: March 19, 2014