[ic] Shipping in Interchange 6

Stefan Hornburg (Racke) racke at linuxia.de
Thu Jul 24 18:41:42 UTC 2014


Hello,

we revised our ideas with the handling of shipping methods and shipping prices in Interchange6.

Basically we will have the following classes:

* ShipmentCarrier

  UPS, DHL, ...

* ShipmentMethod

  Each carrier can have multiple shipment methods like

   Ground, NextDay, Europe Express, ...

* ShipmentRate

  Each method can have multiple shipment rates depending
  on shipment conditions (weight, subtotal, postal code range)

* ShipmentCondition

  The conditions are in a tree structure and a shipment rate belongs
  the root node of one these conditions.

  Examples:

  weight between 0 and 50 AND postal code between 10000 and 109999
  subtotal between 0 and 200
  pending order for this user

Based on this we implement two important methods.

The first one provides a list of available shipping methods and the second
one the shipping rate (price), depending on the following parameters:

subtotal, zip, state, country, weight (you can add more parameters if your
condition needs them).

You will certainly have a way to hook into these methods to change the
result of the calculation.

There are several ways to storing trees in a RDBMS, each with its own pros and cons:

Adjacency list
Nested set
Closure table (aka bridge table)
Materialized path (path enumeration)

Opinions on these are:

ribasushi prefers materialized path, he said it scales linearly and is easy to shuffle.
Peter Mottram pointed out that closure table looks interesting and means a drag and drop gui can be used to make changes.
Moritz Lenz said that has been happy with Nested Sets for read-heavy workloads.

We are going to evaluate these for shipping conditions, but your input is most welcome.

References:

https://metacpan.org/pod/DBIx::Class::MaterializedPath
http://bojanz.wordpress.com/2014/04/25/storing-hierarchical-data-materialized-path/
http://www.slideshare.net/billkarwin/models-for-hierarchical-data

Regards
	Racke

-- 
Perl and Dancer Development

Visit our Perl::Dancer conference 2014:

http://act.perl.dance/



More information about the interchange-users mailing list