ePages 6.11.0 - DE_EPAGES/ShippingOption/API/Object/ShippingOption.pm

Package DE_EPAGES::ShippingOption::API::Object::ShippingOption

object interface for ShippingOption.

Base
DE_EPAGES::Object::API::Object::Object

Functions

addToContainer
canAddToBasket
className
dbPackage
price
recalculateLineItem
setPrice

addToContainer

Adds lineItem of shipping option to line item container.

Syntax
$LineItem = $Object->addToContainer( $Container, $hInfo );
Input
$Container (object)
line item container
$hInfo
hash with keys ShippingOptionImage, Comment
Return
$LineItem (object)
lineitem

canAddToBasket

Tests if a shipping option can be added to the basket with the given currency. Uses function DE_EPAGES::ShippingOption::API::Object::ShippingOption::price to evaluate if shipping option has a price (price can be 0).

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

className

Returns the class name, used for DAL access.

Syntax
$ClassName = $ShippingOption->className;
Return
$ClassName (String)
class name

dbPackage

Returns the database package, used for DAL access.

Syntax
$DbPackage = $ShippingOption->dbPackage;
Return
$DbPackage (String)
database package name

price

Returns the price by the given requirements. If no price exists, 0 will be returned.

Syntax
$Price = $ShippingOption->price( $hVars );
Example
$Price = $ShippingOption->price( {
    CurrencyID => 'USD',
    TaxModel   => $ShippingOption->getSite()->get('TaxModel'),
    ExtraPrecision => 1,
} );
Input
$hVars (ref.hash)
  • CurrencyID - alpha currency code (ISO 4217) - char(3)
  • TaxModel - gross or net price - int
  • ExtraPrecision - extra precision - int
Return
$Price (money)
price of shipping option

recalculateLineItem

Recalculate a shipping option line item when something has changed on basket, for example if a different currency was chosen.

Syntax
$Object->recalculateLineItem( $LineItem, $hInfo );
Input
$LineItem (object)
line item
$hInfo (ref.hash)
hash with keys CurrencyID, TaxModel

setPrice

Sets the list price of this shipping option.

Syntax
$Product->setPrice($CurrencyID, $TaxModel, $Value);
Example
use DE_EPAGES::Shop::API::Constants qw( TAX_MODEL_GROSS TAX_MODEL_NET );
$Product->setPrice('EUR', TAX_MODEL_GROSS, 19.99);
Input
$CurrencyID (string)
currency code
$TaxModel (int)
tax model:
TAX_MODEL_GROSS=including tax,
TAX_MODEL_NET=without tax
Return
$Value (float)
price. A value of undef deletes the price.