Jump to content

natrium42

Members
  • Content count

    141
  • Joined

  • Last visited

Everything posted by natrium42

  1. natrium42

    Canada Post Automatic Labels

    Hmm, are you able to ship manually by using EST? It sounds like your address is not set up.
  2. As far as I know, the prices for Regular and Expedited are exactly the same for VentureOne customers. I would just disable Regular to Canada entirely.
  3. natrium42

    Canada Post Automatic Labels

    Just create a php file with phpinfo() call: http://ca2.php.net/manual/en/function.phpinfo.php It should show all modules and their options.
  4. Hmm, ok... I don't really run this version of the mod, so I can't test the code. You could try enable debugging by setting $debug = 1 and see at the responses from the Canada Post website. You can compare it to the POST/GET requests that you get if you use the Canada Post site directly using Firebug in Firefox. The way this mod works is it just uses the Canada Post website as you would manually -- Canada Post has no way to see that it's actually a script.
  5. natrium42

    Canada Post Automatic Labels

    Hmm, is your curl built with OpenSSL and libssh2?
  6. Kevin, looks like you forgot the new requests to "https://sso-cal.canadapost-postescanada.ca/cpid/apps/signIn?execution=e1s". Perhaps this would work: case 2: // curl init $ch = cp_setup(false); // new login $response = cp_get_page($ch, SSO.'/cpid/apps/signIn?LOCALE=en&~language=EN&APP_ID=B2B&SSO_REFERRER_URL=https://obc.canadapost.ca/zcpb2b/b2b/init.do?language=EN&shop=CPENCOMM'); // new login form $query_string = 'frmCPIDSignIn:signIn.x=46&frmCPIDSignIn:signIn.y=11&frmCPIDSignIn_SUBMIT=1' . '&frmCPIDSignIn:j_username=' . urlencode(MODULE_SHIPPING_CANADAPOST_USERID) . '&frmCPIDSignIn:j_password=' . urlencode(MODULE_SHIPPING_CANADAPOST_PASSWORD); $response = cp_post_page($ch, SSO.'/cpid/apps/signIn?execution=e1s1', $query_string); // login post vars $query_string = 'SHOP=CPFRCOMM&SSO_ITS_URL=%2Fcpid%2login%2FsignIn%3F&SSO_ACTION=0&P_SHOP=CPFRCOMM' . '&login_type=2&password_length=0&language=EN&APP_ID=B2B' . '&SSO_USERID=' . urlencode(MODULE_SHIPPING_CANADAPOST_USERID) . '&SSO_PASSWORD=' . urlencode(MODULE_SHIPPING_CANADAPOST_PASSWORD); $response = cp_post_page($ch, LOGIN, $query_string); curl_close($ch); // Canada Post customer number $regexp = "SSO_CUSTOMER_NUMBER\" value=\"([0123456789]*)(,|\")"; $matches = ''; preg_match("/$regexp/siU", $response, $matches); if (!tep_session_is_registered('cp_customer')) { tep_session_register('cp_customer'); } $cp_customer = $matches[1]; // progress update if (strstr($response, '<input type=hidden name="SSO_VERSION_MAJOR" value="3">') === FALSE) { do_cp_error($step, SC_GENERAL_ERROR); } else { cp_progress($step, LOGGEDIN); } break;
  7. natrium42

    Canada Post Automatic Labels

    Looks like Canada Post modified the login process slightly. The following change in admin/ship_canadapost.php is required. Change the following code: //// // 2. LOG IN $response = cp_get_page($ch, 'https://sso-cal.canadapost-postescanada.ca/sso/login.jsp?~language=EN&APP_ID=B2B&SSO_REFERRER_URL=https://obc.canadapost.ca/zcpb2b/b2b/init.do?language=EN&shop=CPENCOMM&sblid=sbobclogin'); $query_string = 'SHOP=CPFRCOMM&SSO_ITS_URL=%2Fsso%2Flogin.jsp&SSO_ACTION=0&P_SHOP=CPFRCOMM' . '&login_type=2&password_length=0&%7Elanguage=EN&APP_ID=B2B' . '&SSO_USERID=' . urlencode($cp_user) . '&SSO_PASSWORD=' . urlencode($cp_password); $response = cp_post_page($ch, 'https://sso-cal.canadapost-postescanada.ca/sso/login/redirect', $query_string); // get Canada Post customer number $regexp = "SSO_CUSTOMER_NUMBER\" value=\"([0123456789]*)(,|\")"; $matches = ''; preg_match("/$regexp/siU", $response, $matches); $cp_customer = $matches[1]; $response = cp_submit_page($ch, $response, 'https://sso-cal.canadapost-postescanada.ca'); // Sanity Check and Progress Report if (strstr($response, '<input type=hidden name="SSO_VERSION_MAJOR" value="3">') === FALSE) { cp_error(2, 'Failed check in ' . __FILE__ . ' at line ' . __LINE__ . '. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.'); curl_close($ch); die(); ///////////////////// } else { cp_progress(2, 'Logged in.'); } to the new code: //// // 2. LOG IN $response = cp_get_page($ch, 'https://sso-cal.canadapost-postescanada.ca/cpid/apps/signIn?LOCALE=en&~language=EN&APP_ID=B2B&SSO_REFERRER_URL=https://obc.canadapost.ca/zcpb2b/b2b/init.do?language=EN&shop=CPENCOMM'); $query_string = 'frmCPIDSignIn:signIn.x=46&frmCPIDSignIn:signIn.y=11&frmCPIDSignIn_SUBMIT=1' . '&frmCPIDSignIn:j_username=' . urlencode($cp_user) . '&frmCPIDSignIn:j_password=' . urlencode($cp_password); $response = cp_post_page($ch, 'https://sso-cal.canadapost-postescanada.ca/cpid/apps/signIn?execution=e1s1', $query_string); $query_string = 'SHOP=CPFRCOMM&SSO_ITS_URL=%2Fcpid%2Flogin.jsp&SSO_ACTION=0&P_SHOP=CPFRCOMM' . '&login_type=2&password_length=0&%7Elanguage=EN&APP_ID=B2B' . '&SSO_USERID=' . urlencode($cp_user) . '&SSO_PASSWORD=' . urlencode($cp_password); $response = cp_post_page($ch, 'https://sso-cal.canadapost-postescanada.ca/cpid/login/redirect', $query_string); // get Canada Post customer number $regexp = "SSO_CUSTOMER_NUMBER\" value=\"([0123456789]*)(,|\")"; $matches = ''; preg_match("/$regexp/siU", $response, $matches); $cp_customer = $matches[1]; $response = cp_submit_page($ch, $response, 'https://sso-cal.canadapost-postescanada.ca'); // Sanity Check and Progress Report if (strstr($response, '<input type=hidden name="SSO_VERSION_MAJOR" value="3">') === FALSE) { cp_error(2, 'Failed check in ' . __FILE__ . ' at line ' . __LINE__ . '. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.'); curl_close($ch); die(); ///////////////////// } else { cp_progress(2, 'Logged in.'); } Everything should start working again.
  8. Yep, they changed the login page a little bit. I had to use my PayPal shipping module today to ship via Canada Post :/ Need to fix steps 1 & 2. Just a bit busy today with other things.
  9. natrium42

    Shipping Modules Confusion

    By "integration" I do not mean "following instructions of the mod", but business specific integration and adjustment to the unique requirements of a business. I was using Canada Post, UPS and FedEx without problems in my shop. A short while ago I switched UPS and FedEx to go through eShipper. After extensive modification I can ship electronically via one click -- even the printing of the shipping label is automatic. My products are quite small in size and there is never more than 1 package per order. The boxing algorithm is customized to work with this in mind. A bigger problem is making sure shipping works even when UPS and FedEx servers are unresponsive. One way would be to add a formula to estimate shipping. Another way would be to add some form of caching for the returned rates.
  10. natrium42

    Shipping Modules Confusion

    You should just hire a specialist to do the integration for you. Every shop has it's own requirements, that's why all but the simplest contributions are meant to be adjusted.
  11. Sure, just use the original contribution (which is still maintained): http://addons.oscommerce.com/info/5445 Unfortunately the author of the "2.0" contribution decided to bind two different contributions (Canada Post Shipping & Canada Post Automated Labels) into one single mod, splitting the development and resulting in an unmaintainable mess. It would be much more logical to keep them separate and developing at their individual paces.
  12. I don't think eShipper offers FedEx Ground. Use UPS Standard instead...
  13. natrium42

    Zone rates - only want to it to show over 7KGs

    I have applied & tested the modification I talked above for you, since you do not seem to be able to. Here is the whole listing: <?php class airmailsigned { var $code, $title, $description, $enabled, $num_zones; // class constructor function airmailsigned() { global $order, $shipping_weight; $this->code = 'airmailsigned'; $this->title = MODULE_SHIPPING_AIRMAILSIGNED_TEXT_TITLE; $this->description = MODULE_SHIPPING_AIRMAILSIGNED_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_AIRMAILSIGNED_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'shipping_airmail.gif'; // upload icon to catalog/images/icon directory $this->tax_class = MODULE_SHIPPING_AIRMAILSIGNED_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_AIRMAILSIGNED_STATUS == 'True') ? true : false); // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED $this->num_zones = 2; } // class methods function quote($method = '') { global $order, $shipping_weight, $shipping_num_boxes; $dest_country = $order->delivery['country']['iso_code_2']; $dest_zone = 0; $error = false; for ($i=1; $i<=$this->num_zones; $i++) { $countries_table = constant('MODULE_SHIPPING_AIRMAILSIGNED_COUNTRIES_' . $i); $country_zones = split("[,]", $countries_table); if (in_array($dest_country, $country_zones)) { $dest_zone = $i; break; } } // BOF: Mod if ($dest_country == 'GB') { return null; } if ($shipping_weight > 2) { return null; } // EOF: Mod // elari - Added to select default country if not in listing if ($dest_zone == 0) { $dest_zone = $this->num_zones; // the zone is the lastest zone avalaible } // elari - Added to select default country if not in listing if ($dest_zone == 0) { $error = true; // this can no more achieve since by default the value is set to the max number of zones } else { $shipping = -1; $zones_cost = constant('MODULE_SHIPPING_AIRMAILSIGNED_COST_' . $dest_zone); $zones_table = split("[:,]" , $zones_cost); $size = sizeof($zones_table); for ($i=0; $i<$size; $i+=2) { if ($shipping_weight <= $zones_table[$i]) { $shipping = $zones_table[$i+1]; if(tep_not_null($method) ) // Text shown on Checkout_Confirmation $shipping_method = ''; // Leaving this entry blank causes only the shipping title to show i.e Royal Mail 1st Class Rec else // Text shown on Checkout_shipping - Delivery Weight : 0.7 Kg's (Ships normally within 1 to 3 days) $shipping_method = MODULE_SHIPPING_AIRMAILSIGNED_TEXT_WAY . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_AIRMAILSIGNED_TEXT_UNITS . ' ' . MODULE_SHIPPING_AIRMAILSIGNED_DELIVERY_TIMES; if ($shipping_num_boxes > 1) { $shipping_method .= $shipping_num_boxes . 'x '; } break; } } if ($shipping == -1) { $shipping_cost = 0; $shipping_method = MODULE_SHIPPING_AIRMAILSIGNED_UNDEFINED_RATE; } else { $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_AIRMAILSIGNED_HANDLING_' . $dest_zone); } } // I want to add VAT to European purchases // If I add 1.175* at the start of line 183, then it works and adds 17.5%, but to ALL Zones // How do I make it only apply to Zone 1 below - viz. ($i == 2) // The following doesn't work either, but just leaving line 190 works as before - to ALL zones // if ($i == 2) { // $shipping_cost = $shipping_cost*1.175; // } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_AIRMAILSIGNED_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => $shipping_cost))); 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); if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_AIRMAILSIGNED_INVALID_ZONE; return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_AIRMAILSIGNED_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } // elari - Added to select default country if not in listing 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 Zones Method', 'MODULE_SHIPPING_AIRMAILSIGNED_STATUS', 'True', 'Do you want to offer zone rate 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, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_AIRMAILSIGNED_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, date_added) values ('Sort Order', 'MODULE_SHIPPING_AIRMAILSIGNED_SORT_ORDER', '10', 'Sort order of display.', '6', '0', now())"); for ($i = 1; $i <= $this->num_zones; $i++) { $default_countries = ''; if ($i == 1) { $default_countries = 'AL,AD,AM,AT,AZ,BY,BE,BA,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GI,GR,GL,HU,IS,IE,I T,KZ,KG,LV,LI,LT,LU,MK,MT,MD,MC,NL,NO,PL,PT,RO,RU,SM,SK,SI,ES,SE,CH,TJ,TR,T M,UA,U Z,VA'; //Airmail Rates for Europe at April 2007: Small packets to 2KG and printed Papers to 10KG (2 packets) $shipping_table = '.1:1.24,.12:1.36,.14:1.50,.16:1.63,.18:1.77,.2:1.90,.22:2.03,.24:2.15,.26:2. 28,.28:2.39,.3:2.51,.4:3.06,.5:3.61,.6:4.11,.7:4.61,.8:5.11,.9:5.61,1:6.11,1.1:6. 61,1.2:7.11,1.3:7.61,1.4:8.11,1.5:8.61,1.6:9.11,1.7:9.61,1.8:10.11,1.9:10.61,2:11 .11,40:199'; } if ($i == 2) { $default_countries = 'All Others'; // this must be the lastest zone // Airmail Rates for Rest of World at April 2007: Small packets to 2KG and printed Papers to 10KG (2 packets) $shipping_table = '.1:1.64,.12:1.87,.14:2.10,.16:2.33,.18:2.56,.2:2.80,.22:3.01,.24:3.22,.26:3. 43,.3:3.87,.4:4.97,.5:6.07,.6:7.07,.7:8.07,.8:9.07,.9:10.07,1:11.07,1.1:12.07,1.2 :13.07,1.3:14.07,1.4:15.07,1.5:16.07,1.6:17.07,1.7:18.07,1.8:19.07,1.9:20.07,2:21 .07,40:199'; } tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_AIRMAILSIGNED_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_AIRMAILSIGNED_COST_" . $i ."', '" . $shipping_table . "', 'Shipping rates to Zone " . $i . " destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone " . $i . " destinations.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Handling Fee', 'MODULE_SHIPPING_AIRMAILSIGNED_HANDLING_" . $i ."', '3.50', 'If you want to add extra costs to customers for jiffy bags etc, the cost can be entered below (eg enter 1.50 for a value of £1.50)', '6', '0', now())"); // tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Handling Fee', 'MODULE_SHIPPING_AIRMAIL_TAX_CLASS" . $i ."', '0', 'TEST TEST for TAX the cost can be entered below (eg enter 1.50 for a value of £1.50)', '6', '0', now())"); STILL MY ATTEMPT TO INCUDE VAT ON POSTAGE } } // elari - Added to select default country if not in listing function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { $keys = array('MODULE_SHIPPING_AIRMAILSIGNED_STATUS', 'MODULE_SHIPPING_AIRMAILSIGNED_TAX_CLASS', 'MODULE_SHIPPING_AIRMAILSIGNED_SORT_ORDER'); for ($i=1; $i<=$this->num_zones; $i++) { $keys[] = 'MODULE_SHIPPING_AIRMAILSIGNED_COUNTRIES_' . $i; $keys[] = 'MODULE_SHIPPING_AIRMAILSIGNED_COST_' . $i; $keys[] = 'MODULE_SHIPPING_AIRMAILSIGNED_HANDLING_' . $i; // $keys[] = 'MODULE_SHIPPING_AIRMAIL_TAX_CLASS' . $i; STILL MY ATTEMPT TO INCUDE VAT ON POSTAGE } return $keys; } } ?>
  14. natrium42

    Zone rates - only want to it to show over 7KGs

    global $order, global $cart; Should be global $order, $cart; See what I said about baby sitting? :P
  15. natrium42

    Zone rates - only want to it to show over 7KGs

    That means $cart is not available. Did you put "global $cart;" at the top of the function where you are doing this?
  16. natrium42

    Weight and price limit on airmail

    It's not about knowing PHP. A solution was posted in your previous thread, no reason to start yet another thread (it's quite rude, actually). You have been helped there. It just seems that you want somebody to babysit you giving you exact instructions line by line. I think you should at least try to concentrate for once -- PHP skills are not the point. Nobody knows PHP. We just have enough concentration to read the manual. Previous thread: http://forums.oscommerce.com/index.php?showtopic=328529
  17. natrium42

    Weight and price limit on airmail

    Yes, of course. People who can read the PHP manual mostly.
  18. natrium42

    Zone rates - only want to it to show over 7KGs

    That's because your code is plain wrong. 1. $shipping_weight is not fetched anywhere in your constructor, so the variable is empty -- something a simple echo statement would have verified. 2. Setting $this->enabled to false in quote() has no effect, since the shipping module system only checks that after the constructor. I think you could use "return null;" or "return array();" instead.
  19. natrium42

    Zone rates - only want to it to show over 7KGs

    Context means just relevant lines, not the whole thing :P The problem is a missing closing brace '}' like so: if ($shipping_weight > 2) { $this->enabled = false; }
  20. natrium42

    Zone rates - only want to it to show over 7KGs

    You need to remove the shipping module before changing the number of zones inside the file. Otherwise it won't create the proper database entries.
  21. natrium42

    Canada Post - Shipping delay option?

    This would require some modifications. You would need to add a turnaround field to the products table. Then modify your Canada Post shipping module to look at that field for each product and select the maximum.
  22. natrium42

    Force Courier Shipping Option

    I would add a field to the products table signifying whether a product is "Courier Only". Then you can check for the value of that field in your shipping module.
  23. natrium42

    Those using the FedEx freight module 0.9

    This topic (and searching the forum in the future) might help: http://forums.oscommerce.com/index.php?showtopic=325307
  24. natrium42

    Looking for Total Price Based Shipping Module

    Haha, seriously :D
×