Index: branches/5.2.x/units/shipping_quote_engines/shipping_quote_collector.php =================================================================== diff -u -N -r16527 -r16640 --- branches/5.2.x/units/shipping_quote_engines/shipping_quote_collector.php (.../shipping_quote_collector.php) (revision 16527) +++ branches/5.2.x/units/shipping_quote_engines/shipping_quote_collector.php (.../shipping_quote_collector.php) (revision 16640) @@ -1,6 +1,6 @@ applyLimitations($shipping_types, $limit_types); } // exclude Selected Products Only shipping types, not matching products @@ -108,6 +86,39 @@ return $shipping_types; } + /** + * Applies limitations to shipping types + * + * @param array $shipping_types Shipping types. + * @param array $limit_types Limit types. + * + * @return array + */ + protected function applyLimitations(array $shipping_types, array $limit_types) + { + $available_types = array(); + + foreach ( $shipping_types as $a_type ) { + $include = false; // Exclude by default. + + foreach ( $limit_types as $limit ) { + $include = $include || preg_match('/^' . $limit . '/', $a_type['ShippingId']); + + if ( $include ) { + break; + } + } + + if ( !$include ) { + continue; + } + + $available_types[$a_type['ShippingId']] = $a_type; + } + + return $available_types; + } + function GetAvailableShippingTypes() { $shipping_types = Array ();