Jump to content

shipping costs any ideas


fazzfarrell

Recommended Posts

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]
<?php
include_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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.