{"id":772,"date":"2010-02-23T00:51:30","date_gmt":"2010-02-22T16:51:30","guid":{"rendered":"http:\/\/blog.lolyco.com\/sean\/?p=772"},"modified":"2010-02-23T12:55:48","modified_gmt":"2010-02-23T04:55:48","slug":"pos-malaysia-shipping-quotes-for-e-commerce","status":"publish","type":"post","link":"https:\/\/blog.lolyco.com\/sean\/2010\/02\/23\/pos-malaysia-shipping-quotes-for-e-commerce\/","title":{"rendered":"Pos Malaysia shipping quotes for e-commerce"},"content":{"rendered":"<div id=\"attachment_773\" style=\"width: 184px\" class=\"wp-caption alignright\"><a href=\"http:\/\/www.pos.com.my\/\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-773\" class=\"size-full wp-image-773\" title=\"Pos Malaysia\" src=\"http:\/\/blog.lolyco.com\/sean\/wp-content\/uploads\/2010\/02\/posmalaysia.jpeg\" alt=\"Pos Malaysia\" width=\"174\" height=\"55\" \/><\/a><p id=\"caption-attachment-773\" class=\"wp-caption-text\">Pos Malaysia<\/p><\/div>\n<p>I maintain some <a href=\"http:\/\/lolyco.com\/contributions\/#shipping\">Malaysian shipping modules<\/a> for the <a href=\"http:\/\/www.oscommerce.com\/\">popular e-commerce software osCommerce<\/a> which allow local e-shops to include up-to-date automatic shipping quotes from <a href=\"http:\/\/www.pos.com.my\/\">Pos Malaysia<\/a> (Pos Laju and Pos Air Parcel) in the order total. If you run an e-shop, being able to pass on accurate shipping costs to your customers &#8211; compared with &#8216;free&#8217; or fixed-price shipping &#8211; means you can give your customers better prices than your competitors. If you can offer your customer a choice of shipping options, this also allows them to save money or expedite their delivery. Doing all of this automatically means you don&#8217;t have to attend to your online business &#8211; it completes orders and collects money for you, and tells you when to pack deliveries!<\/p>\n<p>Pos Malaysia have a <a href=\"http:\/\/www.pos.com.my\/V1\/main2.asp?c=\/v1\/PostageRates\/PostageMain.htm\">shipping quotation service<\/a> at their website. It&#8217;s obviously intended for human visitors, as it also has advertising, branding and links to other services on it. I use this web page in my osCommerce module. In order to give an automatic, up-to-date quote, an osCommerce shop using my modules must send a request to Pos Malaysia&#8217;s website, read the entire page, and use pattern matching to extract the shipping price.<\/p>\n<p>The current technique is very wasteful of resources, the page that must be searched for the shipping price is 13 to 15KB &#8211; for just a few characters! The technique is also horrendously sensitive. If Pos Malaysia change the appearance of the page, the pattern-matching technique can&#8217;t work and the shipping module fails to return a quote, which will usually mean that the osCommerce e-shop won&#8217;t be able to complete the order. The Internet being the &#8216;instant&#8217; experience that it is, the sales opportunity is probably lost.<\/p>\n<p>One further annoyance is that the shipping module requesting one or two (for different shipping methods) quotes from Pos Malaysia&#8217;s website introduces a considerable delay in the user&#8217;s experience of the e-shop. When a customer goes to the checkout page on which the shipping cost appears, the server starts to build the page, sends a request to Pos Malaysia&#8217;s website, waits for Pos Malaysia&#8217;s webserver to build its response, reads the (large) response, performs pattern matching on it (repeating the last 4 steps for each additional shipping method) and finally sends the page to your customer&#8217;s browser. Several-second delays are not uncommon.<\/p>\n<div id=\"attachment_774\" style=\"width: 210px\" class=\"wp-caption alignright\"><a href=\"http:\/\/blog.lolyco.com\/sean\/wp-content\/uploads\/2010\/02\/pos.com_.my_chromium_timings.jpeg\"><img decoding=\"async\" aria-describedby=\"caption-attachment-774\" class=\"size-full wp-image-774 \" title=\"Pos Malaysia quotation page timings\" src=\"http:\/\/blog.lolyco.com\/sean\/wp-content\/uploads\/2010\/02\/pos.com_.my_chromium_timings.jpeg\" alt=\"Pos Malaysia quotation page timings\" width=\"200\" \/><\/a><p id=\"caption-attachment-774\" class=\"wp-caption-text\">Pos Malaysia quotation page timings<\/p><\/div>\n<p>Take a look at these two resource timing graphs from the Chromium browser. If you haven&#8217;t used Chromium yet, and you&#8217;re a developer, there are some great tools in there &#8211; and it&#8217;s shaping up to be a very competent browser too. The first image is from Pos Malaysia&#8217;s website, a shipping quote for a parcel (surface and air quotes on the same page). The blue bar is for the page itself &#8211; the other bars are for resources the page needs to be rendered. We only need the page, as we&#8217;re not interested in images, stylesheets and scripts, only in the text of the shipping amounts. There&#8217;s a redirect (a <a href=\"http:\/\/wossis.com\/flashcard\/35e68\/http-status-codes\/35f0f.html\">302 Found<\/a>) which further slows things down, and then a 104ms wait (perhaps the page is being built by Pos&#8217;s server?) and then nearly a quarter of a second while the ~14KB of the page text is transferred.<\/p>\n<div id=\"attachment_775\" style=\"width: 210px\" class=\"wp-caption alignright\"><a href=\"http:\/\/blog.lolyco.com\/sean\/wp-content\/uploads\/2010\/02\/spider.my_chromium_timings.jpeg\"><img decoding=\"async\" aria-describedby=\"caption-attachment-775\" class=\"size-full wp-image-775 \" title=\"AJAX load time from spider.my's currency conversion page\" src=\"http:\/\/blog.lolyco.com\/sean\/wp-content\/uploads\/2010\/02\/spider.my_chromium_timings.jpeg\" alt=\"AJAX load time from spider.my's currency conversion page\" width=\"200\" \/><\/a><p id=\"caption-attachment-775\" class=\"wp-caption-text\">AJAX load time from spider.my&#39;s currency conversion page<\/p><\/div>\n<p>Compare that with this image, which shows the resources being loaded from spider.my&#8217;s currency conversion page. The line to note is that for the AJAX update of the exchange rate. The latency is horrible, as spider.my is hosted in the USA, but the time to load the AJAX update is only 1ms &#8211; hundreds of times faster than Pos&#8217; shipping quote page. That&#8217;s understandable because the reply from spider.my is only about 100bytes long!<\/p>\n<p>What I think Pos Malaysia should do is to provide an API to Malaysian e-business so that their postal services can be more efficiently and reliably built into local business systems. I think they should offer 2 APIs &#8211; one a simple AJAX responder for use on blog pages and low-volume shops, and the other a shipping rates updater for larger-volume businesses. The simple responder would take the place of the current osCommerce modules and should be able to easily serve thousands of shipping quote requests per second on any old PC that Pos has lying around. I envisage some heavy client-side caching for the high-volume API, so apart from days on which Pos update their rates, the server should see very little traffic at all for a more complex solution suitable for large businesses.<\/p>\n<p>It was obvious to me when I first wrote the shipping modules a few years ago that they were inefficient and fragile, so I emailed and wrote to Pos Malaysia, even met their regional management to try to get someone to improve their end of the shipping quote system. A few years have passed and nothing has happened, so I&#8217;m going to write it myself and try to get someone from Pos to have a look at it and hopefully host it themselves. It&#8217;s not difficult and it&#8217;ll make a nice test of Spinneret. After all, when I finally get round to making Spinneret available, it will be FOSS buatan Malaysia!<\/p>\n<p>If Pos wants the system, I&#8217;d be quite happy to do all the necessary work to integrate it into Pos Malaysia&#8217;s current IT systems FOR FREE. I don&#8217;t want to maintain the osCommerce modules in their current condition any more, and I think Pos exposing a decent API to local e-businesses would make a big difference to the ability of Malaysian businesses to compete online. That would make my life easier, and hopefully earn me a few free cups of tea at the kopitiam.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I maintain some Malaysian shipping modules for the popular e-commerce software osCommerce which allow local e-shops to include up-to-date automatic shipping quotes from Pos Malaysia (Pos Laju and Pos Air Parcel) in the order total. If you run an e-shop, being able to pass on accurate shipping costs to your customers &#8211; compared with &#8216;free&#8217; [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,40,60,51,3],"tags":[107,21,34,8,105,57],"class_list":["post-772","post","type-post","status-publish","format-standard","hentry","category-broken","category-life","category-money","category-philosophy","category-software","tag-broken","tag-e-commerce","tag-network","tag-oscommerce","tag-software","tag-web"],"_links":{"self":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/comments?post=772"}],"version-history":[{"count":4,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/772\/revisions"}],"predecessor-version":[{"id":778,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/772\/revisions\/778"}],"wp:attachment":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/media?parent=772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/categories?post=772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/tags?post=772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}