Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with a liitle code please


jpldisplays

Recommended Posts

Hi all,

 

Wondering if someone can assist me with a little mod I am trying to make to one of the shipping contributions.

 

This little bit of code looks up the size of the box in my admin but I am trying to break it up into different size boxes based on the total weight.

 

if ($delivery_weight >= 7.0) {

$swidth = MODULE_SHIPPING_AUSPOST_SWIDTH;

$sheight = MODULE_SHIPPING_AUSPOST_SHEIGHT;

$slength = MODULE_SHIPPING_AUSPOST_SDEPTH;

} elseif ($delivery_weight > 5.0) and ($delivery_weight < 7.0) {

$swidth = "270";

$sheight = "210";

$slength = "370";

} elseif ($delivery_weight > 3.0) and ($delivery_weight <= 5.0) {

$swidth = "310";

$sheight = "110";

$slength = "370";

} elseif ($delivery_weight > 0.9) and ($delivery_weight <= 3.0) {

$swidth = "185";

$sheight = "135";

$slength = "235";

} else {

$swidth = "100";

$sheight = "100";

$slength = "100";

}

 

My problem is that it does not seem to like the and function, can someone tell me how this should read..

 

Thanks in advance!!

Link to comment
Share on other sites

switch (true){
case ($delivery_weight >= 7.0):
 $swidth = MODULE_SHIPPING_AUSPOST_SWIDTH;
 $sheight = MODULE_SHIPPING_AUSPOST_SHEIGHT;
 $slength = MODULE_SHIPPING_AUSPOST_SDEPTH;
 break;
case ($delivery_weight > 5.0) and ($delivery_weight < 7.0):
 $swidth = "270";
 $sheight = "210";
 $slength = "370";
 break;
case ($delivery_weight > 3.0) and ($delivery_weight <= 5.0):
 $swidth = "310";
 $sheight = "110";
 $slength = "370";
 break;
case ($delivery_weight > 0.9) and ($delivery_weight <= 3.0):
 $swidth = "185";
 $sheight = "135";
 $slength = "235";
 break;
default:
 $swidth = "100";
 $sheight = "100";
 $slength = "100";
 break;
} # end switch

 

Bobby

Link to comment
Share on other sites

if ($delivery_weight >= 7.0) 
{
 $swidth = MODULE_SHIPPING_AUSPOST_SWIDTH;  
 $sheight = MODULE_SHIPPING_AUSPOST_SHEIGHT;
 $slength = MODULE_SHIPPING_AUSPOST_SDEPTH;
} 
elseif (($delivery_weight > 5.0) and ($delivery_weight < 7.0)) 
{
 $swidth = "270";
 $sheight = "210";
 $slength = "370";
} 
elseif (($delivery_weight > 3.0) and ($delivery_weight <= 5.0)) 
{
 $swidth = "310";
 $sheight = "110";
 $slength = "370";
} 
elseif (($delivery_weight > 0.9) and ($delivery_weight <= 3.0)) 
{
 $swidth = "185";
 $sheight = "135";
 $slength = "235";
} 
else 
{
 $swidth = "100";
 $sheight = "100";
 $slength = "100";
}

Your online success is Paramount.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...