i'll be honest - i don't use the shipping mechanism as it doesn't really
ever seem to be the way people want to charge for it. however, i can
probably help.
i'm going to review then spell out the solution.
review.
the basket sums up the quantity of items purchased. this is passed to the
checkout process, where it's used to find the zone the customer is in, and
multiplies the per-item shipping cost (from the zone info) times the number
of items purchased. that's checked against the zone upper limit, and
adjusted if necessary.
spelled out.
i say we use the system as is, but convert it for our own needs.
first, lets add the weight of the products to the cart so we don't have to
keep finding it later:
in "shop/lib/ps_cart.inc", function add_item:
add product_weight to the SELECT statement, and assign a $weight value (else
statement)
[code]
$q = "SELECT product_name,product_publish, product_weight FROM product WHERE
product_id='$product_id'";
$db->query($q);
$db->next_record();
// if the product isn't publishable, don't allow the add or update
if ('N' == $db->f("product_publish") ) {
// set your "not available" error message here
$d["error"] = "We're sorry but ".$db->f("product_name")." is not
available at this time.";
// when in ps_cart->update, you probably want to uncomment
// the line below to remove the product from the cart
//$this->delete($d);
return False;
} else {
$weight = $db->f("product_weight");
} //end if prodcut_publish
[/code]
add the weight to the cart at the end of the function:
[code]
if (!$updated) {
$cart[$cart["idx"]]["product_id"] = $product_id;
$cart[$cart["idx"]]["quantity"] = $quantity;
$cart[$cart["idx"]]["weight"] = $weight;
$cart["idx"]++;
}
[/code]
in "shop/html/basket.ihtml", search for zone_quantity. you'll see it sums
up the cart quantities:
[code]
$zone_qty += $cart[$i]["quantity"];
[/code]
change it to:
[code]
$zone_qty += $cart[$i]["quantity"] * $cart[$i]["weight"];
[/code]
this will give us the total weight of the order.
in "checkout/lib/ps_checkout.inc", calc_order_shipping function:
comment out the last IF statement - this will disable the "upper limit"
check.
[code]
/**********************
if($cost_low < $db3->f("zone_limit")) {
return $cost_low;
} else {
return $db3->f("zone_limit");
}
**********************/
[/code]
now, the only things left to do is fix the zones within the system and
assign the zones..
log in as admin.
edit the default zone, and enter your per-pound price for non-UK shipping.
might as well enter it in both fields.
edit zone1 - change the pricing here to your "UK" pricing. same number,
both fields.
now go to Assign Zones, and make sure every country is set to default, then
set the UK to zone1. save your changes.
that should do it.
NOTE: for products that have no weight assigned to them, shipping will be
free. that makes it an easy way to do "Free Shipping!" as needed, and you
could even throw a little check in the flypage and browse pages to check for
"no weight" and a have it display a little banner or blurb or something.
NOTE: using the weight is also a great way to do this because you can use a
set shipping costs, but then adjust shipping on a per-item basis just by
playing with the weight. have a large box that weighs almost nothing, but
still costs $30 to ship? just jack up the weight, and the shipping price
gets adjusted as well.
--------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG -
www.avg.com
Version: 8.5.329 / Virus Database: 270.12.26/2110 - Release Date: 05/12/09
06:22:00