You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
Hello: I've looked around on the forum, but I haven't found a script that will do what our client is requesting. She is starting an online book business. Here is her request:
Should I put in an order for a paid modification?
Thanks,
Bob Simpson
Offline
try this. I have only done the first few. You would need to do this all the way up to 70 for that amount of books. Not sure what you're planning after total of 70 books
<?php
// +--
// | All custom shipping scripts work in the same way. A global
// | variable named 'ecom.customship' contains the following PHP
// | array. Array keys with value info:
// |
// | weight => Total weight of items being shipped.
// | total => Subtotal of items being shipped.
// | quantity => Quantity of items being shipped.
// | stateprov => Ship to state/province.
// | country => Ship to country.
// | postalcode => Ship to postal code.
// |
// | This script must set a global variable named
// | 'ecom.customship_response' which is an array in the
// | following format:
// |
// | method name => amount
// |
// | NOTE: Do not print anything within custom shipping
// | scripts. They are designed only to return names and
// | prices for custom shipping methods.
// |
// | This script is a User Defined Calculation script that
// | returns a static method and amount.
// +--
$info = $this->globals('ecom.customship');
$quantity = $info['quantity'];
if ($quantity == '1') {
$custom = array('Shipping' => '3.00');
} elseif ($quantity == '2') {
$custom = array('Shipping' => '3.75');
} elseif ($quantity == '3') {
$custom = array('Shipping' => '4.25');
}
$this->globals('ecom.customship_response',$custom);
?>
Offline
If I'm reading her request correctly she wants to charge an additional 3 dollars when the quantity of books hits 70 and continue to charge 75 cents for additional books beyond that. This code will only repeat the additional 3 dollars at a quantity of 70. No need for a big if/then/else statement.
$ship = 3;
if ($info['quantity'] == 70) {
$ship += 3;
}
if ($info['quantity'] > 1) {
$ship += ($info['quantity'] - 1) * .75;
}
$custom = array('Shipping' => $ship);
$this->globals('ecom.customship_response',$custom);Offline
Hello: Thanks for the code, we'll be testing it out soon and let everyone know how it goes.
Bob Simpson
Offline