Jump to content

Archived

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

fazzfarrell

shipping costs any ideas

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]

Share this post


Link to post
Share on other sites
I don't think this is going to help anyone, as you haven't actually provided us with any of the functional code.

Regards
Huggie

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×

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.