Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2016
    Location
    Oakville, Ontario, Canada
    Posts
    5
    Plugin Contributions
    0

    application error Help in Writing a Shipping Module

    I have been tasked with writing a new shipping module for a client.

    Functionally, it shouldn't be to difficult. I need to take the shopping cart info (weights), call an existing web service to retrieve the shipping cost, and display it to the user. After the order it accepted I will need to call another service to actually post the shipment information.

    It should be know that I come from the Visual Studio/C#/ASP.NET world.
    The PHP stuff all looks familiar, not to worried about that. However, I am having a couple problems.
    First I cannot find ANY API information on how to write a plugin. The Wiki page stuff is pretty much useless. It also would be nice to get a list of available session variables, particularly the 'cart' object so I know what have to work with. Guessing property names just doesn't work

    I have taken a copy of an existing shipping module (zones.php), and have managed to install and run it. However, how would one go about debugging such a creature? I am using Visual Studio Code as an editor. It seems that any code changes that I make are not reflected in the runtime in ZenCart. Currently I am stuck.

    Looking for any help or advice on how I can move forward,

    Thanks,
    Bryan

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

    Default Re: Help in Writing a Shipping Module

    b,
    so you have gone to admin -> modules -> shipping and selected your shipping module and it is now successfully installed with a little green circle next to it?

    with regards to debugging, i'm sure everyone has their own way/process of doing things. for a development environment in php, i like the following tool:

    http://dbug.ospinto.com/

    one file and you can place it in /includes/extra_configures/ directory and then it will autoload.

    within your new module, you can then add the following code:

    Code:
    new dBug();
    die(__FILE__ . ':' . __LINE__);
    within the dBug you can add any object that you are interested in seeing, ie $_SESSION. the die statement will also ensure that your code is getting hit.... as will the dBug.

    hope that helps.

    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
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Help in Writing a Shipping Module

    There's also a plugin available called superglobals that allows display of session related information and others as made available through the admin.

    Each of the shipping modules has a particular focus and thus the associated functions that are to return information may be different. Typically in developing a shipping module, it would be suggested as you have started to use an existing method at least to understand some of what is expected, but also to identify in the code where it is/could be accessed. Identifying those touch points helps to determine what data needs to be available.

    Depending on the options you are expecting to handle might suggest also looking at more advanced shipping modules like usps, ups or FedEx as these provide multiple rates from which a visitor can select within a single shipping module.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Dec 2016
    Location
    Oakville, Ontario, Canada
    Posts
    5
    Plugin Contributions
    0

    Default Re: Help in Writing a Shipping Module

    Quote Originally Posted by carlwhat View Post
    b,
    so you have gone to admin -> modules -> shipping and selected your shipping module and it is now successfully installed with a little green circle next to it?

    with regards to debugging, i'm sure everyone has their own way/process of doing things. for a development environment in php, i like the following tool:

    http://dbug.ospinto.com/

    one file and you can place it in /includes/extra_configures/ directory and then it will autoload.

    within your new module, you can then add the following code:

    Code:
    new dBug();
    die(__FILE__ . ':' . __LINE__);
    within the dBug you can add any object that you are interested in seeing, ie $_SESSION. the die statement will also ensure that your code is getting hit.... as will the dBug.

    hope that helps.

    good luck!
    Thanks for the input so far. I have been making slow progress. My last hurdle was calling our .NET web service to retrieve shipping rates using the SoapClient. Finally, I go that working.

    Yes, I am trying to model it after the FedEx module since it seems to have many of the features I am looking for.

    Bryan

 

 

Similar Threads

  1. writing a shipping module
    By tiny in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 27 May 2009, 07:34 PM
  2. No Shipping Estimate Quote -- writing my own shipping module
    By Relentless in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 20 Sep 2008, 04:11 AM
  3. Writing a new payment module - wiki no help
    By s_mack in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 16 Sep 2007, 08:04 PM
  4. Need help with writing module
    By MxG in forum Addon Payment Modules
    Replies: 0
    Last Post: 18 Dec 2006, 10:20 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