Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

help combine two shipping contribs


travisb

Recommended Posts

I am trying to combine the features of these 2 contributions:

http://www.oscommerce.com/community/contributions,1446

http://www.oscommerce.com/community/contributions,1508

 

I want to be able to calculate the shipping based on the weight of the product, for example $1.30 / pound. This works with contrib 1508. I also want to offer two types of shipping, a basic shipping and a premium shipping method. This works with 1446, but it does not calculate rate X pounds.

 

I thought it would be a cut and paste job to get it working, but it is more complex than that. Anyone have any ideas?

Link to comment
Share on other sites

I was able to find a place to cut and paste into the 2 rate mod, I replaced

$size = sizeof($table_cost);
for ($i=0, $n=$size; $i<$n; $i+=2) {
if ($order_total <= $table_cost[$i]) {
$shipping = $table_cost[$i+1];
break;
}
}

with the code from the other mod

$size = sizeof($table_cost);
$shipping = 0;
if($size > 2) {
for ($i=0, $n=$size; $i<$n; $i+=2) {
if ($order_total <= $table_cost[$i]) {
$shipping = $table_cost[$i+1];
break;
}
}
} else {
if ($table_cost[0] > 0) {
$shipping = $order_total * $table_cost[1] / $table_cost[0];
}
}

and that works fine, but the second rate below does not. The charges come up as $0.00, but there is a rate of 1:1.75 set in the database. It is basically the same as above, but I changed all the table_cost with table_cost_2day:

$size = sizeof($table_cost_2day);
for ($i=0, $n=$size; $i<$n; $i+=2) {
if ($order_total <= $table_cost_2day[$i]) {
$shipping = $table_cost_2day[$i+1];
break;
}
}

with

$size = sizeof($table_cost_2day);
$shipping = 0;
if($size > 2) {
for ($i=0, $n=$size; $i<$n; $i+=2) {
if ($order_total <= $table_cost_2day[$i]) {
$shipping = $table_cost_2day[$i+1];
break;
}
}
} else {
if ($table_cost_2day[0] > 0) {
$shipping = $order_total * $table_cost_2day[1] / $table_cost_2day[0];
}
}

Link to comment
Share on other sites

I decided to do this a different way. I copied the table.php file and renamed everywhere I saw table, except for database tables, to create an exact duplicate of the table function. Then I put one rate in one, and one in the other.

Link to comment
Share on other sites

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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