faqts : Computers : Software : FreeTrade : Customization

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 1 people (100%) answered Yes

Entry

How do I make mulitple shipping charges?

Jul 24th, 2000 15:46
Nicky Hurst,


To create this there is really only one file that you must modify.
Open your ShippingByTotal file (located in the include directory).
After:

function ShippingByTotal($Total)
{

add the following command:

global $ship_Method;

Now for each differant method you want to use, add IF, ELSEIF, and ELSE 
statements to create your differant price breaks for each shipping 
method.  For instance  One of the variations that I used to do this was 
(change word_price_break to your cost ie. 25.00 for $25.00) (change 
shipping_price to whatever the price will be for that amount ie 26.50 
for $26.50):

function ShippingByTotal($Total)
{
global $ship_Method;
IF ($ship_Method==1)
  {
    if($Total <= first_price_break)
    {
      $Shipping = shipping_price;
    }
      elseif($Total <= second_price_break)
    {
      $Shipping = shipping_price;
    }
      elseif($Total <= third_price_break)
    {
      $Shipping = shipping_price;
    }
      elseif($Total <= fourth_price_break)
    {
      $Shipping = shipping_price;
    }
    else
    {
      $D = ($Total/100);
      $S = round( "$D" );
      $F = ($S*5);
        if($S <= 0)
        {
	  $Shipping = shipping_price;
	}
	else
	{
	   $Shipping = $F;
	}
     }
   }

When you add another method, make sure you call its IDin the IF 
statements:
IF ($ship_Method==1)
ELSEIF ($ship_Method==2)
ELSEIF ($ship_Method==3)
You get the point.
Once you do this for however many shipping methods you need to use, and 
whatever price break scheme you need, make sure you keep :

return($Shipping);
}      

?>

at the very end of the page.  

Also, make sure you add whatever the names of the shipping methods are 
to your shipping_method table. (This way your users can actually see 
the options available to them).  

I do belive this was all I did to create this option, thus far at 
least.  

Note * There might still be some bugs with this that I have not gotten 
to test yet and if I come across any, I will post info on fixing them 
(if I figure out how to of course) here.