eZPublishCommunityProject(LegacyStack)  2013.6
eZShippingManager Class Reference

The class eZShippingManager does. More...

Static Public Member Functions

static getShippingInfo ($productCollectionID)
 
static purgeShippingInfo ($productCollectionID)
 
static updatePriceInfo ($productCollectionID, &$basketInfo)
 
static updateShippingInfo ($productCollectionID)
 
static vatPriceInfo ($shippingInfo)
 

Static Private Member Functions

static loadBasketInfoHandler ()
 
static loadShippingHandler ()
 

Detailed Description

The class eZShippingManager does.

Member Function Documentation

static eZShippingManager::getShippingInfo (   $productCollectionID)
static

The function are fetching the shipping info and need to be reimplemented in a new shippinghandler. It's also possible to return additional parameters to use in the templates.

Returns
an array with shipping info. An example for an array that should be returned.
array( 'shipping_items' => array( array( 'description' => 'Shipping vat: 12%',
'cost' => 50.25,
'vat_value' => 12,
'is_vat_inc' => 0,
'management_link' => '/myshippingmodule/options/12' ),
array( 'description' => 'Shipping vat: 25%',
'cost' => 100.75,
'vat_value' => 25,
'is_vat_inc' => 1,
'management_link' => '/myshippingmodule/options/25' ) ),
'description' => 'Total Shipping',
'cost' => 10.25,
'vat_value' => false,
'is_vat_inc' => 1,
'management_link' => '/myshippingmodule/options' );

An example for the shippingvalues with only one shippingitem.

array( 'description' => 'Total Shipping vat: 16%',
'cost' => 10.25,
'vat_value' => 16,
'is_vat_inc' => 1,
'management_link' => '/myshippingmodule/options/1234' );

The returned array for each shipping item should consist of these keys:

  • description - An own description of the shipping item.
  • cost - A float value of the cost for the shipping. The value should be a float value.
  • vat_value - The vat value that should be added to the shipping item. The value should be an integer or false if the cost is combined by several VAT prices.
  • is_vat_inc - Integer, either 0, 1. 0: The cost is excluded VAT. 1: the cost is included VAT.
  • management_link - Example of an additional parameter that can be used in a template. Ex: basket.tpl

Referenced by eZShopOperationCollection\handleShipping(), and eZDefaultBasketInfoHandler\updatePriceInfo().

static eZShippingManager::loadBasketInfoHandler ( )
staticprivate

Load basketinfo handler (if specified).

Returns
true if no handler specified, false if a handler specified but could not be loaded, handler object if handler specified and found.

Referenced by updatePriceInfo().

static eZShippingManager::loadShippingHandler ( )
staticprivate

Load shipping handler (if specified).

Returns
true if no handler specified, false if a handler specified but could not be loaded, handler object if handler specified and found.

Referenced by getShippingInfo(), purgeShippingInfo(), and updateShippingInfo().

static eZShippingManager::purgeShippingInfo (   $productCollectionID)
static

Purge shipping information for a stale product collection that is about to be removed.

Should be used when a basket is removed. All shipping information related to the productCollectionID should be removed.

Returns
true if everything went ok. false if an error occurred.

Referenced by eZProductCollection\cleanupList(), and eZShopOperationCollection\handleShipping().

static eZShippingManager::updatePriceInfo (   $productCollectionID,
$basketInfo 
)
static

Update shipping price with calculated information based on original values. All values are changed or added directly in the array $basketInfo

Example on a calculated $basketInfo variable:

array( 'price_info' => array( 0 => array( 'price_ex_vat' => 231,
'price_inc_vat' => 231,
'price_vat' => 0,
'total_price_ex_vat' => 231,
'total_price_inc_vat' => 231,
'total_price_vat' => 0 ),
12 => array( 'total_price_ex_vat' => 50.25,
'total_price_inc_vat' => 56.28,
'total_price_vat' => 6.03 ),
25 => array( 'total_price_ex_vat' => 80.6,
'total_price_inc_vat' => 100.75,
'total_price_vat' => 20.15 ) ),
'total_price_info' => array( 'price_ex_vat' => 231,
'price_inc_vat' => 231,
'price_vat' => 0,
'total_price_ex_vat' => 361.85,
'total_price_inc_vat' => 388.03,
'total_price_vat' => 26.18 ),
'additional_info' => array( 'shipping_items' => array( 12 => array( 'total_price_ex_vat' => 50.25,
'total_price_inc_vat' => 56.28,
'total_price_vat' => 6.03 ),
25 => array( 'total_price_ex_vat' => 80.6,
'total_price_inc_vat' => 100.75,
'total_price_vat' => 20.15 ) ),
'shipping_total' => array( 'total_price_ex_vat' => 130.85,
'total_price_inc_vat' => 157.03,
'total_price_vat' => 26.18 ) ) );

Referenced by eZBasket\itemsInfo().

static eZShippingManager::updateShippingInfo (   $productCollectionID)
static

The function to update any additional shippinginfo and need to be reimplemented in a new shippinghandler.

Returns
true if all updates are ok. false if the update went wrong.

Referenced by eZBasket\updatePrices(), and eZShopOperationCollection\updateShippingInfo().

static eZShippingManager::vatPriceInfo (   $shippingInfo)
static

Calculate the vat prices returned by the shippinghandler.

Need to receive the following values (In the arrays will also consist of additional parameters, see the function getShippingInfo() for more information):

Option 1: An array with shipping items with atleast these values:

array( 'shipping_items' => array( array( 'cost' => 50.25,
'vat_value' => 12,
'is_vat_inc' => 0 ),
array( 'cost' => 100.75,
'vat_value' => 25,
'is_vat_inc' => 1 ) ),
'cost' => 157.03,
'vat_value' => false,
'is_vat_inc' => 1 );

Option 2, backwards compatible:

array( 'cost' => 50.25,
'vat_value' => 12,
'is_vat_inc' => 0 );
Returns
array with calculated vat prices. Example of return value:
array( 'vat_shipping_list_ex_vat' => array( 5 => 345.25,
25 => 112.50 ),
'vat_shipping_list_inc_vat' => array( 5 => 125,
25 => 150.50 ),
'total_shipping_ex_vat' => 1234,
'total_shipping_inc_vat' => 2345 );
  • vat_shipping_list_ex_vat - contains an array with prices (float) ex vat where you have the vat (integer) value as the array key.
  • vat_shipping_list_inc_vat - contains an array with prices (float) inc vat where you have the vat value (integer) as the array key.
  • total_shipping_ex_vat - contains the sum of all prices (float) ex vat.
  • total_shipping_inc_vat - contains the sum of all prices (float) inc vat.

Referenced by eZDefaultBasketInfoHandler\updatePriceInfo().


The documentation for this class was generated from the following file: