Index: branches/5.2.x/units/orders/orders_config.php =================================================================== diff -u -N -r14808 -r14815 --- branches/5.2.x/units/orders/orders_config.php (.../orders_config.php) (revision 14808) +++ branches/5.2.x/units/orders/orders_config.php (.../orders_config.php) (revision 14815) @@ -1,6 +1,6 @@ 'kPasswordFormatter', 'encryption_method' => 'md5', 'verify_field' => 'VerifyUserPassword', 'skip_empty' => 1, 'default' => 'd41d8cd98f00b204e9800998ecf8427e' ), + + // for "Shipping Info" step during Checkout + 'ShippingTypeId' => Array ('type' => 'array', 'default' => ''), ), 'Grids' => Array ( 'Default' => Array ( Index: branches/5.2.x/units/shipping/shipping_tag_processor.php =================================================================== diff -u -N -r14258 -r14815 --- branches/5.2.x/units/shipping/shipping_tag_processor.php (.../shipping_tag_processor.php) (revision 14258) +++ branches/5.2.x/units/shipping/shipping_tag_processor.php (.../shipping_tag_processor.php) (revision 14815) @@ -1,6 +1,6 @@ Application->Parser->GetParam('limit_types'); - $this->Application->recallObject('ShippingQuoteEngine'); + $this->Application->recallObject('ShippingQuoteEngine'); // TODO: why call this here? + $quote_engine_collector =& $this->Application->recallObject('ShippingQuoteCollector'); + /* @var $quote_engine_collector ShippingQuoteCollector */ - $shipping_quote_params = Array( - 'dest_country' => $user_country_id, - 'dest_state' => $user_state_id, - 'dest_postal' => $user_zip, - 'dest_city' => $user_city, - 'dest_addr1' => $user_addr1, - 'dest_addr2' => $user_addr2, - 'dest_name' => $user_name, - 'packages' => Array( - Array( - 'package_key' => 'package1', - 'weight' => $weight, - 'weight_unit' => 'KG', - 'length' => '', - 'width' => '', - 'height' => '', - 'dim_unit' => 'IN', - 'packaging' => 'BOX', - 'contents' => 'OTR', - 'insurance' => '0' - ), - ), - 'amount' => $amount, - 'items' => $items, - 'limit_types' => $limit_types, - 'promo_params' => Array ( - 'items' => $promo_items, - 'amount' => $promo_amount, - 'weight' => $promo_weight, - ) - ); + $shipping_quote_params = Array ( + 'dest_country' => $user_country_id, + 'dest_state' => $user_state_id, + 'dest_postal' => $user_zip, + 'dest_city' => $user_city, + 'dest_addr1' => $user_addr1, + 'dest_addr2' => $user_addr2, + 'dest_name' => $user_name, + 'packages' => Array ( + Array ( + 'package_key' => 'package1', + 'weight' => $weight, + 'weight_unit' => 'KG', + 'length' => '', + 'width' => '', + 'height' => '', + 'dim_unit' => 'IN', + 'packaging' => 'BOX', + 'contents' => 'OTR', + 'insurance' => '0' + ), + ), + 'amount' => $amount, + 'items' => $items, + 'limit_types' => $limit_types, + 'promo_params' => Array ( + 'items' => $promo_items, + 'amount' => $promo_amount, + 'weight' => $promo_weight, + ) + ); $shipping_types = $quote_engine_collector->GetShippingQuotes($shipping_quote_params); $last_shippings = $this->Application->RecallVar('LastShippings'); - if($last_shippings) - { + if ( $last_shippings ) { $last_shippings = unserialize($last_shippings); } $order_object =& $this->Application->recallObject('ord'); + /* @var $order_object OrdersItem */ + $original_shipping = $order_object->GetDBField('ShippingInfo'); $original_shipping = unserialize($original_shipping); $shipping_type_keys = array_keys($shipping_types); + if( getArrayValue($original_shipping, $package_id, 'ShippingId') && ( $this->Application->isAdminUser || in_array( $original_shipping[$package_id]['ShippingId'], $shipping_type_keys ) ) ) { @@ -235,8 +239,7 @@ } $last_shippings[$package_id] = $shipping_types; - if( $this->Application->isAdminUser && $key) - { + if ( $this->Application->isAdminUser && $key ) { $orig_name = ltrim($last_shippings[$package_id][$key]['ShippingName'], 'Original: '); $last_shippings[$package_id][$key]['ShippingName'] = $orig_name; } @@ -246,28 +249,32 @@ $def_block_params = Array(); $def_block_params['name'] = $this->SelectParam($params, 'render_as,block'); - if(!count($shipping_types)) - { + if ( !count($shipping_types) ) { $this->Application->SetVar('ItemShipmentsExists', 0); - $o = ''; + + return ''; } - else - { - $lang =& $this->Application->recallObject('lang.current'); - foreach ($shipping_types as $shipping_type) { - $shipping_type['ShippingFree'] = ($shipping_type['TotalCost'] == 0)? 1 : 0; - $iso = $this->GetISO($params['currency']); - $amount = $this->ConvertCurrency($shipping_type['TotalCost'], $iso); - $amount = $lang->formatNumber($amount,2); - $shipping_type['TotalCost'] = $this->AddCurrencySymbol($amount, $iso); + $lang =& $this->Application->recallObject('lang.current'); + /* @var $lang LanguagesItem */ - $block_params = array_merge($def_block_params, $shipping_type); - $block_params['selected'] = $shipping_type['ShippingId'] == $selected_id ? 'selected' : ''; - if (isset($params['selected_only']) && $block_params['selected'] == '') continue; - $o .= $this->Application->ParseBlock($block_params); + foreach ($shipping_types as $shipping_type) { + $shipping_type['ShippingFree'] = ($shipping_type['TotalCost'] == 0) ? 1 : 0; + $iso = $this->GetISO($params['currency']); + $amount = $this->ConvertCurrency($shipping_type['TotalCost'], $iso); + $amount = $lang->formatNumber($amount, 2); + $shipping_type['TotalCost'] = $this->AddCurrencySymbol($amount, $iso); + + $block_params = array_merge($def_block_params, $shipping_type); + $block_params['selected'] = $shipping_type['ShippingId'] == $selected_id ? 'selected' : ''; + + if ( isset($params['selected_only']) && $block_params['selected'] == '' ) { + continue; } + + $o .= $this->Application->ParseBlock($block_params); } + return $o; }