Jump to content

lyonsperf

Members
  • Content count

    341
  • Joined

  • Last visited

Everything posted by lyonsperf

  1. Should the mobile/includes/application_top.php file have the same require statements as the catalog/includes/application_top.php file? If so, what else needs to be transferred over to the mobile side for this to work?
  2. OK I ran through the instructions and found a few mistakes. It is still throwing the same error.
  3. Here is my config file <?php /* $Id: configure.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ // Define the webserver and path parameters // * DIR_FS_* = Filesystem directories (local/physical) // * DIR_WS_* = Webserver directories (virtual/URL) define('HTTP_SERVER', 'http://www.lyonsperformance.com'); // eg, http://localhost - should not be empty for productive servers define('HTTPS_SERVER', 'https://www.lyonsperformance.com'); // eg, https://localhost - should not be empty for productive servers define('ENABLE_SSL', true); // secure webserver for checkout procedure? define('HTTP_COOKIE_DOMAIN', '.lyonsperformance.com'); define('HTTPS_COOKIE_DOMAIN', '.lyonsperformance.com'); define('HTTP_COOKIE_PATH', '/'); define('HTTPS_COOKIE_PATH', '/'); define('DIR_WS_HTTP_CATALOG', '/'); define('DIR_WS_HTTPS_CATALOG', '/'); // define('DIR_WS_IMAGES', 'images/'); define('DIR_WS_MANUALS', 'manuals/'); define('DIR_WS_CATALOG_MANUALS', 'DIR_WS_CATALOG' . 'manuals/'); // define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/'); // define('DIR_WS_INCLUDES', 'includes/'); //BOF Mobile define('HTTP_MOBILE_SERVER', HTTP_SERVER); define('HTTPS_MOBILE_SERVER', HTTPS_SERVER); define('DIR_WS_HTTP_MOBILE', DIR_WS_HTTP_CATALOG . 'mobile/'); define('DIR_WS_HTTPS_MOBILE', DIR_WS_HTTPS_CATALOG . 'mobile/'); (defined('MOBILE_SESSION') ? define('DIR_WS_IMAGES', HTTP_SERVER . DIR_WS_HTTP_CATALOG . 'images/') : define('DIR_WS_IMAGES', 'images/')); define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/'); (defined('MOBILE_SESSION') ? define('DIR_WS_INCLUDES', '../includes/') : define('DIR_WS_INCLUDES', 'includes/')); //EOF Mobile define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/'); define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/'); define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/'); define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/'); define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/'); //BOF Mobile define('DIR_MOBILE_IMAGES', 'images/'); define('DIR_MOBILE_INCLUDES','includes/'); define('DIR_MOBILE_MODULES', DIR_MOBILE_INCLUDES . 'modules/'); define('DIR_MOBILE_CLASSES', DIR_MOBILE_INCLUDES . 'classes/'); define('DIR_MOBILE_HEADERS', DIR_MOBILE_INCLUDES . 'headers/'); define('DIR_MOBILE_LANGUAGES', DIR_MOBILE_INCLUDES . 'languages/'); //EOF Mobile // include local zz_configure.php require('includes/local/zz_configure.php'); //BOF Mobile (defined('MOBILE_SESSION') ? define('DIR_WS_DOWNLOAD_PUBLIC', HTTP_SERVER . DIR_WS_HTTP_CATALOG . 'pub/') : define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/')); //EOF Mobile define('DIR_FS_CATALOG', $_SERVER['DOCUMENT_ROOT'] . '/'); //BOF Mobile define('DIR_FS_MOBILE', DIR_FS_CATALOG . 'mobile/'); //EOF Mobile define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/'); I currently do not have the mobile site activated due to it causing the redirect error and blocking my site from showing.
  4. I posted my redirect file yesterday. Where would I update the device list. I had this working before the upgrade to version 6. So I might have missed something.
  5. Any ideas on how to fix the fatal error I posted for mobile_redirect.php?
  6. Here is the code for the mobile_redirect.php <?php // Le navigateur est-il un Smartphone ? function smartphone() { $smartphone = false; $useragent=$_SERVER['HTTP_USER_AGENT']; //BEGIN detectmobilebrowser 10 june 2013 (copy and paste only line 3 from detectmobilebrowser.php) if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))) //END detectmobilebrowser (copy and paste only line 3) { $smartphone = true; } return $smartphone; } class mobileRedirect { var $redirected; var $mobileDir = "mobile/"; function mobileRedirect() { $this->redirected = $this->needRedirect(); if($this->redirected) $this->redirect(); } function needRedirect() { if($this->isCancelled()) return false; if(strpos($_SERVER['SCRIPT_NAME'],$this->mobileDir . $this->mobileFile) > 0) return false; if(smartphone() == true) return true; return false; } function isCancelled() { if (tep_session_is_registered('redirectCancelled')) return true; if(isset($_GET['redirectCancelled']) && $_GET['redirectCancelled'] == 'true') { tep_session_register('redirectCancelled'); return true; } return false; } function redirect() { global $mobile_url; tep_redirect($mobile_url); } } ?>
  7. I'm getting this error Fatal error: Cannot redeclare smartphone() (previously declared in /home/lyons/public_html/mobile/includes/classes/mobile_redirect.php:5) in /home/lyons/public_html/mobile/includes/classes/mobile_redirect.php on line 14 After upgrading my 2.2 install. Any ideas?
  8. lyonsperf

    Multi_Vendor_Shipping new thread

    edited
  9. lyonsperf

    USPS Rate V4, Intl Rate V2 (official support thread)

    Sorry, MVS is Multiple Vendor Shipping its a addon for stores that dropship directly from the supplier or from other locations other than the main store address.
  10. lyonsperf

    USPS Rate V4, Intl Rate V2 (official support thread)

    This is going to be a real mess to convert for the MVS users. I am trying to work on a version but the code is so much different from the last rendition. Any suggestions would be much appreciated.
  11. Has anyone ported Additional Images Mod and/or MVS for this contribution?
  12. Google is bouncing my product feeds for a missing value "google product category". Where can I add this in the googlefeed file so that it will list it with each product? Being that my sites are all of the same product category, I would only need it to repeat for each product.
  13. lyonsperf

    Article Manager v1.0

    HI Jack, I have been using this mod sucessfully for a while. I just added a new article that is several pages long but when viewed through my site it is truncated to the first page of the article. Is there a field I need to change to extend the viewable length?
  14. lyonsperf

    Multi_Vendor_Shipping new thread

    OK, after many winmerge compares of different free shipping mods and not finding a single difference, I finally found the answer. If you enable free shipping in your admin panel/vendor section you must also go into admin panel-Modules-Order Total-Shipping, then click edit for the shipping line and change allow free shipping from true to false. This then allows the new MVS free shipping mod to enable! Three days of work for one simple change! Hope this helps someone else!
  15. lyonsperf

    Multi_Vendor_Shipping new thread

    I need it to offer free shipping after a minimum is reached.
  16. lyonsperf

    Multi_Vendor_Shipping new thread

    Here's the code I have <?php /* $Id$ freeamount.php 2 Modified for MVS_1.2.3 2010/03/03 Motorcity Modified for MVS V1.0 2006/03/25 JCK/CWG osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2006 osCommerce Released under the GNU General Public License ---------------------------------------------- ane - 06/02/02 - modified freecount.php to allow for freeshipping on minimum order amount originally written by dwatkins 1/24/02 Modified BearHappy 09/04/04 ---------------------------------------------- */ class freeamount { var $code, $title, $description, $icon, $enabled; // class constructor function freeamount() { global $order, $vendors_id; $this->code = 'freeamount'; $this->title = MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE; $this->description = MODULE_SHIPPING_FREEAMOUNT_TEXT_DESCRIPTION; $this->icon =''; $this->delivery_country_id = $order->delivery['country']['id']; $this->delivery_zone_id = $order->delivery['zone_id']; } //MVS start function sort_order($vendors_id = '1') { if (defined(@ constant('MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER_' . $vendors_id))) { $this->sort_order = @ constant('MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER_' . $vendors_id); } else { $this->sort_order = '-'; } return $this->sort_order; } function tax_class($vendors_id='1') { $this->tax_class = constant('MODULE_SHIPPING_FREEAMOUNT_TAX_CLASS_' . $vendors_id); return $this->tax_class; } function enabled($vendors_id='1') { $this->enabled = false; $status = @ constant('MODULE_SHIPPING_FREEAMOUNT_STATUS_' . $vendors_id); if (isset ($status) && $status != '') { $this->enabled = (($status == 'True') ? true : false); } if (($this->enabled == true) && ((int) constant('MODULE_SHIPPING_FREEAMOUNT_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_FREEAMOUNT_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_FREEAMOUNT_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_FREEAMOUNT_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $order->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'] == $order->delivery['zone_id']) { $check_flag = true; break; } //if } //while if ($check_flag == false) { $this->enabled = false; } //if } //if return $this->enabled; } //function //MVS End // class methods function quote($method = '', $module = '', $vendors_id = '1') { global $_POST, $order, $cart, $total_count, $shipping_weight, $shipping_num_boxes; //MVS Start $vendors_data_query = tep_db_query("select handling_charge, handling_per_box, vendor_country, vendors_zipcode from " . TABLE_VENDORS . " where vendors_id = '" . (int) $vendors_id . "'"); $vendors_data = tep_db_fetch_array($vendors_data_query); $country_name = tep_get_countries($vendors_data['vendor_country'], true); $get_total = false; $get_weight = false; $handling_charge = $vendors_data['handling_charge']; $handling_per_box = $vendors_data['handling_per_box']; if ($handling_charge > $handling_per_box * $shipping_num_boxes) { $handling = $handling_charge; } else { $handling = $handling_per_box * $shipping_num_boxes; } $shipping = @[member='constant']('MODULE_SHIPPING_FREEAMOUNT_COST_' . $vendors_id) + $handling; //MVS End if ($shipping_weight > @[member='constant']('MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX_' . $vendors_id)) { if (@[member='constant']('MODULE_SHIPPING_FREEAMOUNT_DISPLAY_' . $vendors_id) == 'False') return; // This next line might be used by some sites, but most wouldn't want it by default. // $this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_TOO_HEAVY . ' (' . $shipping_weight . ') ' . MODULE_SHIPPING_FREEAMOUNT_TEXT_UNIT; $get_weight = false; } else { $get_weight = true; } if ($cart->show_total() < @[member='constant']('MODULE_SHIPPING_FREEAMOUNT_AMOUNT_' . $vendors_id)) { if (@[member='constant']('MODULE_SHIPPING_FREEAMOUNT_DISPLAY_' . $vendors_id) == 'False') return; $this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_ERROR . ' (' . @[member='constant']('MODULE_SHIPPING_FREEAMOUNT_AMOUNT_' . $vendors_id) . ') '; $get_total = false; } else { $get_total = true; if (($get_total == true && $get_weight == true)) { $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY, 'cost' => $shipping))); } } 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']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; } function check($vendors_id = '1') { if (!isset ($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FREEAMOUNT_STATUS_" . $vendors_id . "'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } 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 Free Shipping with Minimum Purchase', 'MODULE_SHIPPING_FREEAMOUNT_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer minimum order free shipping?', '6', '7', '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 ('Maximum Weight', 'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX_" . $vendors_id . "', '10', 'What is the maximum weight you will ship?', '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, set_function, date_added, vendors_id) values ('Enable Display', 'MODULE_SHIPPING_FREEAMOUNT_DISPLAY_" . $vendors_id . "', 'True', 'Do you want to display text way if the minimum amount is not reached?', '6', '7', '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 ('Minimum Cost', 'MODULE_SHIPPING_FREEAMOUNT_AMOUNT_" . $vendors_id . "', '50.00', 'Minimum order amount purchased before shipping is free?', '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 ('Sort Order', 'MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER_" . $vendors_id . "', '0', 'Sort order of display.', '6', '0', now(), '" . $vendors_id . "')"); 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_FREEAMOUNT_TAX_CLASS_" . $vendors_id . "', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now(), '" . $vendors_id . "')"); 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_FREEAMOUNT_ZONE_" . $vendors_id . "', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now(), '" . $vendors_id . "')"); } function remove($vendors_id) { tep_db_query("delete from " . TABLE_VENDOR_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys($vendors_id)) . "')"); } function keys($vendors_id) { return array ( 'MODULE_SHIPPING_FREEAMOUNT_STATUS_' . $vendors_id, 'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX_' . $vendors_id, 'MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER_' . $vendors_id, 'MODULE_SHIPPING_FREEAMOUNT_DISPLAY_' . $vendors_id, 'MODULE_SHIPPING_FREEAMOUNT_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_FREEAMOUNT_AMOUNT_' . $vendors_id, 'MODULE_SHIPPING_FREEAMOUNT_ZONE_' . $vendors_id ); } } ?>
  17. lyonsperf

    Multi_Vendor_Shipping new thread

    Works fine for flat rate.
  18. lyonsperf

    Multi_Vendor_Shipping new thread

    Thanks Jim that worked great! Heres another for you. I activated the free shipping module in mvs and it works fine until the customer gets to the checkout shipping page. The system is looking for the customer to select the shipping method for the order, which would be free shipping when the order is over the minimum. But there is no button or box for the customer to select. If you click continue the page reloads with a warning to please select a shipping method. Any ideas? Thanks Matt
  19. lyonsperf

    Multi_Vendor_Shipping new thread

    Is anyone else getting this message on their checkout_shipping page? Warning: usort() expects parameter 2 to be a valid callback, class 'upsxml' does not have a method 'rate_sort_func' in /home/protecom/public_html/includes/modules/vendors_shipping/upsxml.php on line 420 I did a seach and came up with nothing
  20. lyonsperf

    Article Manager v1.0

    Hi Jack, How can I adjust the size of the article xsell box? Where are the parameters drawn from in 2.2?
  21. lyonsperf

    Article Manager v1.0

    Hi Jack, includes/modules/article_listing.php is calling for function clean_html_comments and is causing an error. I do not have this file and it is not in the stock osc 2.2. Can this function be removed?
  22. lyonsperf

    Sitemap SEO

    I fixed it by deleting all the javascript calls from the body section and adding one at the end of the index.php file after <!-- footer_eof //-->. On another note, on the sitemap.php page of the website I get this error which I reported earlier this year. This only occurs on this page. So I am assuming there is a conflict between Articles Manager and Sitemap seo. Being that you monitor both, do you have any suggestions? Fatal error: Cannot redeclare getboldtags() (previously declared in /home/xxxx/public_html/includes/boxes/articles.php:42) in /home/xxxx/public_html/includes/boxes/articles.php on line 59
  23. lyonsperf

    Sitemap SEO

    Jack, I noticed that the sitemap_seo.js sript is called several times in index.php. This is causing a delay in page load. Does the mod require the script to be called each time a function is performed?
  24. lyonsperf

    Multi_Vendor_Shipping new thread

    Here is the file attachment. You will also need the wsdl folder from fedex webservices contribution as well as the language/english/modules/shipping/fedexwebservices.php file. fedexwebservices.php
  25. lyonsperf

    Multi_Vendor_Shipping new thread

    Heres the corrected code for fedexwebservices.php After much searching, found the mod in creloaded. I modded it to work with RC2.2a. <?php /* FedEx Webservice Version 9.4.2 for osCommerce 2.2rc2a and later(?) -by Roaddoctor 5/20/2012 New contributed code and the hard work credit to Jeff Lew. Thanks Jeff and Numinex! $Loc: catalog/includes/modules/vendors_shipping/ $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Released under the GNU General Public License */ class fedexwebservices { var $code, $title, $description, $icon, $sort_order, $enabled, $tax_class, $fedex_key, $fedex_pwd, $fedex_act_num, $fedex_meter_num, $country; //Class Constructor function fedexwebservices() { global $order, $customer_id; $this->vendors_id = (isset($_GET['vendors_id']) && !empty($_GET['vendors_id'])) ? (int)$_GET['vendors_id'] : NULL; $this->code = "fedexwebservices"; $this->title = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TEXT_TITLE; $this->handling_fee = MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE; $this->icon = DIR_WS_ICONS . 'shipping_fedex.gif'; $this->ok_to_install = (@[member='Extension']_loaded('soap')) ? TRUE : FALSE; if ($this->ok_to_install) { $this->description = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TEXT_DESCRIPTION; } else { $this->description = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TEXT_NO_SOAP_DESCRIPTION; } if (defined("SHIPPING_ORIGIN_COUNTRY")) { if ((int)SHIPPING_ORIGIN_COUNTRY > 0) { $countries_array = $this->get_countries(SHIPPING_ORIGIN_COUNTRY, true); $this->country = $countries_array['countries_iso_code_2']; } else { $this->country = SHIPPING_ORIGIN_COUNTRY; } } else { $this->country = STORE_ORIGIN_COUNTRY; } $this->delivery_country_id = $order->delivery['country']['id']; $this->delivery_zone_id = $order->delivery['zone_id']; } // MVS ADD function sort_order($vendors_id = '1') { $sort_order = @[member='constant'] ('MODULE_SHIPPING_FEDEX_WEB_SERVICES_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_FEDEX_WEB_SERVICES_TAX_CLASS_' . $vendors_id); return $this->tax_class; } function enabled($vendors_id = '1') { $this->enabled = false; $status = @[member='constant']('MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_' . $vendors_id); if (isset ($status) && $status != '') { $this->enabled = (($status == 'true') ? true : false); } if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_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_FEDEX_WEB_SERVICES_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; } } return $this->enabled; } function zones($vendors_id = '1') { if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_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_FEDEX_WEB_SERVICES_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; } } return $this->enabled; } // Get the quote from Fedex API function quote($method = '', $module = '', $vendors_id = '1') { global $shipping_weight, $shipping_num_boxes, $cart, $order; $this->vendors_id = $vendors_id; $this->weight_type = @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_ . $this->vendors_id); $this->fedex_key = @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_ . $this->vendors_id); $this->fedex_pwd = @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_ . $this->vendors_id); $this->fedex_act_num = @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_ . $this->vendors_id); $this->fedex_meter_num = @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_ . $this->vendors_id); @[member='definedmedia']('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE_' . $this->vendors_id, 0); if (defined('MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER_' . $this->vendors_id) && @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER_ . $this->vendors_id) == 'Test') { $path_to_wsdl = DIR_FS_CATALOG . 'includes/wsdl/RateService_v9_test.wsdl'; } else { $path_to_wsdl = DIR_FS_CATALOG . 'includes/wsdl/RateService_v9.wsdl'; } ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient($path_to_wsdl, array('trace' => 1)); $this->types = array(); if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_ . $this->vendors_id) == 'true') { $this->types['INTERNATIONAL_PRIORITY'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['EUROPE_FIRST_INTERNATIONAL_PRIORITY'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_ . $this->vendors_id) == 'true') { $this->types['INTERNATIONAL_ECONOMY'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_ . $this->vendors_id) == 'true') { $this->types['STANDARD_OVERNIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_ . $this->vendors_id) == 'true') { $this->types['FIRST_OVERNIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_ . $this->vendors_id) == 'true') { $this->types['PRIORITY_OVERNIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_ . $this->vendors_id) == 'true') { $this->types['FEDEX_2_DAY'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } // because FEDEX_GROUND also is returned for Canadian Addresses, we need to check if the country matches the store country and whether international ground is enabled if ((@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_ . $this->vendors_id) == 'true' && $order->delivery['country']['id'] == STORE_COUNTRY) || (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_ . $this->vendors_id) == 'true' && ($order->delivery['country']['id'] != STORE_COUNTRY) && @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_ . $this->vendors_id) == 'true')) { $this->types['FEDEX_GROUND'] = array('icon' => '', 'handling_fee' => ($order->delivery['country']['id'] == STORE_COUNTRY ? @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_ . $this->vendors_id) : @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_ . $this->vendors_id))); $this->types['GROUND_HOME_DELIVERY'] = array('icon' => '', 'handling_fee' => ($order->delivery['country']['id'] == STORE_COUNTRY ? @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_ . $this->vendors_id) : @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_ . $this->vendors_id))); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_ . $this->vendors_id) == 'true') { $this->types['INTERNATIONAL_GROUND'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_ . $this->vendors_id) == 'true') { $this->types['FEDEX_EXPRESS_SAVER'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_ . $this->vendors_id) == 'true') { $this->types['FEDEX_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['FEDEX_NATIONAL_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['FEDEX_1_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['FEDEX_2_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['FEDEX_3_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['INTERNATIONAL_ECONOMY_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['INTERNATIONAL_PRIORITY_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } // customer details $street_address = $order->delivery['street_address']; $street_address2 = $order->delivery['suburb']; $city = $order->delivery['city']; $state = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], ''); if ($state == "QC") $state = "PQ"; $postcode = str_replace(array(' ', '-'), '', $order->delivery['postcode']); //$country_id = $order->delivery['country']['iso_code_2']; $delivery_country_arr = $this->get_countries($this->delivery_country_id, true); $country_id = $delivery_country_arr['countries_iso_code_2']; $totals = $order->info['subtotal'] = $cart->total; $this->_setInsuranceValue($totals); $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->fedex_key, 'Password' => $this->fedex_pwd)); $request['ClientDetail'] = array('AccountNumber' => $this->fedex_act_num, 'MeterNumber' => $this->fedex_meter_num); $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v9 using PHP ***'); $request['Version'] = array('ServiceId' => 'crs', 'Major' => '9', 'Intermediate' => '0', 'Minor' => '0'); $request['ReturnTransitAndCommit'] = true; $request['RequestedShipment']['DropoffType'] = $this->_setDropOff(); // valid values REGULAR_PICKUP, REQUEST_COURIER, ... $request['RequestedShipment']['ShipTimestamp'] = date('c'); $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ... $request['RequestedShipment']['TotalInsuredValue']=array('Ammount'=> $this->insurance, 'Currency' => $_SESSION['currency']); $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->fedex_key, 'Password' => $this->fedex_pwd)); $request['ClientDetail'] = array('AccountNumber' => $this->fedex_act_num, 'MeterNumber' => $this->fedex_meter_num); $request['RequestedShipment']['Shipper'] = array('Address' => array( 'StreetLines' => array(@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1_ . $this->vendors_id), utf8_encode(@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2_ . $this->vendors_id))), // Origin details 'City' => utf8_encode(@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY_ . $this->vendors_id)), 'StateOrProvinceCode' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE_ . $this->vendors_id), 'PostalCode' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL_ . $this->vendors_id), 'CountryCode' => $this->country)); $request['RequestedShipment']['Recipient'] = array('Address' => array ( 'StreetLines' => array(utf8_encode($street_address), utf8_encode($street_address2)), // customer street address 'City' => utf8_encode($city), //customer city 'PostalCode' => $postcode, //customer postcode 'CountryCode' => $country_id, 'Residential' => ($order->delivery['company'] != '' ? false : true))); //customer county code if (in_array($country_id, array('US', 'CA'))) { $request['RequestedShipment']['Recipient']['StateOrProvinceCode'] = $state; } $request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER', 'Payor' => array('AccountNumber' => $this->fedex_act_num, // payor's account number 'CountryCode' => $this->country)); $request['RequestedShipment']['RateRequestTypes'] = 'LIST'; $request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES'; $request['RequestedShipment']['RequestedPackageLineItems'] = array(); $dimensions_failed = false; // default method for calculating number of packages if ($shipping_weight == 0) $shipping_weight = 0.1; for ($i=0; $i<$shipping_num_boxes; $i++) { $request['RequestedShipment']['RequestedPackageLineItems'][] = array('Weight' => array('Value' => $shipping_weight, 'Units' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_ . $this->vendors_id))); } $request['RequestedShipment']['PackageCount'] = $shipping_num_boxes; if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_ . $this->vendors_id)== 'true') { $request['RequestedShipment']['ServiceOptionType'] = 'SATURDAY_DELIVERY'; } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_ . $this->vendors_id) >= 0 && $totals >= @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_ . $this->vendors_id)) { $request['RequestedShipment']['SpecialServicesRequested'] = 'SIGNATURE_OPTION'; } $response = $client->getRates($request); if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR' && is_array($response->RateReplyDetails) || is_object($response->RateReplyDetails)) { if (is_object($response->RateReplyDetails)) { $response->RateReplyDetails = get_object_vars($response->RateReplyDetails); } $show_box_weight = " (Total items: " . $shipping_num_boxes . ' pcs. Total weight: '.number_format($shipping_weight * $shipping_num_boxes,2).' '.strtolower($this->weight_type).'s)'; $this->quotes = array('id' => $this->code, 'module' => $this->title . $show_box_weight, 'info' => $this->info()); $methods = array(); foreach ($response->RateReplyDetails as $rateReply) { if (array_key_exists($rateReply->ServiceType, $this->types) && ($method == '' || str_replace('_', '', $rateReply->ServiceType) == $method)) { if(@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_ . $this->vendors_id) == 'LIST') { foreach($rateReply->RatedShipmentDetails as $ShipmentRateDetail) { if($ShipmentRateDetail->ShipmentRateDetail->RateType=='PAYOR_LIST_PACKAGE') { $cost = $ShipmentRateDetail->ShipmentRateDetail->TotalNetCharge->Amount; $cost = (float)round(preg_replace('/[^0-9.]/', '', $cost), 2); } } } else { $cost = $rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount; $cost = (float)round(preg_replace('/[^0-9.]/', '', $cost), 2); } if (in_array($rateReply->ServiceType, array('GROUND_HOME_DELIVERY', 'FEDEX_GROUND', 'INTERNATIONAL_GROUND'))) { $transitTime = ' (' . str_replace(array('_', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteeen'), array(' ', 1,2,3,4,5,6,7,8,9,10,11,12,13,14), strtolower($rateReply->TransitTime)) . ')'; } $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType), 'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))) . $transitTime, 'cost' => $cost + (strpos($this->types[$rateReply->ServiceType]['handling_fee'], '%') ? ($cost * (float)$this->types[$rateReply->ServiceType]['handling_fee'] / 100) : (float)$this->types[$rateReply->ServiceType]['handling_fee'])); } } $this->quotes['methods'] = $methods; if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } } else { $message = 'Error in processing transaction.<br /><br />'; foreach ($response -> Notifications as $notification) { if(is_array($response -> Notifications)) { $message .= $notification->Severity; $message .= ': '; $message .= $notification->Message . '<br />'; } else { $message .= $notification->Message . '<br />'; } } $this->quotes = array('module' => $this->title, 'error' => $message); } // Fedex cannot ship to po box if (preg_match("/^P(.+)O(.+)BOX/i", $order->delivery['street_address']) || preg_match("/^PO BOX/i",$order->delivery['street_address']) || preg_match("/^P(.+)O(.+)BOX/i", $order->delivery['suburb']) || preg_match("/^[A-Z]PO/i", $order->delivery['street_address']) || preg_match("/^[A-Z]PO/i",$order->delivery['suburb'])) { $this->quotes = array('module' => $this->title, 'error' => '<font size=+2 color=red><b>Federal Express cannot ship to Post Office Boxes.<b></font><br>Use the Change Address button above to use a FedEx accepted street address.'); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; } // Return expanded info in FEAC function info() { return @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INFO_ . $this->vendors_id); // add a description here or leave blank to disable } // Internal function to set insurance value function _setInsuranceValue($order_amount){ if ($order_amount > (float)@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE_ . $this->vendors_id)) { $this->insurance = sprintf("%01.2f", $order_amount); } else { $this->insurance = 0; } } // Set the drop off type function _setDropOff() { switch(@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF_ . $this->vendors_id)) { case '1': return 'REGULAR_PICKUP'; break; case '2': return 'REQUEST_COURIER'; break; case '3': return 'DROP_BOX'; break; case '4': return 'BUSINESS_SERVICE_CENTER'; break; case '5': return 'STATION'; break; } } //Check the module status function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_" . $this->vendors_id . "' and vendors_id = '" . $this->vendors_id . "'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } // Install the module function install($vendors_id = '1') { $this->vendors_id = $vendors_id; if ($this->ok_to_install) { 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 FedEx Web Services','MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_" . $this->vendors_id . "','true','Do you want to offer FedEx shipping?','6','0','tep_cfg_select_option(array(\'true\',\'false\'),',now(),'" . $this->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 ('FedEx Web Services Key', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_" . $this->vendors_id . "', '', 'Enter FedEx Web Services Key', '6', '3', now(),'" . $this->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 ('FedEx Web Services Password', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_" . $this->vendors_id . "', '', 'Enter FedEx Web Services Password', '6', '3', now(),'" . $this->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 ('FedEx Account Number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_" . $this->vendors_id . "', '', 'Enter FedEx Account Number', '6', '3', now(),'" . $this->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 ('FedEx Meter Number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_" . $this->vendors_id . "', '', 'Enter FedEx Meter Number', '6', '4', now(),'" . $this->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 ('Weight Units', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_" . $this->vendors_id . "', 'LB', 'Weight Units:', '6', '10', 'tep_cfg_select_option(array(\'LB\', \'KG\'), ', now(),'" . $this->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 ('First line of street address', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1_" . $this->vendors_id . "', '', 'Enter the first line of your ship-from street address, required', '6', '20', now(),'" . $this->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 ('Second line of street address', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2_" . $this->vendors_id . "', '', 'Enter the second line of your ship-from street address, leave blank if you do not need to specify a second line', '6', '21', now(),'" . $this->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 ('City name', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY_" . $this->vendors_id . "', '', 'Enter the city name for the ship-from street address, required', '6', '22', now(),'" . $this->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 ('State or Province name', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE_" . $this->vendors_id . "', '', 'Enter the 2 letter state or province name for the ship-from street address, required for Canada and US', '6', '23', now(),'" . $this->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 ('Postal code', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL_" . $this->vendors_id . "', '', 'Enter the postal code for the ship-from street address, required', '6', '24', now(),'" . $this->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 ('Phone number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PHONE_" . $this->vendors_id . "', '', 'Enter a contact phone number for your company, required', '6', '25', now(),'" . $this->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 ('Drop off type', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF_" . $this->vendors_id . "', '1', 'Dropoff type (1 = Regular pickup, 2 = request courier, 3 = drop box, 4 = drop at BSC, 5 = drop at station)?', '6', '30', 'tep_cfg_select_option(array(\'1\',\'2\',\'3\',\'4\',\'5\'),', now(),'" . $this->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 ('Enable Express Saver', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_" . $this->vendors_id . "', 'true', 'Enable FedEx Express Saver', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->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 ('Enable Standard Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_" . $this->vendors_id . "', 'true', 'Enable FedEx Express Standard Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->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 ('Enable First Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_" . $this->vendors_id . "', 'true', 'Enable FedEx Express First Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->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 ('Enable Priority Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_" . $this->vendors_id . "', 'true', 'Enable FedEx Express Priority Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->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 ('Enable 2 Day', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_" . $this->vendors_id . "', 'true', 'Enable FedEx Express 2 Day', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->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 ('Enable International Priority', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_" . $this->vendors_id . "', 'true', 'Enable FedEx Express International Priority', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->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 ('Enable International Economy', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_" . $this->vendors_id . "', 'true', 'Enable FedEx Express International Economy', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->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 ('Enable Ground', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_" . $this->vendors_id . "', 'true', 'Enable FedEx Ground', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->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 ('Enable International Ground', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_" . $this->vendors_id . "', 'true', 'Enable FedEx International Ground', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->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 ('Enable Freight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_" . $this->vendors_id . "', 'true', 'Enable FedEx Freight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->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 ('Enable Saturday Delivery', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_" . $this->vendors_id . "', 'false', 'Enable Saturday Delivery', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->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 ('Domestic Ground Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_" . $this->vendors_id . "', '', 'Add a domestic handling fee or leave blank (example: 15 or 15%)', '6', '25', now(),'" . $this->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 ('Home Delivery Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_" . $this->vendors_id . "', '', 'Add a home delivery handling fee or leave blank (example: 15 or 15%)', '6', '25', now(),'" . $this->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 ('Domestic Express Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_" . $this->vendors_id . "', '', 'Add a domestic handling fee or leave blank (example: 15 or 15%)', '6', '25', now(),'" . $this->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 ('International Ground Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_" . $this->vendors_id . "', '', 'Add an international handling fee or leave blank (example: 15 or 15%)', '6', '25', now(),'" . $this->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 ('International Express Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_" . $this->vendors_id . "', '', 'Add an international handling fee or leave blank (example: 15 or 15%)', '6', '25', now(),'" . $this->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 ('FedEx Rates','MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_" . $this->vendors_id . "','LIST','FedEx Rates','6','0','tep_cfg_select_option(array(\'LIST\',\'ACCOUNT\'),',now(),'" . $this->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 ('Signature Option', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_" . $this->vendors_id . "', '-1', 'Require a signature on orders greater than or equal to (set to -1 to disable):', '6', '25', now(),'" . $this->vendors_id . "')"); 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_FEDEX_WEB_SERVICES_ZONE_" . $this->vendors_id . "', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '98', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now(),'" . $this->vendors_id . "')"); 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_FEDEX_WEB_SERVICES_TAX_CLASS_" . $this->vendors_id . "', '0', 'Use the following tax class on the shipping fee.', '6', '25', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now(),'" . $this->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 ('Web Services Mode', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER_" . $this->vendors_id . "', 'Production', 'For testing using a developer key set to \"Test\". Otherwise set to \"Production\".', '6', '10', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', now(),'" . $this->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 ('Sort Order', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER_" . $this->vendors_id . "', '0', 'Sort order of display.', '6', '99', now(),'" . $this->vendors_id . "')"); } } // Remove the module function remove($vendors_id = '1') { $this->vendors_id = $vendors_id; tep_db_query("delete from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $this->vendors_id ."' and configuration_key in ('" . implode("', '", $this->keys($this->vendors_id)) . "')"); } // Return the module configuration values function keys($vendors_id = '1') { $this->vendors_id = $vendors_id; return array('MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PHONE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER_' . $this->vendors_id ); } // Get country info function get_countries($countries_id = '', $with_iso_codes = false) { $countries_array = array(); if (tep_not_null($countries_id)) { if ($with_iso_codes == true) { $countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "' order by countries_name"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name'], 'countries_iso_code_2' => $countries_values['countries_iso_code_2'], 'countries_iso_code_3' => $countries_values['countries_iso_code_3']); } else { $countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "'"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name']); } } else { $countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name"); while ($countries_values = tep_db_fetch_array($countries)) { $countries_array[] = array('countries_id' => $countries_values['countries_id'], 'countries_name' => $countries_values['countries_name']); } } return $countries_array; } }
×