Download the PHP package openbuildings/shipping without Composer
On this page you can find all versions of the php package openbuildings/shipping. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download openbuildings/shipping
More information about openbuildings/shipping
Files in openbuildings/shipping
Package shipping
Short Description Add complex shipping to openbuildings/purchases package
License BSD-3-Clause
Homepage https://github.com/OpenBuildings/shipping
Informations about the package shipping
Purchases Shipping
Usage
Purchase_items that you want to ship must implement Shippable, like this:
Also you need to add the shippable purchase to your purchase and brand purchase:
This behaviors will add the 'shipping' association to the brand_pruchase, also listen to update_items event and add a shipping purchase_item, and listen to the filter_items event, adding some more flags to filter by.
Once you have added the shipping data to your products:
You can start to select which shipping applies to each purchase item.
Having configured that, you can now call update_items()
method on the purchase / brand_purchase, adding to the purchase_items a shipping item.
Shipping Groups and Price Calculations
Each shipping group has several properties that affect how much muney the shipping of this item will cost:
- price - this is the base price for shipping of 1 item.
- additional_item_price - for more than one item, the second, third, etc items require this price, instead of the base one.
- discount_threshold - whenever the brand_purchase is more than this amount - free shipping
Here are some examples:
If an item costs 10, with additional_item_price of 6, then you will pay 10+6+6 for 3 of the same item.
Also items are grouped per shipping method, per "ships_from" location so 3 different item shipped by post will be grouped. Only the most expensive base price will be used, all others will use additional_item_price. So:
Item 1: price 10, additional_item_price 6, quantity: 3
Item 2: price 12, additional_item_price 8, quantity: 2
Total Price will be (12 + 8) + 6 * 3
When searching for a country, the most specific one will be used for calculation, so if you are shipping for France, and you have a shipping_group for Europe, and one for France, the second one will be used.
Advanced Item Splitting
If you want to allow people to use different methods for different products, here is how you might accomplish this:
First of all - finding all purchase_items that can / cannot ship to your country
If you want to be more precise, you can get available items, but grouped by available shipping methods, so that if you have purchase_items that can ship with both post and courier and other that can ship only with post, they will be in different groups:
Delivery Times
This shipping module comes with extensive support for calculating delivery times.
Model_Shipping_Group has "delivery_time" - min - max workdays to deliver the item. Model_Shipping has process_time - min - max workdays to 'build' the item. Both of these are Jam_Ranges, and combined represent the total_delivery_time for a specific location.
Model_Shipping has this interface:
The shippable purchase behavior also adds some methods to the Model_Brand_Purchase for handling delivery time calculations:
Shipping Address
By default as shipping address is used the billing address of the purchase. If you want to change that address, you'll have to change the shipping_same_as_billing
field and set the shipping_address association, which is the same Model_Address object. After that all the calculation will take the country of shiping_address instead of billing_address:
$purchase = Jam::find('purchase', 1);
$purchase->shipping_same_as_billing = FALSE;
$purchase->build('shipping_address', array(
'country' => Jam::find('country', 'United Kingdom'),
'line1' => 'Street 1',
// ...
));
## License
Copyright (c) 2012-2013, OpenBuildings Ltd. Developed by Ivan Kerin as part of [clippings.com](http://clippings.com)
Under BSD-3-Clause license, read LICENSE file.
All versions of shipping with dependencies
composer/installers Version *
openbuildings/purchases Version ^0.12
clippings/freezable Version ^0.3
openbuildings/jam Version ^0.6