Back to PhocacartShipping class

Method getUserRegionShipping

public static
getUserRegionShipping
(mixed $dataAddress)

Method getUserRegionShipping - Source code

public static function getUserRegionShipping($dataAddress)
{
    $pC = PhocacartUtils::getComponentParameters();
    $shipping_region_rule = $pC->get('shipping_region_rule', 1);
    $region = 0;
    switch ($shipping_region_rule) {
        case 2:
            if (isset($dataAddress['sregion']) && (int) $dataAddress['sregion']) {
                $region = (int) $dataAddress['sregion'];
            }
            break;
        case 3:
            if (isset($dataAddress['bregion']) && (int) $dataAddress['bregion']) {
                $region = (int) $dataAddress['bregion'];
            } else {
                if (isset($dataAddress['sregion']) && (int) $dataAddress['sregion']) {
                    $region = (int) $dataAddress['sregion'];
                }
            }
            break;
        case 4:
            if (isset($dataAddress['sregion']) && (int) $dataAddress['sregion']) {
                $region = (int) $dataAddress['sregion'];
            } else {
                if (isset($dataAddress['bregion']) && (int) $dataAddress['bregion']) {
                    $region = (int) $dataAddress['bregion'];
                }
            }
            break;
        case 1:
        default:
            if (isset($dataAddress['bregion']) && (int) $dataAddress['bregion']) {
                $region = (int) $dataAddress['bregion'];
            }
            break;
    }
    return $region;
}