Last active
December 16, 2015 04:29
-
-
Save dtbaker/5377796 to your computer and use it in GitHub Desktop.
working out if a product fits within the max dimensions for a "letter" delivery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// work out if we're doing a letter or parcel delivery | |
// Letter max is 26cm x 36cm x 2cm / 0.5kg | |
// everything larger will be parcel. | |
$max_dimensions = array(2,26,36); | |
if($calculate_product['weight']<=0.5){ | |
$product_dimensions = array($calculate_product['length'],$calculate_product['width'],$calculate_product['height']); | |
sort($product_dimensions); | |
$is_letter = ( | |
$product_dimensions[0]<=$max_dimensions[0] && | |
$product_dimensions[1]<=$max_dimensions[1] && | |
$product_dimensions[2]<=$max_dimensions[2] | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment