function update_product(id) {
new Request.JSON({
'url':'index.php?type=onepage&task=update_product',
'method':'post',
'data':'id='+id+'&quantity='+document.id('quantity_'+id).value,
'onSuccess':function(json,text) {
<?php if ( VmConfig::get('show_tax')) { ?>
document.id('subtotal_tax_amount_'+id).set('text',json.subtotal_tax_amount);
<?php } ?>
document.id('subtotal_discount_'+id).set('text',json.subtotal_discount);
document.id('subtotal_with_tax_'+id).set('text',json.subtotal_with_tax);
<?php if ( VmConfig::get('show_tax')) { ?>
document.id('tax_amount').set('text',json.taxAmount);
<?php } ?>
document.id('discount_amount').set('text',json.discountAmount);
document.id('sales_price').set('text',json.salesPrice);
<?php if ( VmConfig::get('show_tax')) { ?>
document.id('total_tax').set('text',json.billTaxAmount);
document.id('shipment_tax').set('text',json.shipmentTax);
document.id('payment_tax').set('text',json.paymentTax);
<?php } ?>
document.id('shipment').set('text',json.salesPriceShipment);
document.id('payment').set('text',json.salesPricePayment);
document.id('total_amount').set('text',json.billDiscountAmount);
document.id('bill_total').set('text',json.billTotal);
Virtuemart.productUpdate(jQuery('.vmCartModule'));
new Request.JSON({
'url':'index.php?type=onepage&task=get_payments',
'onSuccess':function(json,text) {
document.id('payments').empty();
var payments="";
for(var i=0;i<json.length;i++) {
payments+=json[i].toString().replace('input','input onclick="set_payment(this);"')+'<br />';
}
document.id('payments').set('html',payments);
new Request.JSON({
'url':'index.php?type=onepage&task=get_shipments',
'onSuccess':function(json,text) {
if(document.id('shipments')) {
document.id('shipments').empty();
}
var shipments="";
for(var i=0;i<json.length;i++) {
shipments+=json[i].toString().replace('input','input onclick="set_shipment(this);"')+'<br />';
}
document.id('shipments').set('html',shipments);
}
}).send();
}
}).send();
}
}).send();
}
function remove_product(id) {
new Request.JSON({
'url':'index.php?type=onepage&task=remove_product',
'method':'post',
'data':'id='+id,
'onSuccess':function(json,text) {
document.id('product_row_'+id).destroy();
<?php if ( VmConfig::get('show_tax')) { ?>
document.id('tax_amount').set('text',json.taxAmount);
<?php } ?>
document.id('discount_amount').set('text',json.discountAmount);
document.id('sales_price').set('text',json.salesPrice);
<?php if ( VmConfig::get('show_tax')) { ?>
document.id('total_tax').set('text',json.billTaxAmount);
document.id('shipment_tax').set('text',json.shipmentTax);
document.id('payment_tax').set('text',json.paymentTax);
<?php } ?>
document.id('shipment').set('text',json.salesPriceShipment);
document.id('payment').set('text',json.salesPricePayment);
document.id('total_amount').set('text',json.billDiscountAmount);
document.id('bill_total').set('text',json.billTotal);
mod=jQuery(".vmCartModule");
jQuery.getJSON(vmSiteurl+"index.php?option=com_virtuemart&nosef=1&view=cart&task=viewJS&format=json"+vmLang,
function(datas, textStatus) {
if (datas.totalProduct >0) {
mod.find(".vm_cart_products").html("");
jQuery.each(datas.products, function(key, val) {
jQuery("#hiddencontainer .container").clone().appendTo(".vmCartModule .vm_cart_products");
jQuery.each(val, function(key, val) {
if (jQuery("#hiddencontainer .container ."+key)) mod.find(".vm_cart_products ."+key+":last").html(val) ;
});
});
mod.find(".total").html(datas.billTotal);
mod.find(".show_cart").html(datas.cart_show);
} else {
mod.find(".vm_cart_products").html("");
mod.find(".total").html(datas.billTotal);
}
mod.find(".total_products").html(datas.totalProductTxt);
}
);
new Request.JSON({
'url':'index.php?type=onepage&task=get_payments',
'onSuccess':function(json,text) {
document.id('payments').empty();
var payments="";
for(var i=0;i<json.length;i++) {
payments+=json[i].replace('input','input onclick="set_payment(this);"')+'<br />';
}
document.id('payments').set('html',payments);
}
}).send();
new Request.JSON({
'url':'index.php?type=onepage&task=get_shipments',
'onSuccess':function(json,text) {
document.id('shipments').empty();
var shipments="";
for(var i=0;i<json.length;i++) {
shipments+=json[i].replace('input','input onclick="set_shipment(this);"')+'<br />';
}
document.id('shipments').set('html',shipments);
}
}).send();
}
}).send();
}