Jump to content

CatDadRick

Members
  • Content count

    253
  • Joined

  • Last visited

Everything posted by CatDadRick

  1. CatDadRick

    Multi_Vendor_Shipping new thread

    Craig, I had to change the structure of some of the fields in the vendors table. The max_box_weight and tare_weight fields needed to alllow for larger weights so I changed mine to "dec 15,4". Meant to post this last week when I found it. Thanks, Rick Knight
  2. CatDadRick

    Multi_Vendor_Shipping new thread

    I just diff'd your fedex1.php against mine and found a couple of differences that may have been my problem. I say "may" because I just went to your store, created an account, put something in my cart and went to checkout. Everything seemed to work fine except when I got to Delivery Information, your Fedex module only gave one rate, Home Delivery (5 Days). That's the same thing I was getting on my site, which, by the way, now seems to be working and giving multiple rates. You can take a look at my store, I don't think we're supposed to post our store URLs here so I'll PM the address to you along with a product that uses Fedex shipping. If you have a chance, let me know how things work for you. Thanks again, Rick Knight
  3. CatDadRick

    Multi_Vendor_Shipping new thread

    Kymation, I've just applied all of your changes to the Fedex1 module and now I get only a single rate back from Fedex. Before I applied the changes, I was getting a choice of several rates. The rate I do get back is or method "Home delivery (2 Days)" and it's the same cost as that method prior to your changes. Thanks, Rick Knight
  4. CatDadRick

    Multi_Vendor_Shipping new thread

    One more thing, and I keep forgetting about this. The "sort order" in the MVS shipping modules doesn't work. I don't think it'a big issue, but I just thought I'd mention it. Thanks, Rick Knight
  5. CatDadRick

    Multi_Vendor_Shipping new thread

    I hadn't checked this, and since I sell from a store located in a state that says shipping is taxable, I should have. Yes, taxes are not being applied to the MVS modules. Otherwise, this contribution works great. I've done some rate comparisons, and they match perfectly! Now, where are taxes added? Checkout_shipping? I'll take a look around and see what I can find, but this is probably one for Craig and Jim. Thanks, Rick Knight
  6. CatDadRick

    Multi_Vendor_Shipping new thread

    Craig, I've added code to catalog/admin/vendors.php. This just shows the selected vendros information so that I don't have to go into edit mode. Just below this line (535) echo " Vendor name: ". $vInfo->vendors_name ."<br>"; Add this // $contents[] = array('text' => tep_info_image . $vInfo->vendors_image . '<br>'); $contents[] = array('text' => '<br>' . TEXT_VENDORS_ID . ': <br><b>' . $vInfo->vendors_id . '</b>'); $contents[] = array('text' => '<br>' . TEXT_VENDORS_NAME . '<br><b>' . $vInfo->vendors_name . '</b>'); $contents[] = array('text' => '<br>' . TEXT_VENDORS_CONTACT . ': <br><b>' . $vInfo->vendors_contact . '</b>'); $contents[] = array('text' => '<br>' . TEXT_VENDORS_PHONE1 . '<br><b>' . $vInfo->vendors_phone1 . '</b>'); $contents[] = array('text' => '<br>' . TEXT_VENDORS_EMAIL . '<br><b>' . $vInfo->vendors_email . '</b>'); $contents[] = array('text' => '<br>' . TEXT_VENDORS_SEND_EMAIL . '<br><b>' . $vInfo->vendors_send_email . '</b>'); $contents[] = array('text' => '<br>' . TEXT_VENDOR_STREET . '<br><b>' . $vInfo->vendor_street . '</b>'); $contents[] = array('text' => '<br>' . TEXT_VENDOR_CITY . '<br><b>' . $vInfo->vendor_city . '</b>'); $contents[] = array('text' => '<br>' . TEXT_VENDOR_STATE . '<br><b>' . $vInfo->vendor_state . '</b>'); $contents[] = array('text' => '<br>' . TEXT_VENDORS_ZIPCODE . '<br><b>' . $vInfo->vendors_zipcode . '</b>'); $contents[] = array('text' => '<br>' . TEXT_VENDOR_COUNTRY . '<br><b>' . tep_get_country_name($vInfo->vendor_country) . '</b>'); $contents[] = array('text' => '<br>' . TEXT_ACCOUNT_NUMBER . '<br><b>' . $vInfo->account_number . '</b>'); $contents[] = array('text' => '<br>' . 'Vendors URL: '. '<br><b>' . $vInfo->vendors_url . '</b>'); $contents[] = array('text' => '<br>' . TEXT_ZONES. '<br><b>' . $vInfo->zones . '</b>'); Also, for anyone using the RMA Returns contribution, to make it work with MVS, In catalog/includes/vendor_order_info.php on line 68 find echo ' </tr>'; and add below // RMA 2.4 added // Don't show Return link if order is still pending or processing // You can change this or comment it out as best fits your store configuration if (($orders_status == '1') OR ($orders_status == '2') ) { echo '<tr><td class="smallText" valign="center" colspan="9">' . $return_link = '' . '</td></tr>'; } else { if ($order->products[$i]['return'] == '1') { $rma_query_one = tep_db_query("SELECT returns_id FROM " . TABLE_RETURNS_PRODUCTS_DATA . " where products_id = '" . $order->products[$i]['id'] . "' and order_id = '" . $HTTP_GET_VARS['order_id'] . "'"); $rma_query = tep_db_fetch_array($rma_query_one); $rma_number_query = tep_db_query("SELECT rma_value FROM " . TABLE_RETURNS . " where returns_id = '" . $rma_query['returns_id'] . "'"); $rma_result = tep_db_fetch_array($rma_number_query); echo '<tr><td class="smallText" valign="center" colspan="9">' . $return_link = '<font color=cc0000><b>' . TEXT_RMA . ' # <a href="' . tep_href_link('returns_track.php', 'action=returns_show&rma=' . $rma_result['rma_value'], 'SSL') . '">' . $rma_result['rma_value'] . '</a></td></tr>'; } else { echo '<tr><td class="smallText" valign="center" colspan="9">' . $return_link = '<a href="' . tep_href_link(FILENAME_RETURN, 'order_id=' . $HTTP_GET_VARS['order_id'] . '&products_id=' . ($order->products[$i]['id']), 'SSL') . '"><font color=cc0000><b>' . TEXT_RETURN_PRODUCT .'</a></b></font></td></tr>'; } } // EOADD RMA 2.4 This code is found in catalog/account_history_info.php and can be copied from there but some additional modifications are needed, mainly the http stuff and the "if" statement at the top of the code. Thanks again, Rick Knight
  7. CatDadRick

    Multi_Vendor_Shipping new thread

    OK. After several attempt to break something, anything, with this mod and not being able to, I decided to install it to my live store. I just finnished up with the install and some prelim testing, and everything is working and working very well. I too modified my Easypopulate and Margin report contribs to work with this, but that was relaltivly simple. It looks like some work is needed to make this work with the RMA contrib, so I'll see what I can there (any input very welcome). So far, so good. Thanks guys. Craig, I would like to see your Easypopulate and Margin report contribs. Thanks again, Rick Knight
  8. CatDadRick

    Multi_Vendor_Shipping new thread

    Well, it's been pretty quite here lately. I guess no one is finding any bugs to report. I haven't found any. Today I modified my Easypopulate and Margin Report mods to work with this. So far so good. I amy try it on my live server this weekend, especially if no one is finding any problems. Craig and Jim, EXCELLENT JOB. Thanks, Rick Knight
  9. CatDadRick

    Multi_Vendor_Shipping new thread

    Thanks Jim, that's exactly what I was after. Rick Knight
  10. CatDadRick

    Multi_Vendor_Shipping new thread

    Jim, The order information shows up correctly in the invoice listing view. What I'm trying to do is get the quantity and model to show up in the orders view. There's a status box to the left of the orders list that shows information about the selected order without actually opening the order. It works fine on old orders, but on new orders, the quantity and model are not listed, just the "x" between the two. I can't see where the information should come from for new orders. Here's that section of code from catalog/admin/orders.php. Way down near the bottom of the this code, near for ($i=0; $i<sizeof($order->products); $i++) { Is where I'm lost. I've created an IF/ELSE statement (not in listing) to detect old or new order, but I don't see what variables to use for new orders? Again, this is minor, but if you can give me a quick pointer... $heading = array(); $contents = array(); switch ($action) { case 'delete': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_ORDER . '</b>'); $contents = array('form' => tep_draw_form('orders', FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO . '<br><br><b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>'); $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('restock') . ' ' . TEXT_INFO_RESTOCK_PRODUCT_QUANTITY); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if (isset($oInfo) && is_object($oInfo)) { $heading[] = array('text' => '<b>[' . $oInfo->orders_id . '] ' . tep_datetime_short($oInfo->date_purchased) . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased)); if (tep_not_null($oInfo->last_modified)) $contents[] = array('text' => TEXT_DATE_ORDER_LAST_MODIFIED . ' ' . tep_date_short($oInfo->last_modified)); $contents[] = array('text' => '<br>' . TEXT_INFO_PAYMENT_METHOD . ' ' . $oInfo->payment_method); // RMA added $contents[] = array('align' => 'center', 'text' => '<BR><a href="' . tep_href_link('restore_order.php', 'oID=' . $oInfo->orders_id) . '"><font color=red>Restore Order</font></a>'); // EORMA // WebMakers.com Added: Show Shipping Method $contents[] = array('text' => TEXT_INFO_SHIPPING_METHOD . ' ' . tep_get_orders_shipping_method($oID)); // BOF: WebMakers.com Added: Thanks to elari added to display product list for selected order // indicate if comments exist $orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . $oInfo->orders_id . "' and comments !='" . "'" ); if (tep_db_num_rows($orders_history_query)) { $contents[] = array('align' => 'left', 'text' => '<br>*COMMENTS'); } $contents[] = array('text' => '<br>' . tep_image(DIR_WS_IMAGES . 'pixel_black.gif','','100%','3')); $order = new order($oInfo->orders_id); $contents[] = array('text' => 'Products Ordered: ' . sizeof($order->products) ); for ($i=0; $i<sizeof($order->products); $i++) { $contents[] = array('text' => $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name']); if (sizeof($order->products[$i]['attributes']) > 0) { for ($j=0; $j<sizeof($order->products[$i]['attributes']); $j++) { $contents[] = array('text' => ' <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></nobr>' ); } } } Thanks, Rick Knight
  11. CatDadRick

    Multi_Vendor_Shipping new thread

    Oops, That's one of my mods. I know where the code is, so I'll see if I can move it. At this point, I can't find anything in the mod that doesn't seem to work! I need to edit some of the mods I have installed, like RMA system and Margin Report to work with MVS, but I don't think that'll be much of a problem. I'll keep trying to find a bug, but... Thanks, Rick Knight
  12. CatDadRick

    Multi_Vendor_Shipping new thread

    Jim, Problem solved. if (tep_not_null($order->orders_shipping_id)) { require ('vendor_order_info.php'); } else { The closing brace for this bit of code was the problem. When I merged the new code into my catalog/admin/orders.php I has one brace short. I added one where it looked appropriate, but after pouring over this till I started to go blind, I found the correct spot. Now it works. One other(small) problem. In catalog/admin/orders.php, in the main Orders view, there's a small box to the right of the page with information about the currently selected order. This box has, among other things, a section near the bottom labeled "*COMMENTS" but the comments do not show up and below that is a section labeled "Products Ordered:". This section shows the total number of items orderd, quantity for each line item and the model name of the items. With an old order, this information shows up, but with a new order, I get the total quantity and then an "x" for each line item. Like this... Do you get the same results on your system? Again, not a big deal and I'm going to look for it myself, but if you have any suggestion? Thanks, Rick Knight
  13. CatDadRick

    Multi_Vendor_Shipping new thread

    Jim, No error messages on the page or in my logs. Also, the footer does load, so I think I must have just missed something in the "new order old order" section. I'm gonna diff it again and see if I can find anything. Rick Knight
  14. CatDadRick

    Multi_Vendor_Shipping new thread

    Craig, Jim, I think I found a problem in catalog/admin/orders. When I open a new order (after adding this latest version) I don't get the bottom half of the order. The order totals, comments box, order status and the couple of buttons that are normally at the bottom of the order view are missing. I do get the table showing the items purchased, but nothing below that except the page footer so I have no way to update the status of the order. If I look at an old order (before this version), all the information, comment box and buttons are avaliable. Did I miss some of the code here? Other than that, I have been trying to break this, but without much success. Great job :thumbsup: . I will keep trying. Thanks, Rick Knight
  15. CatDadRick

    Multi_Vendor_Shipping new thread

    Jim, Thanks for taking a look at this... I don't know how I missed this. I guess I've looked at this just a bit too much... Anyway, your suggestions worked. I have a full set of shipping modules now. This morning I add MVS to another test installation that's a bit closer to my actual store setup. Works great. Thanks, Rick Knight
  16. CatDadRick

    Multi_Vendor_Shipping new thread

    Jim, Craig & Tanaka, I've been working on getting the FREESHIPPER shipping module to work on this, but I'm not having much luck. I think I've made all the changes in Jim's modules.txt, but this simple mod just isn't working. I'm posting here in hopes that someone can take a quick look at it and tell me what I've missed. Also, Craig I know you guys are busy trying to get another release out the door, but have you had a chance to look at the Fedex1 module I sent? Here's the FREESHIPPER module... <?php /* WebMakers.com Added: Free Payments and Shipping Written by Linda McGrath osCOMMERCE@WebMakers.com http://www.thewebmakerscorner.com osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License */ class freeshipper { var $code, $title, $description, $icon, $enabled; // BOF: WebMakers.com Added: Free Payments and Shipping // class constructor function freeshipper() { global $order, $cart; // MVS Added $this->vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id']; // EOADD $this->code = 'freeshipper'; $this->title = MODULE_SHIPPING_FREESHIPPER_TEXT_TITLE; $this->description = MODULE_SHIPPING_FREESHIPPER_TEXT_DESCRIPTION; $this->icon = DIR_WS_ICONS . 'shipping_free_shipper.jpg'; // MVS Add/Changed /* $this->sort_order = MODULE_SHIPPING_FREESHIPPER_SORT_ORDER; $this->tax_class = MODULE_SHIPPING_FREESHIPPER_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_FREESHIPPER_STATUS == 'True') ? true : false); // Only show if weight is 0 // if ( (!strstr($PHP_SELF,'modules.php')) || $cart->show_weight()==0) { $this->enabled = MODULE_SHIPPING_FREESHIPPER_STATUS; if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREESHIPPER_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREESHIPPER_ZONE . "' 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 ($check_flag == false) { $this->enabled = false; } } */ // EOADD // } // EOF: WebMakers.com Added: Free Payments and Shipping } // MVS Added function sort_order($vendors_id='0') { if (defined (constant ('MODULE_SHIPPING_FREESHIPPER_SORT_ORDER_' . $vendors_id))) { $this->sort_order = constant('MODULE_SHIPPING_FREESHIPPER_SORT_ORDER_' . $vendors_id); } else { $this->sort_order = '0'; } return $this->sort_order; } function tax_class($vendors_id='1') { $this->tax_class = constant('MODULE_SHIPPING_FREESHIPPER_TAX_CLASS_' . $vendors_id); return $this->tax_class; } function enabled($vendors_id='1') { $this->enabled = false; $status = constant('MODULE_SHIPPING_FREESHIPPER_STATUS_' . $vendors_id); if (isset ($status) && $status != '') { $this->enabled = (($status == 'True') ? true : false); } return $this->enabled; } function zones($vendors_id='1') { if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FREESHIPPER_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_FREESHIPPER_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 // EOADD // class methods // MVS Added/Changed // function quote($method = '') { function quote($method = '', $module = '', $vendors_id = '1') { // EOADD global $order; // MVS Added /* $vendors_data_query = tep_db_query("select handling_charge, handling_per_box from " . TABLE_VENDORS . " where vendors_id = '" . (int)$vendors_id . "'" ); $vendors_data = tep_db_fetch_array($vendors_data_query); */ $vendors_data_query = tep_db_query("select v.vendor_country, v.vendors_zipcode from " . TABLE_VENDORS . " v, " . TABLE_COUNTRIES . " c where v.vendors_id = '" . (int)$vendors_id . "' and v.vendor_country = c.countries_id" ); $vendors_data = tep_db_fetch_array($vendors_data_query); $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; } // EOADD $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_FREESHIPPER_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => '<FONT COLOR=FF0000><B>' . MODULE_SHIPPING_FREESHIPPER_TEXT_WAY . '</B></FONT>', // MVS Added/Changed // 'cost' => SHIPPING_HANDLING + MODULE_SHIPPING_FREESHIPPER_COST))); 'cost' => $shipping + $handling))); // EOADD if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $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(/*MVS*/$vendors_id='1') { if (!isset($this->_check)) { // MVS Added/Changed // $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FREESHIPPER_STATUS'"); $check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_FREESHIPPER_STATUS_" . $vendors_id . "'"); // EOADD $this->_check = tep_db_num_rows($check_query); } return $this->_check; } // MVS Added/Changed /* function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Enable Free Shipping', 'MODULE_SHIPPING_FREESHIPPER_STATUS', '1', 'Do you want to offer Free shipping?', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Free Shipping Cost', 'MODULE_SHIPPING_FREESHIPPER_COST', '0.00', 'What is the Shipping cost? The Handling fee will also be added.', '6', '6', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_FREESHIPPER_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_FREESHIPPER_ZONE', '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())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FREESHIPPER_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); } */ 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, date_added, vendors_id) values ('Enable Free Shipping', 'MODULE_SHIPPING_FREESHIPPER_STATUS_" . $vendors_id . "', '1', 'Do you want to offer Free shipping?', '6', '5', 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 ('Free Shipping Cost', 'MODULE_SHIPPING_FREESHIPPER_COST_" . $vendors_id . "', '0.00', 'What is the Shipping cost? The Handling fee will also be added.', '6', '6', 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_FREESHIPPER_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_FREESHIPPER_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 . "')"); 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_FREESHIPPER_SORT_ORDER_" . $vendors_id . "', '0', 'Sort order of display.', '6', '0', now(), '" . $vendors_id . "')"); } // EOADD function remove(/*MVS*/$vendors_id='1') { // $keys = ''; // $keys_array = $this->keys(); // for ($i=0; $i<sizeof($keys_array); $i++) { // $keys .= "'" . $keys_array[$i] . "',"; // } // $keys = substr($keys, 0, -1); // MVS Added/Changed // tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")"); tep_db_query("delete from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key in ('" . implode("', '", $this->keys($vendors_id)) . "')"); // EOADD } function keys(/*MVS*/$vendors_id='1') { return array('MODULE_SHIPPING_FREESHIPPER_STATUS' . $vendors_id, 'MODULE_SHIPPING_FREESHIPPER_COST' . $vendors_id, 'MODULE_SHIPPING_FREESHIPPER_TAX_CLASS' . $vendors_id, 'MODULE_SHIPPING_FREESHIPPER_ZONE' . $vendors_id, 'MODULE_SHIPPING_FREESHIPPER_SORT_ORDER' . $vendors_id); } } ?> Thanks guys, Rick Knight
  17. CatDadRick

    Multi_Vendor_Shipping new thread

    Craig, Jim, That works. I added just the top two code snippets and left my usps.php as is. I think I'll apply the changes in usps.php to fedex1.php and see how it goes. I'll let you know how I do. I can't wait to see the rest of this mod! Thanks, Rick Knight
  18. CatDadRick

    Multi_Vendor_Shipping new thread

    Jim, I haven't made these changes yet, but I will today. In the mean time, I changed SHIPPING_ORIGIN_ZIP in my sups.php as you suggested and then took a look at my configuration table and found that the country codes required for USPS are numeric and the US is 223. I put 223 into the vendor_country field in the vendors table and it worked. I'm getting quotes from USPS. Do your mods do the same thing, that is, convert the ISO code to the numeric code? Thanks, Rick Knight
  19. CatDadRick

    Multi_Vendor_Shipping new thread

    BlueCollarGuy, I've searched the thread for Jim's fix for vendors.php, but I can't find it. Do you mean the fix he posted for vendor_modules.php? Thanks, Rick Knight
  20. CatDadRick

    Multi_Vendor_Shipping new thread

    You know, I kept looking at SHIPPING_ORIGIN_ZIP and thinking it should be changed somehow. I think the USPS country format is standard 2 character code, like US, GB etc. If you look at the bottom of my USPS module you'll see a country code list and it's all standard 2 character, but it doesn't list the US. If I have time tonight I'll look at SHIPPING_ORIGIN_ZIP some more. Thanks, Rick Knight
  21. CatDadRick

    Multi_Vendor_Shipping new thread

    Jim, That's getting closer. After making those changes, I no longer get any error messages from the USPS module. In a test transaction I get the following error in the Shipping Methods > Products box under United States Postal Service... This looks like a USPS error code, so my ID and Password are being passed off to USPS and something is getting back. I think. Thanks again, Rick Knight
  22. CatDadRick

    Multi_Vendor_Shipping new thread

    Thanks Jim, I'll give it a try and let you know how it works. Rick Knight
  23. CatDadRick

    Multi_Vendor_Shipping new thread

    Kymation, I'm still trying to make the USPS modules work, both my modified USPS module and the one you've packaged with MVS and I've found a couple of things. First, according to your modules.txt, when converting a shipping module for use with MVS, one of the first modifications to make is to change this // class constructor function usps() { global $order; to // class constructor function usps() { global $order, $vendors_id; It looks like this was missed in your usps.php, however, adding it made no difference. Second, in my usps.php, things appear to be working with the same results as your usps.php, but I'm getting an error in my httpd logs that looks like halfway through processing the usps.php file, the $vendors_id variable is lost! I'm getting the following error in my log for all the lines below function getQuote() { global $order; Here's the error message Note the constant ends with the underscore, not a number. This is repeated 5 times, once on each of these lines 324, 328, 340 and 396, twice on line 328. All of the lines above 324 that have the contant in them are apparently handled OK. I am able to install and uninstall the module and it works just as yours does including not giving a quote. I'm going to attach my usps.php here. Maybe you can take a quick look and see why the $vendors_id variable seems to get dropped. <?php/* $Id: usps.php,v 1.47 2003/04/08 23:23:42 dgw_ Exp $ ++++ modified as USPS Methods 2.5 08/02/03 by Brad Waite and Fritz Clapp ++++ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class usps { var $code, $title, $description, $icon, $enabled, $countries; // class constructor function usps() { global $order, /* MVS */$vendors_id; // Added MVS $this->vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id']; // End ADD $this->code = 'usps'; $this->title = MODULE_SHIPPING_USPS_TEXT_TITLE; $this->description = MODULE_SHIPPING_USPS_TEXT_DESCRIPTION; $this->icon = DIR_WS_ICONS . 'shipping_usps.gif'; // Removed MVS /* $this->sort_order = MODULE_SHIPPING_USPS_SORT_ORDER; $this->tax_class = MODULE_SHIPPING_USPS_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false); if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_USPS_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_USPS_ZONE . "' 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 ($check_flag == false) { $this->enabled = false; } } End of Remove */ $this->types = array('Express' => 'Express Mail', 'First Class' => 'First-Class Mail', 'Priority' => 'Priority Mail', 'Parcel' => 'Parcel Post'); $this->intl_types = array('GXG Document' => 'Global Express Guaranteed Document Service', 'GXG Non-Document' => 'Global Express Guaranteed Non-Document Service', 'Express' => 'Global Express Mail (EMS)', 'Priority Lg' => 'Global Priority Mail - Flat-rate Envelope (large)', 'Priority Sm' => 'Global Priority Mail - Flat-rate Envelope (small)', 'Priority Var' => 'Global Priority Mail - Variable Weight Envelope (single)', 'Airmail Letter' => 'Airmail Letter Post', 'Airmail Parcel' => 'Airmail Parcel Post', 'Surface Letter' => 'Economy (Surface) Letter Post', 'Surface Post' => 'Economy (Surface) Parcel Post'); $this->countries = $this->country_list(); } // MVS ADD function sort_order($vendors_id='0') { if (defined (constant ('MODULE_SHIPPING_USPS_SORT_ORDER_' . $vendors_id))) { $this->sort_order = constant('MODULE_SHIPPING_USPS_SORT_ORDER_' . $vendors_id); } else { $this->sort_order = '0'; } return $this->sort_order; } function tax_class($vendors_id='1') { $this->tax_class = constant('MODULE_SHIPPING_USPS_TAX_CLASS_' . $vendors_id); return $this->tax_class; } function enabled($vendors_id='1') { $this->enabled = false; $status = constant('MODULE_SHIPPING_USPS_STATUS_' . $vendors_id); if (isset ($status) && $status != '') { $this->enabled = (($status == 'True') ? true : false); } return $this->enabled; } function zones($vendors_id='1') { if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_USPS_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_USPS_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 // EOADD MVS // class methods // Changed MVS // function quote($method = '') { function quote($method = '', $module = '', $vendors_id = '1') { // EOCHANGE // BOF: UPS USPS global $order, $shipping_weight, $shipping_num_boxes, $transittime; if ( tep_not_null($method) && (isset($this->types[$method]) || in_array($method, $this->intl_types)) ) { $this->_setService($method); } $this->_setMachinable('False'); $this->_setContainer('None'); $this->_setSize('REGULAR'); // usps doesnt accept zero weight $shipping_weight = ($shipping_weight < 0.1 ? 0.1 : $shipping_weight); $shipping_pounds = floor ($shipping_weight); $shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight))); $this->_setWeight($shipping_pounds, $shipping_ounces); // BOF: UPS USPS if (in_array('Display weight', explode(', ', constant('MODULE_SHIPPING_USPS_OPTIONS_' . $vendors_id)))) { $shiptitle = ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)'; } else { $shiptitle = ''; } // EOF: UPS USPS $uspsQuote = $this->_getQuote(); if (is_array($uspsQuote)) { if (isset($uspsQuote['error'])) { $this->quotes = array('module' => $this->title, 'error' => $uspsQuote['error']); } else { // Added MVS $vendors_data_query = tep_db_query("select handling_charge, handling_per_box from " . TABLE_VENDORS . " where vendors_id = '" . (int)$vendors_id . "'" ); $vendors_data = tep_db_fetch_array($vendors_data_query); $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; } // EOADD MVS /* Original $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)'); */ // BOF: UPS USPS $this->quotes = array('id' => $this->code, 'module' => $this->title . $shiptitle); // EOF: UPS USPS $methods = array(); $size = sizeof($uspsQuote); for ($i=0; $i<$size; $i++) { list($type, $cost) = each($uspsQuote[$i]); // BOF: UPS USPS $title = ((isset($this->types[$type])) ? $this->types[$type] : $type); if(in_array('Display transit time', explode(', ', constant('MODULE_SHIPPING_USPS_OPTIONS_' . $vendors_id)))) $title .= $transittime[$type]; /* ORIGINAL $methods[] = array('id' => $type, 'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type), 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes); */ $methods[] = array('id' => $type, 'title' => $title, 'cost' => ($cost + $handling) * $shipping_num_boxes); } // EOF: UPS USPS $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 { $this->quotes = array('module' => $this->title, 'error' => MODULE_SHIPPING_USPS_TEXT_ERROR); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; } // MVS Added/Changed // function check() { function check($vendors_id = '1') { //EOMVS if (!isset($this->_check)) { // MVS Added/Changed // $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_USPS_STATUS'"); $check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_USPS_STATUS_" . $vendors_id . "'"); // EOMVS $this->_check = tep_db_num_rows($check_query); } return $this->_check; } // MVS Added/Changed /* function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable USPS Shipping', 'MODULE_SHIPPING_USPS_STATUS', 'True', 'Do you want to offer USPS shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Enter the USPS User ID', 'MODULE_SHIPPING_USPS_USERID', 'NONE', 'Enter the USPS USERID assigned to you.', '6', '0', now())"); // BOF: UPS USPS tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Enter the USPS Password', 'MODULE_SHIPPING_USPS_PASSWORD', 'NONE', 'See USERID, above.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Which server to use', 'MODULE_SHIPPING_USPS_SERVER', 'production', 'An account at USPS is needed to use the Production server', '6', '0', 'tep_cfg_select_option(array(\'test\', \'production\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_USPS_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_USPS_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_USPS_ZONE', '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())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_USPS_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Domestic Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES', 'Express, Priority, First Class, Parcel', 'Select the domestic services to be offered:', '6', '14', 'tep_cfg_select_multioption(array(\'Express\', \'Priority\', \'First Class\', \'Parcel\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Int\'l Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_INTL', 'GXG Document, GXG Non-Document, Express, Priority Lg, Priority Sm, Priority Var, Airmail Letter, Airmail Parcel, Surface Letter, Surface Post', 'Select the international services to be offered:', '6', '15', 'tep_cfg_select_multioption(array(\'GXG Document\', \'GXG Non-Document\', \'Express\', \'Priority Lg\', \'Priority Sm\', \'Priority Var\', \'Airmail Letter\', \'Airmail Parcel\', \'Surface Letter\', \'Surface Post\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('USPS Options', 'MODULE_SHIPPING_USPS_OPTIONS', 'Display weight, Display transit time', 'Select from the following the USPS options.', '6', '16', 'tep_cfg_select_multioption(array(\'Display weight\', \'Display transit time\'), ', now())"); // EOF: UPS USPS } */ 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 USPS Shipping', 'MODULE_SHIPPING_USPS_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer USPS 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 ('Enter the USPS User ID', 'MODULE_SHIPPING_USPS_USERID_" . $vendors_id . "', 'NONE', 'Enter the USPS USERID assigned to you.', '6', '0', now(), '" . $vendors_id . "')"); // BOF: UPS USPS 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 ('Enter the USPS Password', 'MODULE_SHIPPING_USPS_PASSWORD_" . $vendors_id . "', 'NONE', 'See USERID, above.', '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, set_function, date_added, vendors_id) values ('Which server to use', 'MODULE_SHIPPING_USPS_SERVER_" . $vendors_id . "', 'production', 'An account at USPS is needed to use the Production server', '6', '0', 'tep_cfg_select_option(array(\'test\', \'production\'), ', 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 ('Handling Fee', 'MODULE_SHIPPING_USPS_HANDLING_" . $vendors_id . "', '0', 'Handling fee for this shipping method.', '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_USPS_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_USPS_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 . "')"); 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_USPS_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, set_function, date_added, vendors_id) values ('Domestic Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_" . $vendors_id . "', 'Express, Priority, First Class, Parcel', 'Select the domestic services to be offered:', '6', '14', 'tep_cfg_select_multioption(array(\'Express\', \'Priority\', \'First Class\', \'Parcel\'), ', 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 ('Int\'l Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_INTL_" . $vendors_id . "', 'GXG Document, GXG Non-Document, Express, Priority Lg, Priority Sm, Priority Var, Airmail Letter, Airmail Parcel, Surface Letter, Surface Post', 'Select the international services to be offered:', '6', '15', 'tep_cfg_select_multioption(array(\'GXG Document\', \'GXG Non-Document\', \'Express\', \'Priority Lg\', \'Priority Sm\', \'Priority Var\', \'Airmail Letter\', \'Airmail Parcel\', \'Surface Letter\', \'Surface Post\'), ', 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 ('USPS Options', 'MODULE_SHIPPING_USPS_OPTIONS_" . $vendors_id . "', 'Display weight, Display transit time', 'Select from the following the USPS options.', '6', '16', 'tep_cfg_select_multioption(array(\'Display weight\', \'Display transit time\'), ', now(), '" . $vendors_id . "')"); // EOF: UPS USPS } // EOADD // MVS Added/Changed /* function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } */ 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)) . "')"); } // EOADD // MVS Added/Changed /* function keys() { // BOF: UPS USPS // ORIGINAL return array('MODULE_SHIPPING_USPS_STATUS', 'MODULE_SHIPPING_USPS_USERID', 'MODULE_SHIPPING_USPS_PASSWORD', 'MODULE_SHIPPING_USPS_SERVER', 'MODULE_SHIPPING_USPS_HANDLING', 'MODULE_SHIPPING_USPS_TAX_CLASS', 'MODULE_SHIPPING_USPS_ZONE', 'MODULE_SHIPPING_USPS_SORT_ORDER'); return array('MODULE_SHIPPING_USPS_STATUS', 'MODULE_SHIPPING_USPS_USERID', 'MODULE_SHIPPING_USPS_PASSWORD', 'MODULE_SHIPPING_USPS_SERVER', 'MODULE_SHIPPING_USPS_HANDLING', 'MODULE_SHIPPING_USPS_TAX_CLASS', 'MODULE_SHIPPING_USPS_ZONE', 'MODULE_SHIPPING_USPS_SORT_ORDER', 'MODULE_SHIPPING_USPS_OPTIONS', 'MODULE_SHIPPING_USPS_TYPES', 'MODULE_SHIPPING_USPS_TYPES_INTL'); // EOF: UPS USPS } */ function keys($vendors_id) { // BOF: UPS USPS // ORIGINAL return array('MODULE_SHIPPING_USPS_STATUS', 'MODULE_SHIPPING_USPS_USERID', 'MODULE_SHIPPING_USPS_PASSWORD', 'MODULE_SHIPPING_USPS_SERVER', 'MODULE_SHIPPING_USPS_HANDLING', 'MODULE_SHIPPING_USPS_TAX_CLASS', 'MODULE_SHIPPING_USPS_ZONE', 'MODULE_SHIPPING_USPS_SORT_ORDER'); return array('MODULE_SHIPPING_USPS_STATUS_' . $vendors_id, 'MODULE_SHIPPING_USPS_USERID_' . $vendors_id, 'MODULE_SHIPPING_USPS_PASSWORD_' . $vendors_id, 'MODULE_SHIPPING_USPS_SERVER_' . $vendors_id, 'MODULE_SHIPPING_USPS_HANDLING_' . $vendors_id, 'MODULE_SHIPPING_USPS_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_USPS_ZONE_' . $vendors_id, 'MODULE_SHIPPING_USPS_SORT_ORDER_' . $vendors_id, 'MODULE_SHIPPING_USPS_OPTIONS_' . $vendors_id, 'MODULE_SHIPPING_USPS_TYPES_' . $vendors_id, 'MODULE_SHIPPING_USPS_TYPES_INTL_' . $vendors_id); // EOF: UPS USPS } // EOADD MVS function _setService($service) { $this->service = $service; } function _setWeight($pounds, $ounces=0) { $this->pounds = $pounds; $this->ounces = $ounces; } function _setContainer($container) { $this->container = $container; } function _setSize($size) { $this->size = $size; } function _setMachinable($machinable) { $this->machinable = $machinable; } function _getQuote() { // BOF: UPS USPS global $order, $vendors_id, $transittime; if(in_array('Display transit time', explode(', ', constant('MODULE_SHIPPING_USPS_OPTIONS_' . $vendors_id)))) $transit = TRUE; // EOF: UPS USPS if ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY) { $request = '<RateRequest USERID="' . constant('MODULE_SHIPPING_USPS_USERID_' . $vendors_id) . '" PASSWORD="' . constant('MODULE_SHIPPING_USPS_PASSWORD_' . $vendors_id) . '">'; $services_count = 0; if (isset($this->service)) { $this->types = array($this->service => $this->types[$this->service]); } $dest_zip = str_replace(' ', '', $order->delivery['postcode']); if ($order->delivery['country']['iso_code_2'] == 'US') $dest_zip = substr($dest_zip, 0, 5); reset($this->types); // BOF: UPS USPS $allowed_types = explode(", ", constant('MODULE_SHIPPING_USPS_TYPES_' . $vendors_id)); while (list($key, $value) = each($this->types)) { // BOF: UPS USPS if ( !in_array($key, $allowed_types) ) continue; $request .= '<Package ID="' . $services_count . '">' . '<Service>' . $key . '</Service>' . '<ZipOrigination>' . SHIPPING_ORIGIN_ZIP . '</ZipOrigination>' . '<ZipDestination>' . $dest_zip . '</ZipDestination>' . '<Pounds>' . $this->pounds . '</Pounds>' . '<Ounces>' . $this->ounces . '</Ounces>' . '<Container>' . $this->container . '</Container>' . '<Size>' . $this->size . '</Size>' . '<Machinable>' . $this->machinable . '</Machinable>' . '</Package>'; // BOF: UPS USPS if($transit){ $transitreq = 'USERID="' . constant('MODULE_SHIPPING_USPS_USERID_' . $vendors_id) . '" PASSWORD="' . constant('MODULE_SHIPPING_USPS_PASSWORD_' . $vendors_id) . '">' . '<OriginZip>' . STORE_ORIGIN_ZIP . '</OriginZip>' . '<DestinationZip>' . $dest_zip . '</DestinationZip>'; switch ($key) { case 'Express': $transreq[$key] = 'API=ExpressMail&XML=' . urlencode( '<ExpressMailRequest ' . $transitreq . '</ExpressMailRequest>'); break; case 'Priority': $transreq[$key] = 'API=PriorityMail&XML=' . urlencode( '<PriorityMailRequest ' . $transitreq . '</PriorityMailRequest>'); break; case 'Parcel': $transreq[$key] = 'API=StandardB&XML=' . urlencode( '<StandardBRequest ' . $transitreq . '</StandardBRequest>'); break; default: $transreq[$key] = ''; break; } } // EOF: UPS USPS $services_count++; } $request .= '</RateRequest>'; $request = 'API=Rate&XML=' . urlencode($request); } else { $request = '<IntlRateRequest USERID="' . constant('MODULE_SHIPPING_USPS_USERID_' . $vendors_id) . '" PASSWORD="' . constant('MODULE_SHIPPING_USPS_PASSWORD_' . $vendors_id) . '">' . '<Package ID="0">' . '<Pounds>' . $this->pounds . '</Pounds>' . '<Ounces>' . $this->ounces . '</Ounces>' . '<MailType>Package</MailType>' . '<Country>' . $this->countries[$order->delivery['country']['iso_code_2']] . '</Country>' . '</Package>' . '</IntlRateRequest>'; $request = 'API=IntlRate&XML=' . urlencode($request); } switch (constant('MODULE_SHIPPING_USPS_SERVER_' . $vendors_id)) { case 'production': $usps_server = 'production.shippingapis.com'; $api_dll = 'shippingapi.dll'; break; case 'test': default: $usps_server = 'testing.shippingapis.com'; $api_dll = 'ShippingAPITest.dll'; break; } $body = ''; $http = new httpClient(); if ($http->Connect($usps_server, 80)) { $http->addHeader('Host', $usps_server); $http->addHeader('User-Agent', 'osCommerce'); $http->addHeader('Connection', 'Close'); if ($http->Get('/' . $api_dll . '?' . $request)) $body = $http->getBody(); // BOF: UPS USPS // mail('you@yourdomain.com','USPS rate quote response',$body,'From: <you@yourdomain.com>'); if ($transit && is_array($transreq) && ($order->delivery['country']['id'] == STORE_COUNTRY)) { while (list($key, $value) = each($transreq)) { if ($http->Get('/' . $api_dll . '?' . $value)) $transresp[$key] = $http->getBody(); } } // EOF: UPS USPS $http->Disconnect(); } else { return false; } $response = array(); while (true) { if ($start = strpos($body, '<Package ID=')) { $body = substr($body, $start); $end = strpos($body, '</Package>'); $response[] = substr($body, 0, $end+10); $body = substr($body, $end+9); } else { break; } } $rates = array(); if ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY) { if (sizeof($response) == '1') { if (ereg('<Error>', $response[0])) { $number = ereg('<Number>(.*)</Number>', $response[0], $regs); $number = $regs[1]; $description = ereg('<Description>(.*)</Description>', $response[0], $regs); $description = $regs[1]; return array('error' => $number . ' - ' . $description); } } $n = sizeof($response); for ($i=0; $i<$n; $i++) { if (strpos($response[$i], '<Postage>')) { $service = ereg('<Service>(.*)</Service>', $response[$i], $regs); $service = $regs[1]; $postage = ereg('<Postage>(.*)</Postage>', $response[$i], $regs); $postage = $regs[1]; $rates[] = array($service => $postage); // BOF: UPS USPS if ($transit) { switch ($service) { case 'Express': $time = ereg('<MonFriCommitment>(.*)</MonFriCommitment>', $transresp[$service], $tregs); $time = $tregs[1]; if ($time == '' || $time == 'No Data') { $time = '1 - 2 ' . MODULE_SHIPPING_USPS_TEXT_DAYS; } else { $time = 'Tomorrow by ' . $time; } break; case 'Priority': $time = ereg('<Days>(.*)</Days>', $transresp[$service], $tregs); $time = $tregs[1]; if ($time == '' || $time == 'No Data') { $time = '2 - 3 ' . MODULE_SHIPPING_USPS_TEXT_DAYS; } elseif ($time == '1') { $time .= ' ' . MODULE_SHIPPING_USPS_TEXT_DAY; } else { $time .= ' ' . MODULE_SHIPPING_USPS_TEXT_DAYS; } break; case 'Parcel': $time = ereg('<Days>(.*)</Days>', $transresp[$service], $tregs); $time = $tregs[1]; if ($time == '' || $time == 'No Data') { $time = '4 - 7 ' . MODULE_SHIPPING_USPS_TEXT_DAYS; } elseif ($time == '1') { $time .= ' ' . MODULE_SHIPPING_USPS_TEXT_DAY; } else { $time .= ' ' . MODULE_SHIPPING_USPS_TEXT_DAYS; } break; case 'First Class': $time = '2 - 5 ' . MODULE_SHIPPING_USPS_TEXT_DAYS; break; default: $time = ''; break; } if ($time != '') $transittime[$service] = ' (' . $time . ')'; } // EOF: UPS USPS } } } else { if (ereg('<Error>', $response[0])) { $number = ereg('<Number>(.*)</Number>', $response[0], $regs); $number = $regs[1]; $description = ereg('<Description>(.*)</Description>', $response[0], $regs); $description = $regs[1]; return array('error' => $number . ' - ' . $description); } else { $body = $response[0]; $services = array(); while (true) { if ($start = strpos($body, '<Service ID=')) { $body = substr($body, $start); $end = strpos($body, '</Service>'); $services[] = substr($body, 0, $end+10); $body = substr($body, $end+9); } else { break; } } // BOF: UPS USPS $allowed_types = array(); foreach( explode(", ", constant('MODULE_SHIPPING_USPS_TYPES_INTL_' . $vendors_id)) as $value ) $allowed_types[$value] = $this->intl_types[$value]; // EOF: UPS USPS $size = sizeof($services); for ($i=0, $n=$size; $i<$n; $i++) { if (strpos($services[$i], '<Postage>')) { $service = ereg('<SvcDescription>(.*)</SvcDescription>', $services[$i], $regs); $service = $regs[1]; $postage = ereg('<Postage>(.*)</Postage>', $services[$i], $regs); $postage = $regs[1]; // BOF: UPS USPS $time = ereg('<SvcCommitments>(.*)</SvcCommitments>', $services[$i], $tregs); $time = $tregs[1]; $time = preg_replace('/Weeks$/', MODULE_SHIPPING_USPS_TEXT_WEEKS, $time); $time = preg_replace('/Days$/', MODULE_SHIPPING_USPS_TEXT_DAYS, $time); $time = preg_replace('/Day$/', MODULE_SHIPPING_USPS_TEXT_DAY, $time); if( !in_array($service, $allowed_types) ) continue; // EOF: UPS USPS if (isset($this->service) && ($service != $this->service) ) { continue; } $rates[] = array($service => $postage); // BOF: UPS USPS if ($time != '') $transittime[$service] = ' (' . $time . ')'; // EOF: UPS USPS } } } } return ((sizeof($rates) > 0) ? $rates : false); } function country_list() { $list = array('AF' => 'Afghanistan', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AG' => 'Antigua and Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', 'AW' => 'Aruba', 'AU' => 'Australia',
  24. CatDadRick

    Multi_Vendor_Shipping new thread

    Thanks Jim, this fixed the UPS quotes for me. Something I've noticed though, in Admin>Vendors>Vendor Manager>Manage the Sort Order doesn't show, probably a very minor issue. Also, with the USPS module the USPS Options just show "array". Same with USPS Domestic Shipping Methods, just shows "array". I can edit the module, but when I save the changes, it stills shows "array", not the actual Options and Rates. Could that have something to do with the quote not working? I noticed that when the UPS module didn't work it had the same symptom, but now that I've applied your fix, the rates show correctly. Thanks again, Rick Knight
  25. CatDadRick

    Multi_Vendor_Shipping new thread

    Thanks Guys, that was the problem, and I also somehow managed to not copy vendors_shipping.php. Ooops. Everything appears correct except that I cannot get a UPS or USPS rate. Table and Flat work fine but UPS gives nothing and USPS returns this message I also used Jim's instructions for modifying shipping modules to modify my existing USPS module, but I get the same results. I've checked my configuration for UPS/USPS account information and rate selection, everything is correct. Any Idea why two modules work and two don't? Jim. This worked great. Easy to fillow even though there are a lot of changes that need to be made. Also, at the bottom of shopping_cart.php you have the following code... <?php require(DIR_WS_INCLUDES . 'show_variables.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> I don't have a "show_variables.php" so I commented that line out. Is it needed for something? Thank again, Rick Knight
×