motorcity Posted March 31, 2011 Share Posted March 31, 2011 The goal here is to update UPSXML with Dimensional support for Multi Vendor Shipping. Let's start off with some links; Main Contribution page for downloading MVS Multi Vendor Shipping Discussion thread for MVS Go here for Multi Vendor Shipping Support Main Contribution page for downloading UPS XML Rates and Services v1.0 UPSXML Discussion thread for the shipping module UPS XML Rates and Services I started off by loading up UPS XML rates & services 1.3.8 on a bare bones RC2a install - it works fine out of the box, I didn't go into the dimensional stuff there however. I used Winmerge to try to carve out the mvs additions to the module file. That file and admin/categories.php are the only ones I had to modify to load it up in a test site that already has MVS & had the old UPS Dimensional running. It doesn't work yet. I've been working my way through all the parse errors but I'm stuck for the moment. Quote Link to comment Share on other sites More sharing options...
motorcity Posted March 31, 2011 Author Share Posted March 31, 2011 I'm surprised. I didn't know the forum restricts posts being too long. Here's a marked up version of what I have so far... //begin mvs } function access_key($vendors_id='1') { $this->access_key = constant('MODULE_SHIPPING_UPSXML_RATES_ACCESS_KEY_' . $vendors_id); return $this->access_key; } function access_username($vendors_id='1') { $this->access_username = constant('MODULE_SHIPPING_UPSXML_RATES_USERNAME_' . $vendors_id); return $this->access_username; } function access_password($vendors_id='1') { $this->access_password = constant('MODULE_SHIPPING_UPSXML_RATES_PASSWORD_' . $vendors_id); return $this->access_password; } function origin($vendors_id='1') { $this->origin = constant('MODULE_SHIPPING_UPSXML_RATES_ORIGIN_' . $vendors_id); return $this->origin; } function origin_city($vendors_id='1') { $this->origin_city = constant('MODULE_SHIPPING_UPSXML_RATES_CITY_' . $vendors_id); return $this->origin_city; } function origin_stateprov($vendors_id='1') { $this->origin_stateprov = constant('MODULE_SHIPPING_UPSXML_RATES_STATEPROV_' . $vendors_id); return $this->origin_stateprov; } function origin_country($vendors_id='1') { $this->origin_country = constant('MODULE_SHIPPING_UPSXML_RATES_COUNTRY_' . $vendors_id); return $this->origin_country; } function origin_postalcode($vendors_id='1') { $this->origin_postalcode = constant('MODULE_SHIPPING_UPSXML_RATES_POSTALCODE_' . $vendors_id); return $this->origin_postalcode; } function pickup_method($vendors_id='1') { $this->pickup_method = constant('MODULE_SHIPPING_UPSXML_RATES_PICKUP_METHOD_' . $vendors_id); return $this->pickup_method; } function package_type($vendors_id='1') { $this->package_type = constant('MODULE_SHIPPING_UPSXML_RATES_PACKAGE_TYPE_' . $vendors_id); return $this->package_type; } function unit_weight($vendors_id='1') { $this->unit_weight = constant('MODULE_SHIPPING_UPSXML_RATES_UNIT_WEIGHT_' . $vendors_id); return $this->unit_weight; } function unit_length($vendors_id='1') { $this->unit_length = constant('MODULE_SHIPPING_UPSXML_RATES_UNIT_LENGTH_' . $vendors_id); return $this->unit_length; } function handling_fee($vendors_id='1') { $this->handling_fee = constant('MODULE_SHIPPING_UPSXML_RATES_HANDLING_' . $vendors_id); return $this->handling_fee; } function quote_type($vendors_id='1') { $this->quote_type = constant('MODULE_SHIPPING_UPSXML_RATES_QUOTE_TYPE_' . $vendors_id); return $this->quote_type; } function customer_classification($vendors_id='1') { $this->customer_classification = constant('MODULE_SHIPPING_UPSXML_RATES_CUSTOMER_CLASSIFICATION_CODE_' . $vendors_id); return $this->customer_classification; } function host($vendors_id) { $this->host = @constant('MODULE_SHIPPING_UPSXML_RATES_TEST_MODE_' . $vendors_id) == 'Test' ? 'wwwcie.ups.com' : 'wwwcie.ups.com'; return $this->host; } function sort_order($vendors_id='1') { $sort_order = @constant ('MODULE_SHIPPING_UPSXML_RATES_SORT_ORDER_' . $vendors_id); if (isset ($sort_order)) { $this->sort_order = $sort_order; } else { $this->sort_order = '-'; } return $this->sort_order; } function tax_class($vendors_id='1') { $this->tax_class = constant('MODULE_SHIPPING_UPSXML_RATES_TAX_CLASS_' . $vendors_id); return $this->tax_class; } function enabled($vendors_id='1') { $this->enabled = false; $status = @constant('MODULE_SHIPPING_UPSXML_RATES_STATUS_' . $vendors_id); if (isset ($status) && $status != '') { $this->enabled = (($status == 'True') ? true : false); } if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_UPSXML_RATES_ZONE_' . $vendors_id) > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_UPSXML_RATES_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_country_id . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $this->delivery_zone_id) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; }//if }//if return $this->enabled; } function zones($vendors_id='1') { if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_UPSXML_RATES_ZONE_' . $vendors_id) > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_UPSXML_RATES_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_zone_id . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $this->delivery_zone_id) { $check_flag = true; break; } //if }//while if ($check_flag == false) { $this->enabled = false; }//if }//if return $this->enabled; }//function // class methods function quote($method = '', $module = '', $vendors_id = '1') { //end mvs global $HTTP_POST_VARS, $order, $shipping_weight, $shipping_num_boxes, $total_weight, $boxcount, $cart, $packing; // UPS purports that if the origin is left out, it defaults to the account's location. Yeah, right. $state = $order->delivery['state']; $zone_query = tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_name = '" . tep_db_input($order->delivery['state']) . "' and zone_country_id = '" . $order->delivery['country']['id'] . "'"); if (tep_db_num_rows($zone_query)) { $zone = tep_db_fetch_array($zone_query); $state = $zone['zone_code']; } //begin mvs $this->_upsOrigin(constant('MODULE_SHIPPING_UPSXML_RATES_CITY_' . $vendors_id), constant('MODULE_SHIPPING_UPSXML_RATES_STATEPROV_' . $vendors_id), constant('MODULE_SHIPPING_UPSXML_RATES_COUNTRY_' . $vendors_id), constant('MODULE_SHIPPING_UPSXML_RATES_POSTALCODE_' . $vendors_id)); //end mvs //begin mvs $_upsGetTimeServicesResult = $this->_upsGetTimeServices($vendors_id); //end mvs if ($_upsGetTimeServicesResult != false && is_array($_upsGetTimeServicesResult)) { $this->servicesTimeintransit = $_upsGetTimeServicesResult; } if ($this->logfile) { error_log("------------------------------------------\n", 3, $this->logfile); error_log("Time in Transit: " . $this->timeintransit . "\n", 3, $this->logfile); } } // end if ($this->timeInTransitView != 'Not') // EOF Time In Transit //begin mvs $upsQuote = $this->_upsGetQuote($vendors_id); //end mvs if ((is_array($upsQuote)) && (sizeof($upsQuote) > 0)) { if (defined('MODULE_SHIPPING_UPSXML_WEIGHT1') && MODULE_SHIPPING_UPSXML_WEIGHT1 == 'False') { $this->quotes = array('id' => $this->code, 'module' => $this->title); usort($upsQuote, array($this, "rate_sort_func")); } else { if ($this->dimensions_support > 0) { $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $this->boxCount . ($this->boxCount > 1 ? ' pkgs, ' : ' pkg, ') . ceil($totalWeight) . ' ' . strtolower($this->unit_weight) . ' total)'); } else { $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ($this->boxCount > 1 ? ' pkgs x ' : ' pkg x ') . ceil($shipping_weight) . ' ' . strtolower($this->unit_weight) . ' total)'); } usort($upsQuote, array($this, "rate_sort_func")); } // end else/if if (defined('MODULE_SHIPPING_UPSXML_WEIGHT1') $methods = array(); for ($i=0; $i < sizeof($upsQuote); $i++) { list($type, $cost) = each($upsQuote[$i]); if (strpos($type, ' (')) { $basetype = substr($type, 0, strpos($type, ' (')); } else { $basetype = $type; } // BOF limit choices, behaviour changed from versions < 1.2 //begin mvs if ($this->exclude_choices($basetype, $vendors_id)) continue; //end mvs // EOF limit choices if ( $method == '' || $method == $basetype ) { $_type = $type; if ($this->timeInTransitView == "Raw") { if (isset($this->servicesTimeintransit[$basetype])) { $_type = $_type . ", ".$this->servicesTimeintransit[$basetype]["date"]; } } else { if (isset($this->servicesTimeintransit[$basetype])) { $eta_array = explode("-", $this->servicesTimeintransit[$basetype]["date"]); $months = array (" ", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); $eta_arrival_date = $months[(int)$eta_array[1]]." ".$eta_array[2].", ".$eta_array[0]; $_type .= ", <acronym title='Estimated Delivery Date'>EDD</acronym>: ".$eta_arrival_date; } } // changed to make handling percentage based if ($this->handling_type == "Percentage") { if ($_type) $methods[] = array('id' => $basetype, 'title' => $_type, 'cost' => ((($this->handling_fee * $cost)/100) + $cost)); } else { if ($_type) $methods[] = array('id' => $basetype, 'title' => $_type, 'cost' => ($this->handling_fee + $cost)); } } } //begin mvs if ($this->tax_class($vendors_id) > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class($vendors_id), $order->delivery['country']['id'], $order->delivery['zone_id']); } //end mvs $this->quotes['methods'] = $methods; } else { if ( $upsQuote != false ) { $errmsg = $upsQuote; } else { $errmsg = MODULE_SHIPPING_UPSXML_RATES_TEXT_UNKNOWN_ERROR; } $errmsg .= '<br>' . MODULE_SHIPPING_UPSXML_RATES_TEXT_IF_YOU_PREFER . ' ' . STORE_NAME.' via <a href="mailto:'.STORE_OWNER_EMAIL_ADDRESS.'"><u>Email</u></a>.'; $this->quotes = array('module' => $this->title, 'error' => $errmsg); } if (tep_not_null($this->icon)) { $this->quotes['icon'] = tep_image($this->icon, $this->title); } return $this->quotes; } //************** //begin mvs function check($vendors_id='1') { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_UPSXML_RATES_STATUS_" . $vendors_id . "'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } //end mvs //************** //begin mvs function install($vendors_id='1') { tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable UPS Shipping', 'MODULE_SHIPPING_UPSXML_RATES_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer UPS shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('UPS Rates Access Key', 'MODULE_SHIPPING_UPSXML_RATES_ACCESS_KEY_" . $vendors_id . "', '', 'Enter the XML rates access key assigned to you by UPS.', '6', '1', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('UPS Rates Username', 'MODULE_SHIPPING_UPSXML_RATES_USERNAME_" . $vendors_id . "', '', 'Enter your UPS Services account username.', '6', '2', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('UPS Rates Password', 'MODULE_SHIPPING_UPSXML_RATES_PASSWORD_" . $vendors_id . "', '', 'Enter your UPS Services account password.', '6', '3', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Pickup Method', 'MODULE_SHIPPING_UPSXML_RATES_PICKUP_METHOD_" . $vendors_id . "', 'Daily Pickup', 'How do you give packages to UPS (only used when origin is US)?', '6', '4', 'tep_cfg_select_option(array(\'Daily Pickup\', \'Customer Counter\', \'One Time Pickup\', \'On Call Air Pickup\', \'Letter Center\', \'Air Service Center\', \'Suggested Retail Rates (UPS Store)\'), ', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Packaging Type', 'MODULE_SHIPPING_UPSXML_RATES_PACKAGE_TYPE_" . $vendors_id . "', 'Package', 'What kind of packaging do you use?', '6', '5', 'tep_cfg_select_option(array(\'Package\', \'UPS Letter\', \'UPS Tube\', \'UPS Pak\', \'UPS Express Box\', \'UPS 25kg Box\', \'UPS 10kg box\'), ', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Customer Classification Code', 'MODULE_SHIPPING_UPSXML_RATES_CUSTOMER_CLASSIFICATION_CODE_" . $vendors_id . "', '01', '01 - If you are billing to a UPS account and have a daily UPS pickup, 03 - If you do not have a UPS account or you are billing to a UPS account but do not have a daily pickup, 04 - If you are shipping from a retail outlet (only used when origin is US)', '6', '6', 'tep_cfg_select_option(array(\'01\', \'03\', \'04\'), ', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Shipping Origin', 'MODULE_SHIPPING_UPSXML_RATES_ORIGIN_" . $vendors_id . "', 'US Origin', 'What origin point should be used (this setting affects only what UPS product names are shown to the user)', '6', '7', 'tep_cfg_select_option(array(\'US Origin\', \'Canada Origin\', \'European Union Origin\', \'Puerto Rico Origin\', \'Mexico Origin\', \'All other origins\'), ', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Origin City', 'MODULE_SHIPPING_UPSXML_RATES_CITY_" . $vendors_id . "', '', 'Enter the name of the origin city.', '6', '8', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Origin State/Province', 'MODULE_SHIPPING_UPSXML_RATES_STATEPROV_" . $vendors_id . "', '', 'Enter the two-letter code for your origin state/province.', '6', '9', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Origin Country', 'MODULE_SHIPPING_UPSXML_RATES_COUNTRY_" . $vendors_id . "', '', 'Enter the two-letter code for your origin country.', '6', '10', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Origin Zip/Postal Code', 'MODULE_SHIPPING_UPSXML_RATES_POSTALCODE_" . $vendors_id . "', '', 'Enter your origin zip/postalcode.', '6', '11', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Test or Production Mode', 'MODULE_SHIPPING_UPSXML_RATES_MODE_" . $vendors_id . "', 'Test', 'Use this module in Test or Production mode?', '6', '12', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', now(), '" . $vendors_id . "')"); // three configuration options were moved to shop Configuration -> Shipping/Packaging in v1.3.0 // those are (and were renamed to -> ): // MODULE_SHIPPING_UPSXML_RATES_UNIT_WEIGHT (LBS/KG) -> SHIPPING_UNIT_WEIGHT // MODULE_SHIPPING_UPSXML_RATES_UNIT_LENGTH (IN/CM) -> SHIPPING_UNIT_LENGTH // MODULE_SHIPPING_UPSXML_DIMENSIONS_SUPPORT -> SHIPPING_DIMENSIONS_SUPPORT tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Quote Type', 'MODULE_SHIPPING_UPSXML_RATES_QUOTE_TYPE_" . $vendors_id . "', 'Commercial', 'Quote for Residential or Commercial Delivery', '6', '15', 'tep_cfg_select_option(array(\'Commercial\', \'Residential\'), ', now())"); // next three keys added to be able to use negotiated rates (available from UPS since about July 2006) tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Negotiated rates', 'MODULE_SHIPPING_UPSXML_RATES_USE_NEGOTIATED_RATES_" . $vendors_id . "', 'False', 'Do you receive discounted rates from UPS and want to use these for shipping quotes? <b>Note:</b> You need to enter your UPS account number below.', '6', '25', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Manual Negotiated Rate', 'MODULE_SHIPPING_UPSXML_RATES_MANUAL_NEGOTIATED_RATE_" . $vendors_id . "', '1', 'Enter a negotiated rate manually. <b>Note:</b> If \'Negotiated Rates\' above is set to \'True\', This <b>WILL NOT</b> be applied. If using this option, set \'Negotiated Rates\' to \'False\'. Usage: \' 57 \' returns 57% of published UPS rate.', '6', '26', now(), NULL, NULL, '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('UPS Account Number', 'MODULE_SHIPPING_UPSXML_RATES_UPS_ACCOUNT_NUMBER_" . $vendors_id . "', '', 'Enter your UPS Account number when you have and want to use negotiated rates.', '6', '27', now())"); // added for handling type selection tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Handling Type', 'MODULE_SHIPPING_UPSXML_HANDLING_TYPE_" . $vendors_id . "', 'Flat Fee', 'Handling type for this shipping method.', '6', '14', 'tep_cfg_select_option(array(\'Flat Fee\', \'Percentage\'), ', now())"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Handling Fee', 'MODULE_SHIPPING_UPSXML_RATES_HANDLING_" . $vendors_id . "', '0', 'Handling fee for this shipping method.', '6', '16', now())"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('UPS Currency Code', 'MODULE_SHIPPING_UPSXML_CURRENCY_CODE_" . $vendors_id . "', '', 'Enter the 3 letter currency code for your country of origin. United States (USD)', '6', '2', now())"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Insurance', 'MODULE_SHIPPING_UPSXML_INSURE_" . $vendors_id . "', 'True', 'Do you want to insure packages shipped by UPS?', '6', '22', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id) values ('Tax Class', 'MODULE_SHIPPING_UPSXML_RATES_TAX_CLASS_" . $vendors_id . "', '0', 'Use the following tax class on the shipping fee.', '6', '17', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id) values ('Shipping Zone', 'MODULE_SHIPPING_UPSXML_RATES_ZONE_" . $vendors_id . "', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '18', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Sort order of display.', 'MODULE_SHIPPING_UPSXML_RATES_SORT_ORDER_" . $vendors_id . "', '0', 'Sort order of display. Lowest is displayed first.', '6', '19', now())"); // add key for disallowed shipping methods tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id) values ('Disallowed Shipping Methods', 'MODULE_SHIPPING_UPSXML_TYPES_" . $vendors_id . "', '', 'Select the UPS services <span style=\'color: red; font-weight: bold\'>not</span> to be offered.', '6', '20', 'get_multioption_upsxml', 'upsxml_cfg_select_multioption_indexed(array(\'US_01\', \'US_02\', \'US_03\', \'US_07\', \'US_54\', \'US_08\', \'CAN_01\', \'US_11\', \'US_12\', \'US_13\', \'US_14\', \'CAN_02\', \'US_59\', \'US_65\', \'CAN_14\', \'MEX_54\', \'EU_82\', \'EU_83\', \'EU_84\', \'EU_85\', \'EU_86\'), ', now())"); // add key for shipping delay, changed the constant from SHIPPING_DAYS_DELAY in v1.3.0 tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, vendors_id, use_function, set_function) values ('Shipping Delay', 'MODULE_SHIPPING_UPSXML_SHIPPING_DAYS_DELAY_" . $vendors_id . "', '1', 'How many days from when an order is placed to when you ship it (Decimals are allowed). Arrival date estimations are based on this value.', '6', '21', NULL, now(), NULL, NULL)"); // add key for enabling email error messages tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Email UPS errors', 'MODULE_SHIPPING_UPSXML_EMAIL_ERRORS_" . $vendors_id . "', 'Yes', 'Do you want to receive UPS errors by email?', '6', '24', 'tep_cfg_select_option(array(\'Yes\', \'No\'), ', now())"); // add key for time in transit view type tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Time in Transit View Type', 'MODULE_SHIPPING_UPSXML_RATES_TIME_IN_TRANSIT_VIEW_" . $vendors_id . "', 'Not', 'If and how the module should display the time in transit to the customer.', '6', '13', 'tep_cfg_select_option(array(\'Not\',\'Raw\', \'Detailed\'), ', now())"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Display Weight', 'MODULE_SHIPPING_UPSXML_WEIGHT1_" . $vendors_id . "', 'True', 'Do you want to show number of packages and package weight?', '6', '28', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); } //**************** function remove($vendors_id) { tep_db_query("delete from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key in ('" . implode("', '", $this->keys($vendors_id)) . "')"); } //************* function keys($vendors_id) { return array('MODULE_SHIPPING_UPSXML_RATES_STATUS_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_ACCESS_KEY_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_USERNAME_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_PASSWORD_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_PICKUP_METHOD_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_PACKAGE_TYPE_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_CUSTOMER_CLASSIFICATION_CODE_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_ORIGIN_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_CITY_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_STATEPROV_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_COUNTRY_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_POSTALCODE_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_MODE_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_QUOTE_TYPE_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_USE_NEGOTIATED_RATES_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_UPS_ACCOUNT_NUMBER_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_MANUAL_NEGOTIATED_RATE_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_HANDLING_TYPE_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_HANDLING_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_INSURE_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_CURRENCY_CODE_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_ZONE_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_SORT_ORDER_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_TYPES_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_SHIPPING_DAYS_DELAY_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_EMAIL_ERRORS_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_RATES_TIME_IN_TRANSIT_VIEW_' . $vendors_id, 'MODULE_SHIPPING_UPSXML_WEIGHT1_' . $vendors_id); } //*********************** function _upsProduct($prod, $vendors_id){ $this->_upsProductCode = $prod; } //end mvs Quote Link to comment Share on other sites More sharing options...
♥kymation Posted March 31, 2011 Share Posted March 31, 2011 There are modification instructions in the MVS distribution. They're pretty basic, so likely not much help, bu they may give you an idea. If you're stuck, post a section of the code here and I'll try to figure it out. That's how MVS was written in the first place, or most of it anyway. Craig and I sent a lot of code back and forth. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
♥kymation Posted March 31, 2011 Share Posted March 31, 2011 (edited) Forget the length restrictions, just fix the posting errors. Bah. I don't see anything wrong with the code you posted. If you're having problems with some of it, please tell me where to look. Regards Jim Edited March 31, 2011 by kymation Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
motorcity Posted March 31, 2011 Author Share Posted March 31, 2011 Here's basically the second half. //end mvs //********************************************** function _upsOrigin($city, $stateprov, $country, $postal){ $this->_upsOriginCity = $city; $this->_upsOriginStateProv = $stateprov; $this->_upsOriginCountryCode = $country; $postal = str_replace(' ', '', $postal); if ($country == 'US') { $this->_upsOriginPostalCode = substr($postal, 0, 5); } else { $this->_upsOriginPostalCode = $postal; } } //********************************************** function _upsDest($city, $stateprov, $country, $postal) { $this->_upsDestCity = $city; $this->_upsDestStateProv = $stateprov; $this->_upsDestCountryCode = $country; $postal = str_replace(' ', '', $postal); if ($country == 'US') { $this->_upsDestPostalCode = substr($postal, 0, 5); $territories = array('AS','FM','GU','MH','MP','PR','PW','VI'); if (in_array($this->_upsDestStateProv,$territories)) { $this->_upsDestCountryCode = $stateprov; } } else if ($country == 'BR') { $this->_upsDestPostalCode = substr($postal, 0, 5); } else { $this->_upsDestPostalCode = $postal; } } //mvs //************************ function _upsAction($action, $vendors_id) { // rate - Single Quote; shop - All Available Quotes $this->_upsActionCode = $action; } //******************************************** function _addItem($length, $width, $height, $weight, $price = 0 ) { // Add box or item to shipment list. Round weights to 1 decimal places. if ((float)$weight < 1.0) { $weight = 1; } else { $weight = round($weight, 1); } $index = $this->items_qty; $this->item_length[$index] = ($length ? (string)$length : '0' ); $this->item_width[$index] = ($width ? (string)$width : '0' ); $this->item_height[$index] = ($height ? (string)$height : '0' ); $this->item_weight[$index] = ($weight ? (string)$weight : '0' ); $this->item_price[$index] = $price; $this->items_qty++; } //begin mvs //********************* function _upsGetQuote($vendors_id='1') { // Create the access request $accessRequestHeader = "<?xml version=\"1.0\"?>\n". "<AccessRequest xml:lang=\"en-US\">\n". " <AccessLicenseNumber>". $this->access_key($vendors_id) ."</AccessLicenseNumber>\n". " <UserId>". $this->access_username($vendors_id) ."</UserId>\n". " <Password>". $this->access_password($vendors_id) ."</Password>\n". "</AccessRequest>\n"; //end mvs $ratingServiceSelectionRequestHeader = "<?xml version=\"1.0\"?>\n". "<RatingServiceSelectionRequest xml:lang=\"en-US\">\n". " <Request>\n". " <TransactionReference>\n". " <CustomerContext>Rating and Service</CustomerContext>\n". " <XpciVersion>". $this->xpci_version ."</XpciVersion>\n". " </TransactionReference>\n". " <RequestAction>Rate</RequestAction>\n". " <RequestOption>shop</RequestOption>\n". " </Request>\n"; // according to UPS the CustomerClassification and PickupType containers should // not be present when the origin country is non-US see: // http://www.oscommerce.com/forums/index.php?s=&showtopic=49382&view=findpost&p=730947 if ($this->origin_country == 'US') { $ratingServiceSelectionRequestHeader .= " <PickupType>\n". " <Code>". $this->pickup_methods[$this->pickup_method($vendors_id)] ."</Code>\n". //mvs " </PickupType>\n"; " <CustomerClassification>\n". " <Code>". $this->customer_classification ."</Code>\n". " </CustomerClassification>\n"; } $ratingServiceSelectionRequestHeader .= " <Shipment>\n". " <Shipper>\n"; if ($this->use_negotiated_rates == 'True') { $ratingServiceSelectionRequestHeader .= " <ShipperNumber>" . $this->access_account_number . "</ShipperNumber>\n"; } $ratingServiceSelectionRequestHeader .= " <Address>\n". " <City>". $this->_upsOriginCity ."</City>\n". " <StateProvinceCode>". $this->_upsOriginStateProv ."</StateProvinceCode>\n". " <CountryCode>". $this->_upsOriginCountryCode ."</CountryCode>\n". " <PostalCode>". $this->_upsOriginPostalCode ."</PostalCode>\n". " </Address>\n". " </Shipper>\n". " <ShipTo>\n". " <Address>\n". " <City>". $this->_upsDestCity ."</City>\n". " <StateProvinceCode>". $this->_upsDestStateProv ."</StateProvinceCode>\n". " <CountryCode>". $this->_upsDestCountryCode ."</CountryCode>\n". " <PostalCode>". $this->_upsDestPostalCode ."</PostalCode>\n". ($this->quote_type($vendors_id) == "Residential" ? "<ResidentialAddressIndicator/>\n" : "") . //mvs " </Address>\n". " </ShipTo>\n"; $numgroups = ceil($this->items_qty / 50); // UPS can only process 50 packages at once $xmlResult = ''; for ($g = 0; $g < $numgroups; $g++) { // process each group of packages $ratingServiceSelectionRequestPackageContent = ''; $start = $g * 50; $end = ($g + 1 == $numgroups) ? $this->items_qty : $start + 50; // if last group end with number of packages otherwise do 50 more for ($i = $start; $i < $end; $i++) { $ratingServiceSelectionRequestPackageContent .= " <Package>\n". " <PackagingType>\n". " <Code>". $this->package_types[$this->package_type($vendors_id)] ."</Code>\n". //mvs " </PackagingType>\n"; if ($this->dimensions_support > 0 && ($this->item_length[$i] > 0 ) && ($this->item_width[$i] > 0 ) && ($this->item_height[$i] > 0)) { $ratingServiceSelectionRequestPackageContent .= " <Dimensions>\n". " <UnitOfMeasurement>\n". " <Code>". $this->unit_length($vendors_id) ."</Code>\n". //mvs " </UnitOfMeasurement>\n". " <Length>". $this->item_length[$i] ."</Length>\n". " <Width>". $this->item_width[$i] ."</Width>\n". " <Height>". $this->item_height[$i] ."</Height>\n". " </Dimensions>\n"; } $ratingServiceSelectionRequestPackageContent .= " <PackageWeight>\n". " <UnitOfMeasurement>\n". " <Code>". $this->unit_weight($vendors_id) ."</Code>\n". //mvs " </UnitOfMeasurement>\n". " <Weight>". $this->item_weight[$i] ."</Weight>\n". " </PackageWeight>\n"; //" <COD>\n". //" <CODFundsCode>0</CODFundsCode>\n". //" <CODCode>3</CODCode>\n". //" <CODAmount>\n". //" <CurrencyCode>USD</CurrencyCode>\n". //" <MonetaryValue>1000</MonetaryValue>\n". //" </CODAmount>\n". //" </COD>\n". if ($this->insure_package == true) { $ratingServiceSelectionRequestPackageContent .= " <PackageServiceOptions>\n". " <InsuredValue>\n". " <CurrencyCode>".MODULE_SHIPPING_UPSXML_CURRENCY_CODE."</CurrencyCode>\n". " <MonetaryValue>".$this->item_price[$i]."</MonetaryValue>\n". " </InsuredValue>\n". " </PackageServiceOptions>\n"; } // end if ($this->insure_package == true) $ratingServiceSelectionRequestPackageContent .= " </Package>\n"; } $ratingServiceSelectionRequestFooter = ''; //" <ShipmentServiceOptions/>\n". if ($this->use_negotiated_rates == 'True') { $ratingServiceSelectionRequestFooter .= " <RateInformation>\n". " <NegotiatedRatesIndicator/>\n". " </RateInformation>\n"; } $ratingServiceSelectionRequestFooter .= " </Shipment>\n"; // according to UPS the CustomerClassification and PickupType containers should // not be present when the origin country is non-US see: // http://www.oscommerce.com/forums/index.php?s=&showtopic=49382&view=findpost&p=730947 if ($this->origin_country == 'US') { $ratingServiceSelectionRequestFooter .= " <CustomerClassification>\n". " <Code>". $this->customer_classification($vendors_id) ."</Code>\n". //mvs " </CustomerClassification>\n"; } $ratingServiceSelectionRequestFooter .= "</RatingServiceSelectionRequest>\n"; $xmlRequest = $accessRequestHeader . $ratingServiceSelectionRequestHeader . $ratingServiceSelectionRequestPackageContent . $ratingServiceSelectionRequestFooter; $host = $this->host($vendors_id); //mvs //post request $strXML; $result = $this->_post($this->protocol, $this->host, $this->port, $this->path, $this->version, $this->timeout, $xmlRequest); if ($xmlResult == '') { // if first group of packages $xmlResult = $result; } else { //if second group of packages then results must be combined into one larger result if (strpos($xmlResult, '</RatingServiceSelectionResponse>') !== false) $xmlResult = substr($xmlResult, 0, strpos($xmlResult, '</RatingServiceSelectionResponse>')); if (strpos($result, '</Response>') !== false) $result = substr($result, strpos($result, '</Response>') + 11); $xmlResult .= $result; } // BOF testing with a response from UPS saved as a text file // needs commenting out the line above: $xmlResult = $this->_post($this->protocol, etcetera /* $filename = '/srv/www/htdocs/catalog/includes/modules/shipping/example_response.xml'; $fp = fopen($filename, "r") or die("couldn't open file"); $xmlResult = ""; while (! feof($fp)) { $xmlResult .= fgets($fp, 1024); } // EOF testing with a text file */ } //end groups loop return $this->_parseResult($xmlResult, $vendors_id); //mvs } //****************************************************************** function _post($protocol, $host, $port, $path, $version, $timeout, $xmlRequest) { $url = $protocol."://".$host.":".$port.$path; if ($this->logfile) { error_log("------------------------------------------\n", 3, $this->logfile); error_log("DATE AND TIME: ".date('Y-m-d H:i:s')."\n", 3, $this->logfile); error_log("UPS URL: " . $url . "\n", 3, $this->logfile); } if (function_exists('exec') && $this->use_exec == '1' ) { exec('which curl', $curl_output); if ($curl_output) { $curl_path = $curl_output[0]; } else { $curl_path = 'curl'; // change this if necessary } if ($this->logfile) { error_log("UPS REQUEST using exec(): " . $xmlRequest . "\n", 3, $this->logfile); } // add option -k to the statement: $command = "".$curl_path." -k -d \"". etcetera if you get // curl error 60: error setting certificate verify locations // using addslashes was the only way to avoid UPS returning the 1001 error: The XML document is not well formed $command = "".$curl_path." -d \"".addslashes($xmlRequest)."\" ".$url.""; exec($command, $xmlResponse); if ( empty($xmlResponse) && $this->logfile) { // using exec no curl errors can be retrieved error_log("Error from cURL using exec() since there is no \$xmlResponse\n", 3, $this->logfile); } if ($this->logfile) { error_log("UPS RESPONSE using exec(): " . implode('', $xmlResponse) . "\n", 3, $this->logfile); } } elseif ($this->use_exec == '1') { // if NOT (function_exists('exec') && $this->use_exec == '1' if ($this->logfile) { error_log("Sorry, exec() cannot be called\n", 3, $this->logfile); } } else { // default behavior: cURL is assumed to be compiled in PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // uncomment the next line if you get curl error 60: error setting certificate verify locations // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // uncommenting the next line is most likely not necessary in case of error 60 // curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest); curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout); if ($this->logfile) { error_log("UPS REQUEST: " . $xmlRequest . "\n", 3, $this->logfile); } $xmlResponse = curl_exec ($ch); if (curl_errno($ch) && $this->logfile) { $error_from_curl = sprintf('Error [%d]: %s', curl_errno($ch), curl_error($ch)); error_log("Error from cURL: " . $error_from_curl . "\n", 3, $this->logfile); } // send email if enabled in the admin section if (curl_errno($ch) && $this->email_errors) { $error_from_curl = sprintf('Error [%d]: %s', curl_errno($ch), curl_error($ch)); error_log("Error from cURL: " . $error_from_curl . " experienced by customer with id " . $_SESSION['customer_id'] . " on " . date('Y-m-d H:i:s'), 1, STORE_OWNER_EMAIL_ADDRESS); } // log errors to file ups_error.log when set if (curl_errno($ch) && $this->ups_error_file) { $error_from_curl = sprintf('Error [%d]: %s', curl_errno($ch), curl_error($ch)); error_log(date('Y-m-d H:i:s')."\tcURL\t" . $error_from_curl . "\t" . $_SESSION['customer_id']."\n", 3, $this->ups_error_file); } if ($this->logfile) { error_log("UPS RESPONSE: " . $xmlResponse . "\n", 3, $this->logfile); } curl_close ($ch); } if(!$xmlResponse || strstr(strtolower(substr($xmlResponse, 0, 120)), "bad request")) { /* Sometimes the UPS server responds with an HTML message (differing depending on whether the test server or the production server is used) but both have in the title tag "Bad request". Parsing this response will result in a fatal error: Call to a member function on a non-object in /blabla/includes/classes/xmldocument.php on line 57 It only results in not showing Estimated Delivery Dates to the customer so avoiding the fatal error should do. */ $xmlResponse = "<?xml version=\"1.0\"?>\n". "<RatingServiceSelectionResponse>\n". " <Response>\n". " <TransactionReference>\n". " <CustomerContext>Rating and Service</CustomerContext>\n". " <XpciVersion>1.0001</XpciVersion>\n". " </TransactionReference>\n". " <ResponseStatusCode>0</ResponseStatusCode>\n". " <ResponseStatusDescription>". MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_UNKNOWN_ERROR ."</ResponseStatusDescription>\n". " </Response>\n". "</RatingServiceSelectionResponse>\n"; return $xmlResponse; } if ($this->use_exec == '1') { return implode('', $xmlResponse); // $xmlResponse is an array in this case } else { return $xmlResponse; } } //***************************** function _parseResult($xmlResult, $vendors_id) { //mvs // Parse XML message returned by the UPS post server. $doc = XML_unserialize ($xmlResult); // Get version. Must be xpci version 1.0001 or this might not work. $responseVersion = $doc['RatingServiceSelectionResponse']['Response']['TransactionReference']['XpciVersion']; if ($this->xpci_version != $responseVersion) { $message = MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_VERSION_ERROR; return $message; } // Get response code: 1 = SUCCESS, 0 = FAIL $responseStatusCode = $doc['RatingServiceSelectionResponse']['Response']['ResponseStatusCode']; if ($responseStatusCode != '1') { $errorMsg = $doc['RatingServiceSelectionResponse']['Response']['Error']['ErrorCode']; $errorMsg .= ": "; $errorMsg .= $doc['RatingServiceSelectionResponse']['Response']['Error']['ErrorDescription']; // send email if enabled in the admin section if ($this->email_errors) { error_log("UPSXML Rates Error: " . $errorMsg . " experienced by customer with id " . $_SESSION['customer_id'] . " on " . date('Y-m-d H:i:s'), 1, STORE_OWNER_EMAIL_ADDRESS); } // log errors to file ups_error.log when set if ($this->ups_error_file) { error_log(date('Y-m-d H:i:s')."\tRates\t" . $errorMsg . "\t" . $_SESSION['customer_id']."\n", 3, $this->ups_error_file); } return $errorMsg; } $ratedShipments = $doc['RatingServiceSelectionResponse']['RatedShipment']; $aryProducts = false; $upstemp = array(); if (isset($doc['RatingServiceSelectionResponse']['RatedShipment'][0])) { // more than 1 rate for ($i = 0; $i < count($ratedShipments); $i++) { $serviceCode = $ratedShipments[$i]['Service']['Code']; if ($this->use_negotiated_rates == 'True' && isset($ratedShipments[$i]['NegotiatedRates']['NetSummaryCharges']['GrandTotal']['MonetaryValue'])) { $totalCharge = $ratedShipments[$i]['NegotiatedRates']['NetSummaryCharges']['GrandTotal']['MonetaryValue']; } elseif ($this->manual_negotiated_rate > 0) { $totalCharge = $ratedShipments[$i]['TotalCharges']['MonetaryValue'] * ($this->manual_negotiated_rate/100); } else { // standard UPS rates $totalCharge = $ratedShipments[$i]['TotalCharges']['MonetaryValue']; } if (!($serviceCode && $totalCharge)) { continue; } $ratedPackages = $ratedShipments[$i]['RatedPackage']; // only do this once for the first service given if (isset($ratedShipments[$i]['RatedPackage'][0])) { // multidimensional array of packages $boxCount = count($ratedPackages); } else { $boxCount = 1; // if there is only one package count($ratedPackages) returns // the number of fields in the array like TransportationCharges and BillingWeight } // if more than one group of packages, service codes will be repeated and therefore data needs to be combined $upstemp[$serviceCode]['charge'] += $totalCharge; $upstemp[$serviceCode]['boxes'] += $boxCount; $upstemp[$serviceCode]['billed_weight'] += $ratedShipments[$i]['BillingWeight']['Weight']; $upstemp[$serviceCode]['weight_code'] = $ratedShipments[$i]['BillingWeight']['UnitOfMeasurement']['Code']; } // end for ($i = 0; $i < count($ratedShipments); $i++) $i = 0; foreach ($upstemp as $key => $value) { $this->boxCount = $value['boxes']; // set total grouped package count $title = $this->service_codes[$this->origin($vendors_id)][$key]; //mvs if (MODULE_SHIPPING_UPSXML_WEIGHT1 == 'True') $title .= ' (' . UPSXML_TEXT_BILLED_WEIGHT . $value['billed_weight'] . ' ' . $value['weight_code'] . ')'; $aryProducts[$i] = array($title => $value['charge']); $i++; } } elseif (isset($doc['RatingServiceSelectionResponse']['RatedShipment'])) { // only 1 rate $serviceCode = $ratedShipments['Service']['Code']; if ($this->use_negotiated_rates == 'True' && isset($ratedShipments['NegotiatedRates']['NetSummaryCharges']['GrandTotal']['MonetaryValue'])) { $totalCharge = $ratedShipments['NegotiatedRates']['NetSummaryCharges']['GrandTotal']['MonetaryValue']; } elseif ($this->manual_negotiated_rate > 0) { $totalCharge = $ratedShipments['TotalCharges']['MonetaryValue'] * ($this->manual_negotiated_rate/100); } else { // standard UPS rates $totalCharge = $ratedShipments['TotalCharges']['MonetaryValue']; } if (!($serviceCode && $totalCharge)) { return $aryProducts; // is false } $ratedPackages = $ratedShipments['RatedPackage']; // only do this once for the first service given if (isset($ratedShipments['RatedPackage'][0])) { // multidimensional array of packages $this->boxCount = count($ratedPackages); } else { $this->boxCount = 1; // if there is only one package count($ratedPackages) returns // the number of fields in the array like TransportationCharges and BillingWeight } $title = $this->service_codes[$this->origin][$serviceCode]; if (MODULE_SHIPPING_UPSXML_WEIGHT1 == 'True') $title .= ' (' . UPSXML_TEXT_BILLED_WEIGHT . $ratedShipments['BillingWeight']['Weight'] . ' ' . $ratedShipments['BillingWeight']['UnitOfMeasurement']['Code'] . ')'; $aryProducts[] = array($title => $totalCharge); } return $aryProducts; } // BOF Time In Transit //mvs //******************** function _upsGetTimeServices($vendors_id) { // MVS needs work here if (defined('MODULE_SHIPPING_UPSXML_SHIPPING_DAYS_DELAY_' . $vendors_id)) { $shipdate = date("Ymd", $this->today_unix_time + (86400*MODULE_SHIPPING_UPSXML_SHIPPING_DAYS_DELAY_' . $vendors_id)); $day_of_the_week = date ("w", $this->today_unix_time + (86400*MODULE_SHIPPING_UPSXML_SHIPPING_DAYS_DELAY) ) ; if ($day_of_the_week == "0" || $day_of_the_week == "7") { // order supposed to leave on Sunday $shipdate = date("Ymd", $this->today_unix_time + (86400*MODULE_SHIPPING_UPSXML_SHIPPING_DAYS_DELAY) + 86400); } elseif ($day_of_the_week == "6") { // order supposed to leave on Saturday $shipdate = date("Ymd", $this->today_unix_time + (86400*MODULE_SHIPPING_UPSXML_SHIPPING_DAYS_DELAY) + 172800); } } else { $shipdate = $this->today; } // Create the access request $accessRequestHeader = "<?xml version=\"1.0\"?>\n". "<AccessRequest xml:lang=\"en-US\">\n". //begin mvs " <AccessLicenseNumber>". $this->access_key($vendors_id) ."</AccessLicenseNumber>\n". " <UserId>". $this->access_username($vendors_id) ."</UserId>\n". " <Password>". $this->access_password($vendors_id) ."</Password>\n". "</AccessRequest>\n"; //end mvs $timeintransitSelectionRequestHeader = "<?xml version=\"1.0\"?>\n". "<TimeInTransitRequest xml:lang=\"en-US\">\n". " <Request>\n". " <TransactionReference>\n". " <CustomerContext>Time in Transit</CustomerContext>\n". " <XpciVersion>". $this->transitxpci_version ."</XpciVersion>\n". " </TransactionReference>\n". " <RequestAction>TimeInTransit</RequestAction>\n". " </Request>\n". " <TransitFrom>\n". " <AddressArtifactFormat>\n". " <PoliticalDivision2>". $this->origin_city($vendors_id) ."</PoliticalDivision2>\n". //mvs " <PoliticalDivision1>". $this->origin_stateprov($vendors_id) ."</PoliticalDivision1>\n". //mvs " <CountryCode>". $this->_upsOriginCountryCode ."</CountryCode>\n". " <PostcodePrimaryLow>". $this->origin_postalcode($vendors_id) ."</PostcodePrimaryLow>\n". //mvs " </AddressArtifactFormat>\n". " </TransitFrom>\n". " <TransitTo>\n". " <AddressArtifactFormat>\n". " <PoliticalDivision2>". $this->_upsDestCity ."</PoliticalDivision2>\n". " <PoliticalDivision1>". $this->_upsDestStateProv ."</PoliticalDivision1>\n". " <CountryCode>". $this->_upsDestCountryCode ."</CountryCode>\n". " <PostcodePrimaryLow>". $this->_upsDestPostalCode ."</PostcodePrimaryLow>\n". " <PostcodePrimaryHigh>". $this->_upsDestPostalCode ."</PostcodePrimaryHigh>\n". " </AddressArtifactFormat>\n". " </TransitTo>\n". " <ShipmentWeight>\n". " <UnitOfMeasurement>\n". " <Code>" . $this->unit_weight . "</Code>\n". " </UnitOfMeasurement>\n". " <Weight>" . $this->weight_for_timeintransit . "</Weight>\n". " </ShipmentWeight>\n". " <InvoiceLineTotal>\n". " <CurrencyCode>" . MODULE_SHIPPING_UPSXML_CURRENCY_CODE . "</CurrencyCode>\n". " <MonetaryValue>" . $this->pkgvalue . "</MonetaryValue>\n". " </InvoiceLineTotal>\n". " <PickupDate>" . $shipdate . "</PickupDate>\n". "</TimeInTransitRequest>\n"; $xmlTransitRequest = $accessRequestHeader . $timeintransitSelectionRequestHeader; //post request $strXML; $xmlTransitResult = $this->_post($this->protocol, $this->host($vendors_id), $this->port, $this->transitpath, $this->transitversion, $this->timeout, $xmlTransitRequest); //mvs return $this->_transitparseResult($xmlTransitResult); } //*************************************** // GM 11-15-2004: modified to return array with time for each service, as // opposed to single transit time for hardcoded "GND" code function _transitparseResult($xmlTransitResult) { $transitTime = array(); // Parse XML message returned by the UPS post server. $doc = XML_unserialize ($xmlTransitResult); // Get version. Must be xpci version 1.0001 or this might not work. // 1.0001 and 1.0002 seem to be very similar, forget about this for the moment /* $responseVersion = $doc['TimeInTransitResponse']['Response']['TransactionReference']['XpciVersion']; if ($this->transitxpci_version != $responseVersion) { $message = MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_VERSION_ERROR; return $message; } */ // Get response code. 1 = SUCCESS, 0 = FAIL $responseStatusCode = $doc['TimeInTransitResponse']['Response']['ResponseStatusCode']; if ($responseStatusCode != '1') { $errorMsg = $doc['TimeInTransitResponse']['Response']['Error']['ErrorCode']; $errorMsg .= ": "; $errorMsg .= $doc['TimeInTransitResponse']['Response']['Error']['ErrorDescription']; // send email if enabled in the admin section if ($this->email_errors) { error_log("UPSXML TimeInTransit Error: " . $errorMsg . " experienced by customer with id " . $_SESSION['customer_id'] . " on " . date('Y-m-d H:i:s'), 1, STORE_OWNER_EMAIL_ADDRESS); } // log errors to file ups_error.log when set if ($this->ups_error_file) { error_log(date('Y-m-d H:i:s')."\tTimeInTransit\t" . $errorMsg . "\t" . $_SESSION['customer_id'] ."\n", 3, $this->ups_error_file); } // return $errorMsg; return false; } if (isset($doc['TimeInTransitResponse']['TransitResponse']['ServiceSummary'][0])) { // more than one EDD foreach ($doc['TimeInTransitResponse']['TransitResponse']['ServiceSummary'] as $key_index => $service_array) { // index by description because that's all we can relate back to the service // with (though it can probably return the code as well but they are very // different from those used by the Rates Service and there is a lot of // duplication so pretty useless) $serviceDesc = $service_array['Service']['Description']; // hack to get EDD for UPS Saver recognized (Time in Transit uses UPS Worldwide Saver // but the service in Rates and Services is called UPS Saver) if ($serviceDesc == "UPS Worldwide Saver") { $serviceDesc = "UPS Saver"; } // only date is used so why bother with days and guaranteed? // $transitTime[$serviceDesc]["days"] = $serviceSummary[$s]->getValueByPath("EstimatedArrival/BusinessTransitDays"); $transitTime[$serviceDesc]['date'] = $service_array['EstimatedArrival']['Date']; // $transitTime[$serviceDesc]["guaranteed"] = $serviceSummary[$s]->getValueByPath("Guaranteed/Code"); } // end foreach ($doc['TimeInTransitResponse']['ServiceSummary'] etc. } elseif (isset($doc['TimeInTransitResponse']['TransitResponse']['ServiceSummary'])) { // only one EDD $serviceDesc = $doc['TimeInTransitResponse']['TransitResponse']['ServiceSummary']['Service']['Description']; $transitTime[$serviceDesc]['date'] = $doc['TimeInTransitResponse']['TransitResponse']['ServiceSummary']['EstimatedArrival']['Date']; } else { $errorMsg = MODULE_SHIPPING_UPSXML_TIME_IN_TRANSIT_TEXT_NO_RATES; if ($this->ups_error_file) { error_log(date('Y-m-d H:i:s')."\tTimeInTransit\t" . $errorMsg . "\t" . $_SESSION['customer_id'] ."\n", 3, $this->ups_error_file); } return false; } if ($this->logfile) { error_log("------------------------------------------\n", 3, $this->logfile); foreach($transitTime as $desc => $time) { error_log("Business Transit: " . $desc ." = ". $time["date"] . "\n", 3, $this->logfile); } } return $transitTime; } //EOF Time In Transit // *************************** function exclude_choices($type, $vendors_id) { //mvs // Used for exclusion of UPS shipping options, disallowed types are read from db (stored as // short defines). The short defines are not used as such, to avoid collisions // with other shipping modules, they are prefixed with UPSXML_ // These defines are found in the upsxml language file (UPSXML_US_01, UPSXML_CAN_14 etc.) $disallowed_types = explode(",", MODULE_SHIPPING_UPSXML_TYPES_' . $vendors_id); //mvs if (strstr($type, "UPS")) { // this will chop off "UPS" from the beginning of the line - typically something like UPS Next Day Air (1 Business Days) $type_minus_ups = explode("UPS", $type ); $type_root = trim($type_minus_ups[1]); } // end if (strstr($type, "UPS"): else { // service description does not contain UPS (unlikely) $type_root = trim($type); } for ($za = 0; $za < count ($disallowed_types); $za++ ) { // when no disallowed types are present, --none-- is in the db but causes an error because --none-- is // not added as a define if ($disallowed_types[$za] == '--none--' ) continue; if ($type_root == constant('UPSXML_' . trim($disallowed_types[$za]))) { return true; } // end if ($type_root == constant(trim($disallowed_types[$za]))). } // if the type is not disallowed: return false; } // Next function used for sorting the shipping quotes on rate: low to high is default. function rate_sort_func ($a, $b) { $av = array_values($a); $av = $av[0]; $bv = array_values($b); $bv = $bv[0]; // return ($av == $bv) ? 0 : (($av < $bv) ? 1 : -1); // for having the high rates first return ($av == $bv) ? 0 : (($av > $bv) ? 1 : -1); // low rates first } } // end class upsxml // Next two functions are used only in the admin for disallowed shipping options. // The (short) constants like US_12, CAN_14 are stored in the database // to stay below 255 characters. The defines themselves are found in the upsxml // language file prefixed with UPSXML_ to avoid collisions with other shipping modules. // They can be moved to admin/includes/function/general.php if you like but don't forget // to remove them from this file in future updates or you will get an error in the admin // about re-declaring functions function get_multioption_upsxml($values) { if (tep_not_null($values)) { $values_array = explode(',', $values); foreach ($values_array as $key => $_method) { if ($_method == '--none--') { $method = $_method; } else { $method = constant('UPSXML_' . trim($_method)); } $readable_values_array[] = $method; } $readable_values = implode(', ', $readable_values_array); return $readable_values; } else { return ''; } } function upsxml_cfg_select_multioption_indexed($select_array, $key_value, $key = '') { for ($i=0; $i<sizeof($select_array); $i++) { $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value'); $string .= '<br><input type="checkbox" name="' . $name . '" value="' . $select_array[$i] . '"'; $key_values = explode( ", ", $key_value); if ( in_array($select_array[$i], $key_values) ) $string .= ' CHECKED'; $string .= '> ' . constant('UPSXML_' . trim($select_array[$i])); } $string .= '<input type="hidden" name="' . $name . '" value="--none--">'; return $string; } ?> Quote Link to comment Share on other sites More sharing options...
motorcity Posted March 31, 2011 Author Share Posted March 31, 2011 The error Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/sonsfd/public_html/includes/modules/vendors_shipping/upsxml.php on line 1075 corresponds to the closing bracket from function _upsGetTimeServices($vendors_id) { Now, stupidly not sooner, looking at it I wonder if we need the mvs stuff in that function. Quote Link to comment Share on other sites More sharing options...
♥kymation Posted April 1, 2011 Share Posted April 1, 2011 The tag coloring in your second half makes this one really stand out. This line: $shipdate = date("Ymd", $this->today_unix_time + (86400*MODULE_SHIPPING_UPSXML_SHIPPING_DAYS_DELAY_' . $vendors_id)); needs to be $shipdate = date("Ymd", $this->today_unix_time + (86400*constant('MODULE_SHIPPING_UPSXML_SHIPPING_DAYS_DELAY_' . $vendors_id))); You need the $vendors_id in that section to build constants like this one. Looks like you're on the right track. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
motorcity Posted April 1, 2011 Author Share Posted April 1, 2011 (edited) That cleared that error. Next up; Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/-/public_html/includes/modules/vendors_shipping/upsxml.php on line 1153 line 1153 if ($disallowed_types[$za] == '--none--' ) continue; Found it 1141 should've been $disallowed_types = explode(",", MODULE_SHIPPING_UPSXML_TYPES); That get's past errors stopping that vendor from even loading. Now I get this; 1136 - Column count doesn't match value count at row 1 insert into vendor_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Quote Type', 'MODULE_SHIPPING_UPSXML_RATES_QUOTE_TYPE_6', 'Commercial', 'Quote for Residential or Commercial Delivery', '6', '15', 'tep_cfg_select_option(array(\'Commercial\', \'Residential\'), ', now()) I suspect there's a bunch more where that comes from. Something like find & replace ', now()) with ', now(),) Edited April 1, 2011 by motorcity Quote Link to comment Share on other sites More sharing options...
motorcity Posted April 1, 2011 Author Share Posted April 1, 2011 No. Actually I've got this screwed up. There is no MODULE_SHIPPING_UPSXML_RATES_QUOTE_TYPE_6 6 is the vendor_id. This would be obvious to a thinking person. I need to dice off the _" . $vendors_id . "' addition, and also add a column for vendors_id tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Quote Type', 'MODULE_SHIPPING_UPSXML_RATES_QUOTE_TYPE_" . $vendors_id . "', 'Commercial', 'Quote for Residential or Commercial Delivery', '6', '15', 'tep_cfg_select_option(array(\'Commercial\', \'Residential\'), ', now())"); Quote Link to comment Share on other sites More sharing options...
motorcity Posted April 1, 2011 Author Share Posted April 1, 2011 Okay, we got through all the parse errors, then all the write the db vendor_configuration errors. Now I can install the module as you normally would. First try had (by default) set to "Test" mode, it didn't install, showed only a sort order in the modules list and a blank right column. I had to manually remove all the db entries. Second time (no changes except deleting db entries) and switching to "Production Mode", ----> It Works !! <---- I'll play around doing some more testing. Can anyone lay it out to me in posting for dummies english - how can I post the entire file here?? Quote Link to comment Share on other sites More sharing options...
♥kymation Posted April 1, 2011 Share Posted April 1, 2011 You'll have to put it up in the Addons section. The forum has a hard limit on size. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
motorcity Posted April 1, 2011 Author Share Posted April 1, 2011 You'll have to put it up in the Addons section. The forum has a hard limit on size. Regards Jim Oh, well I could also email it to anyone while it's in such a "beta" state. I've been trying to get the dimensional parts going first, and although I'm not all that sure what it does I wanted to take a look at the split products too. As mentioned my db, admin/categories.php admin/packaging.php were already set for dimensional as well as catalog/includes/classes/shopping_cart.php and probably a few others are already mvs & upsxml-w/dim's But my catalog/admin/includes/classes/shopping_cart.php isn't modified at all. Quote Link to comment Share on other sites More sharing options...
♥kymation Posted April 1, 2011 Share Posted April 1, 2011 I can test it with dimensional support off if you send it over. I don't have a site set up with dimensions to test that part. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
motorcity Posted April 1, 2011 Author Share Posted April 1, 2011 I can test it with dimensional support off if you send it over. I don't have a site set up with dimensions to test that part. Regards Jim I sent you the file through the osc email. Kinda stuck on this dimensional stuff. There's a MVS function in catalog/includes/classes/shopping_cart.php that I'm wondering if it needs to be duplicated in some way over to admin/includes/classes/shopping_cart.php If not, I'm wondering how its going to work without a vendor in the admin. Here's the catalog function ////// //MVS Start // New method to provide cost, weight, quantity, and product IDs by vendor ////// //Output array structure (example): //shoppingcart Object //( // [vendor_shipping] => array // ( // [0] => array //Number is the vendor_id // ( // [weight] => 22.59 // [cost] => 12.95 // [qty] => 2 // [products_id] => array // ( // [0] => 12 // [1] => 47 // ) // ) // [12] => array // ( // [weight] => 32.74 // [cost] => 109.59 // [qty] => 5 // [products_id] => array // ( // [0] => 2 // [1] => 3 // [2] => 37 // [3] => 49 // ) // ) // ) //) function vendor_shipping() { if (!is_array($this->contents)) return 0; //Cart is empty $this->vendor_shipping = array(); //Initialize the output array reset($this->contents); // and reset the input array foreach ($this->contents as $products_id => $value) { //$value is never used $quantity = $this->contents[$products_id]['qty']; $products_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight, vendors_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'" ); if ($products = tep_db_fetch_array($products_query)) { $products_price = $products['products_price']; $products_weight = $products['products_weight']; $vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id']; $products_tax = tep_get_tax_rate($products['products_tax_class_id']); //Find special prices (if any) $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$products_id . "' and status = '1'" ); if (tep_db_num_rows ($specials_query)) { $specials = tep_db_fetch_array($specials_query); $products_price = $specials['specials_new_products_price']; } //Add values to the output array $this->vendor_shipping[$vendors_id]['weight'] += ($quantity * $products_weight); $this->vendor_shipping[$vendors_id]['cost'] += tep_add_tax($products_price, $products_tax) * $quantity; $this->vendor_shipping[$vendors_id]['qty'] += $quantity; $this->vendor_shipping[$vendors_id]['products_id'][] = $products_id; //There can be more than one product } // Add/subtract attributes prices (if any) if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); foreach ($this->contents[$products_id]['attributes'] as $option => $value) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'" ); $attribute_price = tep_db_fetch_array($attribute_price_query); if ($attribute_price['price_prefix'] == '+') { $this->vendor_shipping[$vendors_id]['cost'] += $quantity * tep_add_tax($attribute_price['options_values_price'], $products_tax); } else { $this->vendor_shipping[$vendors_id]['cost'] -= $quantity * tep_add_tax($attribute_price['options_values_price'], $products_tax); } } } } return $this->vendor_shipping; } //MVS End And this is what I've changed (per dimensional instructions) in admin/...classes/shopping_cart function get_products() { global $languages_id; if (!is_array($this->contents)) return 0; $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_weight, p.products_tax_class_id, p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, v.vendors_id, v.vendors_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_VENDORS . " v where p.products_id='" . (int)tep_get_prid($products_id) . "' and pd.products_id = p.products_id and v.vendors_id = '" . $vendor . "' and p.vendors_id = '" . $vendor . "' and pd.language_id = '" . (int)$languages_id . "'"); //mvs & upsxml dim if ($products = tep_db_fetch_array($products_query)) { $prid = $products['products_id']; $products_price = $products['products_price']; $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'"); if (tep_db_num_rows($specials_query)) { $specials = tep_db_fetch_array($specials_query); $products_price = $specials['specials_new_products_price']; } $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'length' => $products['products_length'], //upsxml dims 'width' => $products['products_width'], //upsxml dims 'height' => $products['products_height'], //upsxml dims 'ready_to_ship' => $products['products_ready_to_ship'], //upsxml dims 'vendors_id' => $products['vendors_id'], //mvs 'vendors_name' => $products['vendors_name'], //mvs 'final_price' => ($products_price + $this->attributes_price($products_id)), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '')); } } return $products_array; } Quote Link to comment Share on other sites More sharing options...
♥kymation Posted April 1, 2011 Share Posted April 1, 2011 That method in the Cart class is used to collect data for MVS. The data is then stored in the database (mostly the orders_shipping table). The admin has its own code to read and present the data. You shouldn't need any changes to the Admin other than the ones MVS already makes. I just need a few minutes to finish up what I'm doing and I'll go try out your module. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
motorcity Posted April 1, 2011 Author Share Posted April 1, 2011 That method in the Cart class is used to collect data for MVS. The data is then stored in the database (mostly the orders_shipping table). The admin has its own code to read and present the data. You shouldn't need any changes to the Admin other than the ones MVS already makes. I just need a few minutes to finish up what I'm doing and I'll go try out your module. Regards Jim Sounds good, I'll be back in couple hours. Quote Link to comment Share on other sites More sharing options...
♥kymation Posted April 1, 2011 Share Posted April 1, 2011 111107: An origin postal code must be specified.111510: Unsupported packaging requested. Zip code is specified for the vendor and in the module itself. Packaging is set to the default Package type. Several text boxes are showing in the module edit menu without any legends. This usually means that the constants in the install() method do not match the constants in the keys() method. I turned on logging to see what is being sent to UPS, but that doesn't seem to be working either. Sorry, but I have to go work on something else right now. I'll take another look at this later. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
motorcity Posted April 3, 2011 Author Share Posted April 3, 2011 Hey Jim, & anyone else who's interested... (you could at least say hello) Sorry for the delay. Like many of us around here I suspect, sometimes you need to put out fires that have nothing to do with OSC. I finally got some time and I have a slightly tweaked version I'll send you shortly. If anyone else is interested in helping this development along let me know. I could post a really beta add-on but why bother if it's just 2 guys working at this point. I've tried reworking "that section" building constants, "function_upsGetTimeServices" but haven't yet found a way that doesn't result in errors of some sort. This reworked version is like the first, completely ignoring dimensional support. I'm getting quotes based on weight alone and have logging turned on. If I get the chance soon I'll start digging into the additional dimensional files. BTW, I got distracted a bit and downloaded notepad++ as well as WAMP & Netbeans. Very interesting stuff - except I'm so confused over netbeans I forgot why I was playing with it! What do you use Jim? ~joe Quote Link to comment Share on other sites More sharing options...
♥kymation Posted April 4, 2011 Share Posted April 4, 2011 I'm putting out a fire that does involve osC -- a site redesign. Whee. Looks really pretty, except you can't add anything to the cart now. Whoops. I use Eclipse. EasyEclipse for PHP actually. It's an IDE like NetBeans. The difference is that Eclipse is open source and NetBeans is owned by Oracle. It's just as confusing to set up though. It does catch a lot of my typos and other blunders before I put them on the server. That saves time, frustration, and server outages. Yes, I'm famous for crashing servers. I've also used Notepad++ and liked it. Oh, and XAMPP/LAMPP for the server part. If you're stuck on those errors, post that section of the code or send it to me. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
saderogba Posted May 4, 2012 Share Posted May 4, 2012 Please can someone direct me to where I can get this module? Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.