Thanks so much for the mod. It works great! I just wanted to make a small change for those of you using version 4.0.3. myshipper.php is set up a little differently so the 4.0.3 mod would be as follows:
Code:
<?
// Custom shipping methods
//
// Free shipping over $X mod
// Add an entry to table xcart_shipping like this:
// INSERT INTO xcart_shipping VALUES (103, 'Free Shipping - Orders Over $200', '', 'L', 'FREEOVERX', '201', 5, 'Y', '', '0.00', 0);
// I picked "201" subcode arbitrarily, but it seems like a good number to start as to not conflict with predefined shipping methods
// The "5" is the orderby. "Y" is active or not. Replace "0.00" with a weight limit if you don't want this available for heavy orders.
// This will show up as a Real-Time shipping method in "Shipping Options"
//
// Edit the file shipping/myshipper.php and under this line
// include $xcart_dir."/shipping/mod_ARB.php";
// ADD THIS LINE to include this file:
// include $xcart_dir."/shipping/mod_CUSTOM.php"
//
// You can also include other custom shipping files here so that myshipper.php is left alone.
//
// Edit the amount valid for free shipping below.
$freeOverAmount=201;
// That's all!
if ( !defined('XCART_SESSION_START') ) { header("Location: ../"); die("Access denied"); }
global $products, $cart, $userinfo, $current_area, $login;
// Make sure this shipping method is available
foreach ($allowed_shipping_methods as $key=>$value)
if ($value["code"] == "FREEOVERX")
$FREEOVERX_FOUND = true;
if ($FREEOVERX_FOUND)
{
$tempcart = func_calculate($cart, $products, $login, $current_area);
if ($userinfo["s_country"] == $config["General"]["default_country"])
$dest = "L";
else
$dest = "I";
$row = func_query_first("SELECT shippingid, subcode FROM $sql_tbl[shipping] WHERE code='FREEOVERX' AND active='Y' and destination = '$dest'");
if ($row && ($tempcart["subtotal"] >= $freeOverAmount))
{
$rate = 0;
$intershipper_rates[] = array("methodid" => $row['subcode'], "rate" => $rate);
}
}
?>
Thanks again for the great mod!