FedEx shipping extension (module) for ezPublish
We created this module after looking at both FedEx and UPS. I decided the best route was to accommodate both so that later one can be add later. The shipping module will eventually work with both shipping suppliers, and possibly some other ones. At the moment it's only FedEx.
The problem with both shippers is that they have different ways of classifying the zones they ship to (a zone is a group of countries that has the same cost to ship to).
So I have written the FedEx shipping module because it has more zones that UPS. Which means we can fit UPS into the same structure later on.
UPS zones are number based whereas FedEx is Letter based so excuse the fact that it's written for numbered zones instead of lettered zones (it's easier to code). This means you must translate the 15 FedEx zones from A to Z into 1 to 26.
Apart from that it should just work.
There are some sql statements that will populate the tables but you must do this for yourself with the correct prices from your country of origin.
An extra feature is that the customer can supply a separate address instead of the one supplied during registration. In order for this to work the kernel needs to be altered as there's no way to hook into the process. I tried and tried and eventually succumbed to editing the kernel. If anyone has a better way let me know. (ez can I have a hook for this?)
The edit is in the kernel/classes/ezorder.php class as shown below. Inserted after the “$db->commit();”
function &detachProductCollection()
{
$collection =& $this->productCollection();
if ( !$collection )
{
$retValue = false;
return $retValue;
}
$db =& eZDB::instance();
$db->begin();
$newCollection =& $collection->copy();
if ( !$newCollection )
{
$db->commit();
$retValue = false;
return $retValue;
}
$this->setAttribute( 'productcollection_id', $newCollection->attribute( 'id' ) );
$this->store();
$db->commit();
//SF-START- code change for Shipping Module
$productCollectionID = $collection->attribute( 'id' );
$newProductCollectionID = $newCollection->attribute( 'id' );
$query = "UPDATE ezfedexshippinginfo " .
"SET productcollection_id= '$newProductCollectionID', completed_productcollection_id = '$newProductCollectionID' " .
"WHERE productcollection_id='$productCollectionID' AND completed_productcollection_id = '0'";
$db = eZDB::instance();
$result = $db->query( $query );
//SF-END Code Change
return $newCollection;
}
---
So onto Installation.
Basically do the usual process for installation.
Upload the extension into the extensions folder
go the admin side of your site and go to setup / extensions and activate the extension. (click on extensions again to ensure it has been activated)
If you doing this manually then make sure your site.ini.append.php file in settings/override has the following in the [ExtensionSettings]
[ExtensionSettings]
ActiveExtensions[]=ezfedexshipping
You must update your user class to use the Country datatype as the extension uses it to work our what the destination shipping country is.
Look here for this.
http://ez.no/doc/ez_publish/technical_manual/3_8/features/vat_charging_system/user_country
Then you need to add a “weight” attribute to your product classes. The weight attribute should be a “float” type.
The weight is used in combination with the country of the user to calculate the shipping.
Then your good to go.
If I’ve forgotten anything I’m sure you’ll remind me.
You can download the source above (in the right column) or go here to collect it from the ez.no site at ezFedexShipping.
For custom ezPublish extension development call us on 0800 066 4366 or send us an email.