dmitryseliv
12-20-2005, 05:03 PM
Hi !
Get stumped by this little deal.
I'm using javascript shopping cart(nebucart). I just added new product that has a free shipping but script doesn't have ability to configure shipping for each product.
But it has a function which allow to use custom shipping rules.
New product has id 'dvd'. I need help with additing some new rule for this new product 'dvd'.
Appriciate Any Help!!!
=====================================================
HERE IS THE FUNCTION
====================================================
function calcShipping(){
// BEGIN CUSTOM SHIPPING RULES
var numBoxSets = 0;
var tmpSnH = 0;
// get the country we're shipping to.
if(shipeeArray.length > 0){
tmpCountry = shipeeArray[8];
} else {
tmpCountry = shopperArray[8];
}
// see if they ordered the box set
for(itmC = 0; itmC < Cart.length; itmC++){
if(Cart[itmC].prodID == 'boxset'){
numBoxSets = Cart[itmC].qty;
break;
}
}
// calc the shipping $3.00 per item
tmpSnH = (3 * totalQty);
// if we're shipping outside the US,
// add $2.00 per item -> $5.00 each item
if(tmpCountry != 'US'){
tmpSnH += (2 * totalQty);
// if we're outside the US and they ordered the box set,
// add another $5.00 -> $10.00 each box set
if(numBoxSets > 0){
tmpSnH += (5 * numBoxSets);
}
} else {
// if they have the box set and inside the US,
// add another $2.00 => $5.00 per box set
if(numBoxSets > 0){
tmpSnH += (2 * numBoxSets);
}
}
return tmpSnH;
// END CUSTOM SHIPPING RULES
}
=====================================================
Get stumped by this little deal.
I'm using javascript shopping cart(nebucart). I just added new product that has a free shipping but script doesn't have ability to configure shipping for each product.
But it has a function which allow to use custom shipping rules.
New product has id 'dvd'. I need help with additing some new rule for this new product 'dvd'.
Appriciate Any Help!!!
=====================================================
HERE IS THE FUNCTION
====================================================
function calcShipping(){
// BEGIN CUSTOM SHIPPING RULES
var numBoxSets = 0;
var tmpSnH = 0;
// get the country we're shipping to.
if(shipeeArray.length > 0){
tmpCountry = shipeeArray[8];
} else {
tmpCountry = shopperArray[8];
}
// see if they ordered the box set
for(itmC = 0; itmC < Cart.length; itmC++){
if(Cart[itmC].prodID == 'boxset'){
numBoxSets = Cart[itmC].qty;
break;
}
}
// calc the shipping $3.00 per item
tmpSnH = (3 * totalQty);
// if we're shipping outside the US,
// add $2.00 per item -> $5.00 each item
if(tmpCountry != 'US'){
tmpSnH += (2 * totalQty);
// if we're outside the US and they ordered the box set,
// add another $5.00 -> $10.00 each box set
if(numBoxSets > 0){
tmpSnH += (5 * numBoxSets);
}
} else {
// if they have the box set and inside the US,
// add another $2.00 => $5.00 per box set
if(numBoxSets > 0){
tmpSnH += (2 * numBoxSets);
}
}
return tmpSnH;
// END CUSTOM SHIPPING RULES
}
=====================================================