Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2008
    Location
    Victoria AU
    Posts
    48
    Plugin Contributions
    0

    Default New Shipping Module with Multiple Methods showing as bold (best?)

    I'm developing a shipping module that calls make a JSON call to a common service we use internally that generates shipping estimates based on a cart (think Model, Qty and Postcode) and it returns Service Options and Price based on weights and postcode, number of parcels etc.

    Everything is working very well, and I was able to make a fairly simple change to the "Flat" rate calculator to get rates coming back through to ZC.

    However the returned methods are all showing as bolded, and I'd have thought only the cheapest would have been. Am I missing something simple here, as far as I could see the USPS calculator returns multiple rates so I'm hoping returning multiple services from a shipping module is supported.

    Attached pic shows how the results are displaying. I'm using a vanilla install of 155e with this as the only additional module.

    Name:  Capture.PNG
Views: 134
Size:  10.1 KB

    Code:
          $ShippingResult = json_decode($response,true);
          $methods = Array();
          
          foreach ($ShippingResult['options'] as $key => $value) {
             $Service = $ShippingResult['options'][$key]['service'];
             $Price = Round($ShippingResult['options'][$key]['price'],2);
    
             $methods[] = array('id' => $this->code,
                                'title' => $Service,
                                'cost' => $Price);
          }
                                
          if (sizeof($methods) == 0) { return false; }
    
          $this->quotes = array('id' => $this->code,
                                'module' => MODULE_SHIPPING_JSONSERVICE_TEXT_TITLE,
                                'methods' => $methods);
    Last edited by kanine; 27 Oct 2017 at 04:24 AM. Reason: code fragment

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,693
    Plugin Contributions
    9

    Default Re: New Shipping Module with Multiple Methods showing as bold (best?)

    checkout:

    includes/templates/YOUR_TEMPLATE/templates/tpl_modules_shipping_estimator.php

    the selected quote is the one coming up as bold....

    you could probably code it to be the cheapest....

    good luck!
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Mar 2008
    Location
    Victoria AU
    Posts
    48
    Plugin Contributions
    0

    Default Re: New Shipping Module with Multiple Methods showing as bold (best?)

    Thanks for the tip, will take a look and post back if I 'fix' it.

  4. #4
    Join Date
    Mar 2008
    Location
    Victoria AU
    Posts
    48
    Plugin Contributions
    0

    Default Re: New Shipping Module with Multiple Methods showing as bold (best?)

    Found the issue, was returning a non-unique 'id' as part of the multi-method shipping quote. Looking at the estimator template certainly helped in tracking it down, so the working code looks like this now...

    Code:
             $methods[] = array('id' => str_replace(' ','_',strtolower($Service)),
                                'title' => $Service,
                                'cost' => $Price);

 

 

Similar Threads

  1. v150 New sidebar category not showing up bold
    By Scully in forum Templates, Stylesheets, Page Layout
    Replies: 35
    Last Post: 10 Jan 2013, 04:43 AM
  2. Best Shipping module / Multiple cities in same province
    By jinnxx73 in forum Addon Shipping Modules
    Replies: 3
    Last Post: 1 Oct 2010, 06:38 PM
  3. Multiple shipping methods/costs with big range of item sizes
    By terrykiwi in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 2 May 2008, 02:39 PM
  4. multiple shipping methods
    By kishore_peri in forum Addon Shipping Modules
    Replies: 2
    Last Post: 3 Apr 2008, 09:22 PM
  5. multiple shipping methods
    By magichat in forum General Questions
    Replies: 1
    Last Post: 19 Sep 2006, 08:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR