This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » Shipping settings / Shipping price...
expandshrink

Shipping settings / Shipping price per country

Shipping settings / Shipping price per country

Wednesday 12 September 2012 5:49:29 pm - 2 replies

Hello,I am finishing an ecommerce website based on eZ and I am looking for shipping settings but I don't find them (am I too tired ?).Is there any shipping price per country feature/extension ?By the way, have good summercamp, for those who are there.

Wednesday 12 September 2012 9:16:49 pm

Hi Paul,

there is no such feature, unfortunatelly.

I had to develop it for a client using a custom before/confirmorder trigger event, reading the shipping cost from config file and adding a custom eZOrderItem to my order, something like this:

$countryShipping = eZINI::instance( 'my.ini' )->variable( 'ShippingCosts', 'CountryShipping' );
$countryShippingOrderItem = new eZOrderItem(
    array(
        'description' => 'Shipping to ' . $accountInformation['country'],
        'is_vat_inc' => 1,
        'order_id' => $order->attribute( 'id' ),
        'price' => round( (float) $countryShipping[$accountInformation['country']], 2 ),
        'type' => 'countryshippingcosts',
        'vat_value' => 0
    )
);
$countryShippingOrderItem->store(); 

Hope it helps!

P.S. Summer Camp ended 4 days ago blunk.gif Emoticon

Thursday 13 September 2012 9:44:06 am

You can build your own shipping handler for shipping cost calculation. Look at the shop.ini for more information:

[ShippingSettings]
# Specifies shipping handler class/file name. For example, if the value is
# "ezcustom", then the handler class should be named
# eZCustomShippingHandler (case does not matter) and placed to file
# ezcustomshippinghandler.php residing in a directory specified by
# "RepositoryDirectories" and "ExtensionDirectories" settings.
#Handler=ezdefault
 
# Directories where shippping handlers should be searched for.
RepositoryDirectories[]=kernel/classes/shippinghandlers
 
# If you are going to implement your shipping handler in an extension
# then you should add the extension name to the list below.
# In that case shipping handlers will be searched for
# in the following (hardcoded) directory:# extension/<your_extension>/shippinghandlers
# beside directories specified in 'RepositoryDirectories' setting.
ExtensionDirectories[]
 

 

But be aware of a bug in the handler exists check. When loading the handler specified in ShippingSettings, the system will search for the file (e.g. ezdefaultshippinghandler.php). If the systems can find the file it, tries to load a class called ezdefaultShippingHandler. This will fail because the class is named eZDefaultShippingHandler (camel case). If you change the handler to "Handler=eZDefault", the system could load the class but the previous file check will fail, so it will never try to load the class.

To work around the bug, build a custom handler: e.g. ezcustomShippingHandler in a file named ezcustomshippinghandler.php and the set the handler setting to "Handler=ezcustom".

For more information on how to build a custom shipping handler, you can take look at the sample shipping handler project at projects.ez.no: http://projects.ez.no/sample_shipping_handler

Modified on Thursday 13 September 2012 9:49:22 am by Daniel Schreier

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from