Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shipping by percentage


Danny Carlton

Recommended Posts

There may have been an easier way, but this is how I solved it:

 

includes\modules\shipping\table.php

 

changed

 

        if ($order_total <= $table_cost[$i]) {
         $shipping = $table_cost[$i+1];
         break;
       }

 

to

 

        if (strstr($table_cost[$i+1], '%'))
         {
         $per=str_replace('%', '', $table_cost[$i+1]);
         $per=$per/100;
         $this_shipping=$order_total*$per;
         }
       else{$this_shipping=$table_cost[$i+1];}

       if ($order_total <= $table_cost[$i]) {
         $shipping = $this_shipping;
         break;
       }

 

Then added the highest amount on the table (I use 1,000,000) and set it as 1000000:8%. The entire table is '10:2.00,25:4.00,50:6.00,100:7.00,1000000:8%' which charged $2 for everything $10 and under, so on so forth and 8% if the total is over $100. Of course this means any order of over one million dollars will have free shipping, but I have a feeling the client won't mind that.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...