fazzfarrell Posted October 17, 2006 Share Posted October 17, 2006 Hopefully my last problem!I have a shipping table as follows:[CODE]CREATE TABLE `dhl_pricing` ( `zone_id` int(11) NOT NULL auto_increment, `zone_number` int(11) NOT NULL default '0', `zone_weight` varchar(20) default '0', `zone_price` decimal(5,2) default NULL, PRIMARY KEY (`zone_id`), KEY `zone_id` (`zone_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=49 ;-- -- Dumping data for table `dhl_pricing`-- INSERT INTO `dhl_pricing` (`zone_id`, `zone_number`, `zone_weight`, `zone_price`) VALUES (1, 1, '0.5', '8.75'),(2, 1, '1', '10.01'),(3, 1, '1.5', '10.64'),(4, 1, '2', '11.28'),(5, 7, '0.5', '11.12'),(6, 7, '1', '14.11'),(7, 7, '1.5', '16.34'),(8, 7, '2', '17.55'),AND..CREATE TABLE `dhl_zoneid` ( `zone_id` int(11) NOT NULL auto_increment, `zone_country` varchar(50) NOT NULL default '', `zone_number` int(11) NOT NULL default '0', PRIMARY KEY (`zone_id`), KEY `zone_id` (`zone_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=209 ;-- -- Dumping data for table `dhl_zoneid`-- INSERT INTO `dhl_zoneid` (`zone_id`, `zone_country`, `zone_number`) VALUES (1, 'UK', 1),(2, 'AGUILLA', 9),(3, 'ALBANIA', 5),(4, 'ALGERIA', 10),(5, 'ANDORRA', 5),(6, 'ANGOLA', 10),(7, 'ANTIGUABARBUDA', 9),[/CODE]the shiping cost works fine:[CODE]<?phpinclude_once(IMX_DIR . "/../Connections/jag.php");$IMX_SHIPCALC = new zoneCalc();$IMX_SHIPCALC->zoneTable = "dhl_zoneid";$IMX_SHIPCALC->zoneNumberColumn = "zone_number";$IMX_SHIPCALC->zoneCountryColumn = "zone_country";$IMX_SHIPCALC->priceTable = "dhl_pricing";$IMX_SHIPCALC->priceZoneColumn = "zone_number";$IMX_SHIPCALC->priceWeightColumn = "zone_weight";$IMX_SHIPCALC->priceAmountColumn = "zone_price"; $IMX_SHIPCALC->destination = $_SESSION['postConn'];$IMX_SHIPCALC->weight = $HTTP_SESSION_VARS["icJag"]->col("TotalWeight");$IMX_SHIPCALC->conn = &$jag;$IMX_SHIPCALC->dbName = $database_jag;$HTTP_SESSION_VARS["icJag"]->shippingPrice = $IMX_SHIPCALC->calculate();?>[CODE]Untill the weight valur goes above '2' and then reverts to '0.00' is there any script to get around this?[/code][/code] Link to comment https://forums.phpfreaks.com/topic/24192-shipping-costs-any-ideas/ Share on other sites More sharing options...
HuggieBear Posted October 17, 2006 Share Posted October 17, 2006 I don't think this is going to help anyone, as you haven't actually provided us with any of the functional code.RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/24192-shipping-costs-any-ideas/#findComment-109949 Share on other sites More sharing options...
obsidian Posted October 17, 2006 Share Posted October 17, 2006 looks like your table only has data up to 2 pounds. does DHL have a flat rate above that, or do you need more data? if you want to quote the 2lb price for anything over 2lbs, just do a check before you run your calculator:[code]<?php$weight = $_SESSION['icJag']->col("TotalWeight");if ($weight > 2) $weight = 2;$IMX_SHIPCALC->weight = $weight;?>[/code]more information about how your provider handles weights over your 2lb limit would be helpful, too. Link to comment https://forums.phpfreaks.com/topic/24192-shipping-costs-any-ideas/#findComment-109955 Share on other sites More sharing options...
fazzfarrell Posted October 17, 2006 Author Share Posted October 17, 2006 Brill, that works great, just what i needed!thanks Link to comment https://forums.phpfreaks.com/topic/24192-shipping-costs-any-ideas/#findComment-109961 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.