View Single Post
  #26  
Old 09-01-2004, 06:40 AM
 
spingary spingary is offline
 

Advanced Member
  
Join Date: Apr 2003
Posts: 51
 

Default

Looks like XCart leaves it up to the mod to determine whether it should or should not return a rate based on customer location. Here's a quick update for the mod to do that:

Thanks for catching it!

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 "../shipping/mod_DHL.php"; // ADD THIS LINE to include this file: // include "../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=200; // 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); } } ?>
Reply With Quote