ePages 6.10 - DE_EPAGES/Order/API/Object/ContainerShippingMethod.pm

Package DE_EPAGES::Order::API::Object::ContainerShippingMethod

Object interface for ContainerShippingMethod extends the shipping method with line item functionalities.

Base
DE_EPAGES::Shipping::API::Object::ShippingMethod

Functions

addToContainer
calculateShippingPrice
canAddToBasket
lineItem
recalculateLineItem
valueToFreeDelivery

addToContainer

Adds shipping and tax line item to container.

Syntax
$LineItem = $ShippingMethod->addToContainer($Container);
Input
$Container (object)
line item container
Return
$LineItem (object)
line item

calculateShippingPrice

Returns the shipping price for the given line item container. This method is used by lineItem and recalculateLineItem unless they are overloaded. The default implementation returns 0. Override this method to change the shipping price calculation of a basket or order. To calculate the shipping costs without a lineitem container, e.g. for export to product portals, also overload the method DE_EPAGES::Shipping::API::Object::ShippingMethod::price.

Syntax
my $ShippingPrice = $ShippingMethod->calculateShippingPrice($Container);
Input
$Container (ref.hash)
LineItemContainer
Return
$ShippingPrice (money)
price of shipping

canAddToBasket

Tests if a shipping method can be added to the basket with the given currency. Uses function DE_EPAGES::Shipping::API::Object::ShippingMethod::price to evaluate if shipping methode has a price (price can be 0). Possible for methods, which costs, but have no price in the given currency.

Syntax
$Can = $ShippingMethod->canAddToBasket($hVars);
Input
$hVars (ref.hash)
vars of container and basket
Return
$Can (boolean)
can added to the basket

lineItem

Returns information for adding a new shipping line item. Called for new baskets if this shipping methos is default or for existing baskets when the shipping method is changed.

Syntax
my $hInfo = $ShippingMethod->lineItem($Container);
Input
$Container (object)
line item container
Return
$hInfo (ref.hash)
shipping line item info, keys
  • LineItemPrice - price for shipping is 0 - float
  • Name - name of shipping method
  • Quantity - quantity is 1 - float
  • ShippingMethod - self - object
  • TaxClass - tax class of shipping - object
  • TaxRate - tax rate - float

recalculateLineItem

Recalculates the price of an existing shipping line item.

Syntax
$ShippingMethod->recalculateLineItem($LineItem);
Input
$LineItem (object)
line item

valueToFreeDelivery

Returns the additional basket values required to get free delivery. Override this method if you want to display a message in the basket indicating the additional value required to get free shipping. If the return value is greater that 0, such a message is displayed in the basket page.

Syntax
my $MissingValueForFreeDelivery = $ShippingMethod->valueToFreeDelivery($Container);
Input
$Container (ref.hash)
LineItemContainer
Return
$MissingValueForFreeDelivery (money)
missing value