Giter Club home page Giter Club logo

shippo-d7-contrib's Introduction

About this module

Shippo module for Drupal 7 provides real-time shipping cost estimates for various shipemnt carriers e.g. UPS, USPS, DHL Express, Canada Post, FedEx, etc. and shipping label creation along with tracking information functionality. Version: 1.0 Drupal core version: 7.x

How do I get set up?

  1. Pre-requisites
  1. Setup
  • Download and enable all the modular dependencies mentioned below.
  • Download the 'shippo-php-client' library to your drupal site's 'libraries' directory. This library is available on github (https://github.com/goshippo/shippo-php-client).
  • Download and enable the module from d.o (https://www.drupal.org/project/shippo).
  • Easiest of all, if you have drush running, do 'drush pm-enable shippo' to download and enable all dependencies and then the module. Remember that you will still have to download the 'shippo-php-client' manually.
  1. Configuration

  2. Shippo module configuration form has been provided at 'Store > Configuration > Shipping > Shipping Methods > Shippo' in your drupal admin panel. Under the ENABLE SHIPPO SHIPPING SERVICES section, enable the desired services of only those carriers which have been activated by you on your Shippo dashboard as mentioned above in Pre-requisites section.

  3. You can find the enabled shipping services at 'Store > Configuration > Shipping > Shipping Services > Shippo' in your drupal admin panel. You can associate rules to individual services using 'configure component' option in front of it.

  4. You will need to add two fields of type - Physical dimensions and Physical weight each to the product type(s) of the products you intend to ship.

  • Note: Shippo configuration form will be accessible to only the user roles with 'administer shipping' permission enabled.
  1. Dependencies
  1. Database configuration
  • No initial database configuration needed.
  1. How to run tests
  • This is a simple test case to demonstrate the shipping cost estimation and shipment label creation for an order involving purchase of a single product.
  • Create a commerce product with necessary fields filled in including Physical dimensions as well as Physical weight fields.
  • Make a custom view to show the list of all the enabled products with an Add to Cart link. Visit the view page.
  • Add the product to cart. Visit the cart page and proceed to checkout.
  • Enter a valid shipping address under Shipping Information section. Continue checkout. If you enter an invalid/unserviceable shipping address, you should get an error message and won't be able to proceed.
  • On the next page, i.e. 'shipping' page, select an appropriate shipping service from among the available ones. The shipping rate estimates fetched from Shippo are shown against the service. Proceed to review/payments page.
  • Complete the checkout. This module will purchase the shipping rate for the order in the background.
  • Currently, post-purchase shipment info has been exposed programatically through the following functions:
    • shippo_retrieve_shipment_master_parcel_info(...)
    • shippo_retrieve_shipment_slave_parcel_info(...)

Utilizing these functions would require a little custom modular development. We hope to better expose this information in drupal's admin UI panel in future or as per the feature requests that come along on this module's issue queue.

  1. Limitations
  • Similar to that of Commerce UPS module.
  • Single "Ship from" address for all products.
  • Doesn't ensure product dimensions are less than default package size dimensions. In other words, if you have a product that is 1x1x20 (volume=20) and your default package size is 5x5x5 (volume=125), even though the product won't physically fit in the box, these values will be used to calculate the shipping estimate.
  • Doesn't play Tetris. For example, if you have an order with 14 products with a combined volume of 50 and your default package size has a volume of 60, the shipping estimate will be for a single box regardless of if due to the packaging shape they don't actually fit in the box.
  • Doesn't limit the weight of packages. If you're trying to ship a box full of lead that weighs 600lbs, this module will let you (instead of breaking the order into more packages).
  • Doesn't account for packing material. If you need to account for packing material, then you may want to adjust product dimensions accordingly.
  1. Methodology

Calculating estimated shipping costs is a tricky business, and it can get really complicated really quickly. Knowing this, we purposely designed this module with simplicity in mind. Here's how it works:

  • Similar to that of Commerce UPS module.
  • Every order must contain at least one package.
  • The number of packages is determined by calculating the total volume of all products in the order, dividing by the volume of the default package size, and rounding up.
  • The weight of each package is determined by dividing the total weight of all products in the order by the number of packages.

If you need custom functionality, you have several options:

  • Determine if it is something that can be generalized to suit a number of users and submit it via the issue queue as a suggestion for inclusion in this module.
  • Hire one of the maintainers to create a custom module that interfaces with Commerce UPS to add your custom functionality.
  • Break open a text editor and start coding your own custom module.

Contribution guidelines

  • Writing tests

It would be great if you can contribute test cases for this module. Need help writing test cases? Visit https://www.drupal.org/docs/7/testing/unit-testing-with-simpletest

  • Code review

This module's code has been through a basic review by the Coder module - another great module btw. On top of that, this code has been thoroughly assessed by a few experienced minds - my mentors at QED42 Engg. Pvt. Ltd. - ofcourse the one's who eagerly helped me out throughout the module's development.

Authors/Maintainers/Contributors

shippo-d7-contrib's People

Contributors

prashantsinghalqed avatar

Watchers

Prashant Singhal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.