Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Individual Product Shipping Prices - Multiple Items


psyphris

Recommended Posts

Hey Everyone, I did some searching and couldn't find the answer to my question.

 

I just installed Individual Product Shipping Prices 1.0 and it is working great. I would like to modify the shipping calculator so that it uses the most expensive base price and then the additional price for the rest of the items.

 

Example:

 

Currently Happening:

 

Shoes ship @ 9.99 for first item, 4.99 for each additional, shirts ship @ 3.99 and 1.99/additional

 

2 x Nike = 9.99 + 4.99

2 x Shirt = 3.99 + 1.99

 

Total Shipping = 20.96

 

What I want to happen:

 

2 x Nike = 9.99 + 4.99

2 x Shirt = 1.99 + 1.99

 

Total Shipping = 18.96

 

Basically, it will use the most expensive base price and then every other item will be included at their additional price. Is there anyone out there that knows a way to do this? Thanks!

Link to comment
Share on other sites

I had a similar request from a client and came up with the following.

 

You need to change includes\classes\shipping.php module

 

Insert only the code delimited by the // BB Start and // BB End, the other code should serve to indicate where in the file you need to add this - around about line 84(ish):

 

//phpmom.com// find shiptotoal and indvcount(# of products with indv shipping//
function get_shiptotal() {
global $cart;
$this->shiptotal = '';
$products = $cart->get_products();

// BB Start - Set first shipping price = second shipping price for all prods other than first prod with max shipping price - Start by determining index of max shipping price
$maxship = '0';
$i_maxship = 0;
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
if (($products[$i]['products_ship_price']) > $maxship) {
$maxship = ($products[$i]['products_ship_price']);
$i_maxship = $i;
}
}
// Here we set all ship prices to second ship price for entries other than the index determined above
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
if ($i != $i_maxship) {
$products[$i]['products_ship_price'] = $products[$i]['products_ship_price_two'];
}
}


// BB End - Set first shipping price


for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// mod indvship//modified hadir
// if ($products[$i]['products_ship_price']) {
$products_ship_price = $products[$i]['products_ship_price'];//}
$products_ship_price_two = $products[$i]['products_ship_price_two'];
$products_ship_zip = $products[$i]['products_ship_zip'];

 

So I found this and tried to implement it but it doesn't seem to work. Is there anything that could have been changed in updates to prevent this from working?

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