Page 1 of 4 123 ... LastLast
Results 1 to 10 of 34
  1. #1
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default How to get custom shipping module costs through to checkout?

    The wiki seems to be vacant on this issue from what I can find, but if there is a guide... please provide a link.

    I'm trying to make a custom shipping module. I started with various built in one but couldn't figure out how to get multiple shipping options. Then I emulated some of the add-on modules that have that (DHL, UPS) and managed to get multiple options to show... but choosing an option and clicking continue results in a shipping cost of zero, even though they were displayed correctly in the shipping page.

    What's the trick?

    Here's an example quote function.

    Code:
            function quote($method = '') {
                global $order, $shipping_weight, $shipping_num_boxes, $total_weight, $boxcount, $handling_cp, $cart;
                 
                $methods = array();
                for ($x = 0; $x <= 10; $x++) {
                  $methods[] = array('id' => 'ID' . $x,
                         'title' => 'Title' . $x,
                         'cost' => $x,
                         'insurance' => $x*.1,
                        );
                }
                    $this->quotes = array('id' => $this->code,
                        'module' => MODULE_SHIPPING_SFC_TEXT_TITLE,
                        'methods' => $methods);
                    if ($this->tax_class > 0) {
                        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
                    }
    
                return $this->quotes;
            }
    It works and I'm shown 10 options priced $1 to $10... but choosing any shows zero next page.

    Thanks.

  2. #2
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: How to get custom module costs through to checkout?

    I see through var dumps that the info is handled correctly on the shipping page but the session variable that gets passed onto the payments screen always has the first element's information for "cost" and "title" (ID is correct). Can't for the life of me figure out why that is.

  3. #3
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: How to get custom module costs through to checkout?

    I'm so confused. When I look at ANY shipping module, they all start with:
    Code:
      function quote($method = '') {
    Yet none of them actually make use of a variable "$method"???

    Weirdness. Is ZC 1.5.4 not capable of dealing with multi-method quotes from a provider?? I tried testing UPS and USPS but in both cases I instantly get a "contact your store" error instead of any results. I can't figure out what's going on.

    Again, $methods "ID" is being passed on, but title and cost are both as if option 1 was always selected.

    ANY help?

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: How to get custom module costs through to checkout?

    Is ZC 1.5.4 not capable of dealing with multi-method quotes from a provider
    For USPS are you using the latest version??
    https://www.zen-cart.com/downloads.php?do=file&id=1292

    You can go HERE put something in the cart and Estimate Shipping Costs
    You will see several USPS quotes

  5. #5
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: How to get custom module costs through to checkout?

    I actually meant DHL, not USPS. I can't use USPS as I'm not a US based store.

    But I'm not trying to use any existing module. I'm trying to create my own and attempting to emulate existing ones since there's no documentation at all for this task that I can find. My problem was described... how to get multiple products from a shipping module to continue through to steps 2+?

  6. #6
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: How to get custom module costs through to checkout?

    Seriously, what am I doing wrong? This is about as simple as it gets:

    Code:
            function quote($method = '') {
    //            global $order, $shipping_weight, $shipping_num_boxes, $total_weight, $boxcount, $handling_cp, $cart;
    
                $methods = array();
                $methods[] = array('id' => 'standard', 'title' => 'Standard', 'cost' => 2.32);
                $methods[] = array('id' => 'express', 'title' => 'Express', 'cost' => 18.00);
          $this->quotes = array('id' => $this->code,
                                'module' => $this->title);
              
                $this->quotes['methods'] = $methods;
    
                    if ($this->tax_class > 0) {
                        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
                    }
                return $this->quotes;
            }
    Judging by the other modules... that SHOULD work! But it doesn't. On shipping page I see "Standard" and "Basic" with their associated costs and if I select "Express" and click continue... the "Standard" rate is shown, even though the "Express" ID is clearly in $_SESSION['shipping']

  7. #7
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: How to get custom module costs through to checkout?

    This is based on the above discussion and limited use of the shipping options. Sounds like you have multiple methods, but when wantiing the quote for a single previously chosen method you want the related data to be returned..

    I think you hinted at it already, but I don't see anything that uses the $method variable within the quote...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: How to get custom module costs through to checkout?

    Did you create shipping and language files for your custom shipping module?

  9. #9
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: How to get custom module costs through to checkout?

    Quote Originally Posted by mc12345678 View Post
    This is based on the above discussion and limited use of the shipping options. Sounds like you have multiple methods, but when wantiing the quote for a single previously chosen method you want the related data to be returned..

    I think you hinted at it already, but I don't see anything that uses the $method variable within the quote...
    Neither do I... in any of the existing modules. I looked at the UPS and DHL modules, which surely return multiple options although I can't test because neither work for me, and neither make use of that variable. Seeing as there's no documentation (which is amazing in itself considering how old this software is), what can I do other than emulate other modules?

    *IF* your hint is suggesting that I'm supposed to return a single value when that variable is used... where's the comments or docs that makes that clear and what that variable even is or what exactly is to be returned? Leaving the user to 12 hours of guess-and-check kinda stinks.

    PLEASE tell me I just missed some info somewhere. I did finally figure it out last night on my own... I come here this morning and still nobody's actually provided an answer. Your hint only means anything because I figured it out on my own. Had I not, I wouldn't have even caught what you were getting at.

  10. #10
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: How to get custom module costs through to checkout?

    Quote Originally Posted by s_mack
    I actually meant DHL, not USPS. I can't use USPS as I'm not a US based store
    Your question that I attempted to answer
    Quote Originally Posted by s_mack
    Is ZC 1.5.4 not capable of dealing with multi-method quotes from a provider?? I tried testing UPS and USPS but in both cases I instantly get a "contact your store" error instead of any results
    You have apparently solved your original issue for this yourself
    I might suggest that you be more complete in phrasing your questions in the future

 

 
Page 1 of 4 123 ... LastLast

Similar Threads

  1. how to change text for shipping costs in checkout
    By Pompidompie in forum General Questions
    Replies: 1
    Last Post: 2 Apr 2015, 02:22 AM
  2. v151 Shipping Module for different shipping methods/costs/countries/
    By ggiannetto in forum Addon Shipping Modules
    Replies: 0
    Last Post: 10 Nov 2013, 07:47 PM
  3. Replies: 4
    Last Post: 5 Dec 2010, 02:18 AM
  4. How do I get shipping costs into Google Checkout?
    By blackwolf in forum Addon Payment Modules
    Replies: 3
    Last Post: 17 Jun 2010, 02:19 PM
  5. How to get Shipping costs from DB
    By rgoetz in forum Managing Customers and Orders
    Replies: 13
    Last Post: 18 Aug 2006, 08:49 AM

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