Jump to content

Complex Shipping Rules


eskimo42

Recommended Posts

I am looking to develop a function for my client’s ecommerce solution. The set of ‘shipping rules’ is kind of complex, and I am perplexed at how exactly I should approach a solution. My client sells a study guide as a complete set, or she sells each 6 sections individually. In total there are 7 products which can be ordered. Let me first give an example of how shipping is determined:

 

 

Complete Set:

Continental USA:

-UPS Ground $12

-2nd Day Air: $20

Alaska, Hawaii, Puerto Rico, USVI:

-USPS Mail: $20.00

-Global Express: $28.50

 

International:

-Real-time Quotes from USPS

Section Orders:

 

Continental USA: 

1-2 Sections:

-USPS Priority Mail: $8

-3+ Sections

-USPS Priority Mail: $11

International, Alaska, Hawaii, Puerto Rico, USVI:

-1-2 Sections:

-Not Yet Determined

-3+ Sections

-Not Yet Determined

 

 

In the end I want a function where I could pass needed arguments, and then return a $ShippingPrice.

 

To do this in if/else and case statements seems completely illogical and I’m sure most we’ll agree. I was thinking to set a database up and query to get rates the schema might look something like this:

 

Table: Shipping Rates

Country  | State | Method | CompleteSetCost | SectionCost1-2 | SectionCost 3+

 

USA        | NY      | Ground | 12.00                  | 8.00                  | 11.00

USA        | NY      | 2nd Day| 20.00                  | Don't Do            | NULL?

 

Also, the client is unable/unwilling to change the method of determining shipping, so that's out of the question. I’m really not sure how to approach this, but any help would be much appreciated.

 

 

Thank You,

 

Evan

 

Link to comment
https://forums.phpfreaks.com/topic/52859-complex-shipping-rules/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.