Jump to content

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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.