Skip to content

Commit

Permalink
carriers check max dimensions
Browse files Browse the repository at this point in the history
check product max dimensions for experimental carrier info
  • Loading branch information
Casper-O committed Jul 10, 2021
1 parent 85c9733 commit d384cc1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions gshoppingflux/gshoppingflux.php
Original file line number Diff line number Diff line change
Expand Up @@ -2642,6 +2642,26 @@ private function getItemXML($product, $lang, $id_curr, $id_shop, $combination =
$carrier = is_object($carrier) ? $carrier : new Carrier($carrier['id_carrier']);
$carrier_tax = Tax::getCarrierTaxRate((int)$carrier->id);
$shipping = (float)0;

if($carrier->max_width > 0 || $carrier->max_height > 0 || $carrier->max_depth > 0 || $carrier->max_weight > 0)
{
$carrierSizes = [(int) $carrier->max_width, (int) $carrier->max_height, (int) $carrier->max_depth];
$productSizes = [(int) $product['width'], (int) $product['height'], (int) $product['depth']];
rsort($carrierSizes, SORT_NUMERIC);
rsort($productSizes, SORT_NUMERIC);
if (($carrierSizes[0] > 0 && $carrierSizes[0] < $productSizes[0])
|| ($carrierSizes[1] > 0 && $carrierSizes[1] < $productSizes[1])
|| ($carrierSizes[2] > 0 && $carrierSizes[2] < $productSizes[2])
) {
unset($carriers[$index]);
break;
}
if($carrier->max_weight > 0 && $carrier->max_weight < $product['weight'])
{
unset($carriers[$index]);
break;
}
}
if (!(((float)$shipping_free_price > 0) && ($product['price'] >= (float)$shipping_free_price)) &&
!(((float)$shipping_free_weight > 0) && ($product['weight'] >= (float)$shipping_free_weight))) {
if (isset($this->ps_shipping_handling) && $carrier->shipping_handling) {
Expand Down

0 comments on commit d384cc1

Please sign in to comment.