Package DE_EPAGES::Product::API::Object::Product
object interface for Product.
Base |
DE_EPAGES::Content::API::Object::ContentObject |
Functions
- adaptLayout
- addBundleToStock
- addLineItemDeposit
- addLineItemEcoParticipation
- addToBundle
- addToContainer
- addToStock
- appointmentPrepayment
- appointmentPrice
- availableQuantity
- businessHours
- canAddToBasket
- canInvalidatePageCache
- className
- classTemplate
- correctQuantity
- createURI
- dbPackage
- defaultObject
- discount
- filePath
- getDeposit
- getDirectDeposit
- getDirectEcoParticipation
- getDirectListPrice
- getDirectManufacturerPrice
- getEcoParticipation
- getListPrice
- getManufacturerPrice
- getPrepayment
- getWithParent
- hasPrice
- isAllowedChild
- isDeliveryTimeLonger
- lineItem
- price
- recalculateLineItem
- renumberBundleProductMaps
- renumberDownloadProductMaps
- setDeposit
- setEcoParticipation
- setListPrice
- setManufacturerPrice
- setPrepayment
- stockAlert
- substractBundleFromStock
- substractFromStock
- taxMatrix
- templatePath
- timeFactor
- updateBundleDeposit
- updateBundleEcoParticipation
adaptLayout
Changes selected templates to 0 if product has no bundles or variation.
Syntax |
$Product->adaptLayout($hInfo); |
Input |
|
addBundleToStock
Adds the given Quantity to the Stocklevel of each bundled product. See also addToStock($Quantity). If the product is no bundle then this function is called for this product.
Syntax |
$Product->addBundleToStock($Quantity); |
Input |
|
addLineItemDeposit
Adds a deposit lineitem for the given product lineitem.
Syntax |
$LineItemDeposit = $Container->addLineItemDeposit($LineItemProduct, $Deposit); |
Input |
|
Return |
|
addLineItemEcoParticipation
Adds a eco Particpation lineitem for the given tax class, if not exists yet.
Syntax |
$LineItemEcoParticipation = $Container->addLineItemEcoParticipation($Container, $TaxClass); |
Input |
|
Return |
|
addToBundle
Adds this product to a product bundle.
Syntax |
$Product->addToBundle( $BundleProduct, $hInfo ); |
Example |
$Product->addToBundle( $BundleProduct, { BundledQuantity => 2 } ); |
Input |
|
addToContainer
Adds the product to the line item container (of a basket or order). If a line item of the same product already exists in the basket, then the function acts according to the shop preference Shop.AddToBasketStyle:
- a new line item is created or
- the quantity is added to the existing line item or
- the new line item replaces the existing line item or
- the previous quantity remains and the product is not added
Syntax |
$LineItem = $Product->addToContainer( $Container, $hInfo ); |
Example |
Transaction( sub { my $Basket = GetBasket( $User, $Shop ); my $LineItem = $Product->addToContainer( $Basket->container, { Quantity => 3 } ); $Basket->recalculate; } ); |
Input |
|
Return |
|
addToStock
Increments the StockLevel by the given Quantity.
Syntax |
$Product->addToStock($Quantity); |
Input |
|
appointmentPrepayment
Returns product price includes discount and duration data.
Syntax |
$Price = $Product->appointmentPrepayment($Appointment, $hInfo); |
Input |
|
Return |
|
appointmentPrice
Returns product price includes discount and duration data.
Syntax |
$Price = $Product->appointmentPrice($Appointment, $hInfo); |
Input |
|
Return |
|
availableQuantity
Ckecks if the given quantity value is valid according to the products MinOrder and IntervalOrder settings. Then checks if the desired amount is actually on stock. If one order multiple line items of the same product, pass the quantity of the other line items as second parameter ($ExistingQuantity). Returns the closest quantity that can actually be ordered. Returns 0 if the product cannot be ordered.
Syntax |
$AvailableQuantity = $Product->availableQuantity( $DesiredQuantity, $ExistingQuantity ); |
Input |
|
Return |
|
businessHours
Returns product calendar (child BusinessHours), if not exists then the calendar will be created.
Syntax |
$Calendar = $Product->businessHours; |
Return |
|
canAddToBasket
Tests if a product can be added to the basket with the given quantity.
Syntax |
$CanAddToBasket = $Product->canAddToBasket($Quantity); |
Input |
|
Return |
|
canInvalidatePageCache
Overwrites method DE_EPAGES::Object::API::Object::Object->canInvalidatePageCache to invalidate page cache.
Syntax |
$Object->canInvalidatePageCache; |
className
Returns the class name, used for DAL access.
Syntax |
$ClassName = $Product->className; |
Return |
|
classTemplate
This function is used to overwrite the given template for the purpose that each content object can defined there own template (visualisation). Function overwrites DE_EPAGES::Object::API::Object::Object->classTemplate for EPG-16237. By merchand created subclasses of product should not used for TemplateName.
Syntax |
$Name = $Object->classTemplate($Name, $ObjectPageType); |
Input |
|
Return |
|
correctQuantity
Checks if a given quantity of the product can be ordered according to the products minimum order amount (MinOrder) and interval amount (IntervalOrder). Returns the next valid quantity value if the desired amount cannot be ordered. This function does not check the current stock level.
Syntax |
$ValidQuantity = $Product->correctQuantity( $DesiredQuantity ); |
Example |
print $Object->correctQuantity( 17.5 ); |
Input |
|
Return |
|
createURI
Returns a suggestion for a short url.
Syntax |
$URI = $Object->createURI($Name, $Parent, $LanguageID); |
Return |
|
dbPackage
Returns the database package, used for DAL access.
Syntax |
$DbPackage = $Product->dbPackage; |
Return |
|
defaultObject
Returns the default object (has to be overwritten for products with variation).
Syntax |
$ContentObject = $Object->defaultObject(); |
Return |
|
discount
Returns the product discount by the given requirements. The hook 'ProductDiscount' is triggered before the standard discount = 0.
Syntax |
$Discount = $Product->discount( $hVars ); |
Example |
$Discount = $Product->discount( { CurrencyID => 'USD', TaxModel => $Product->getSite()->get('TaxModel') } ); |
Input |
|
Return |
|
filePath
Returns the relative file path of object from the System file path. If the product is an variation the filePath of the SuperProduct will returned.
Syntax |
$Object->filePath; |
Return |
|
getDeposit
Returns the eco participation of this product. Returns the eco participation of the super product if $Product is a sub product that does not have its own price, i.e. the attribute HasSubOwnPrices is false. Returns undef if the product does not have a eco participation.
Syntax |
$Value = $Product->getDeposit($CurrencyID, $TaxModel); |
Example |
$Value = $Product->getDeposit('EUR', 1); |
Input |
|
Return |
|
getDirectDeposit
Returns the eco participation that is defined on directly on this product object. Returns undef if $Product is a sub product that does not have its own price and inherits its price from the super product.
Syntax |
$Value = $Product->getDirectDeposit($CurrencyID, $TaxModel); |
Example |
$Value = $Product->getDirectDeposit('EUR', 1); |
Input |
|
Return |
|
getDirectEcoParticipation
Returns the eco participation that is defined on directly on this product object. Returns undef if $Product is a sub product that does not have its own price and inherits its price from the super product.
Syntax |
$Value = $Product->getDirectEcoParticipation($CurrencyID, $TaxModel); |
Example |
$Value = $Product->getDirectEcoParticipation('EUR', 1); |
Input |
|
Return |
|
getDirectListPrice
Returns the list price that is defined on directly on this product object. Returns undef if $Product is a sub product that does not have its own price and inherits its price from the super product.
Syntax |
$Value = $Product->getDirectListPrice($CurrencyID, $TaxModel); |
Example |
$Value = $Product->getDirectListPrice('EUR', 1); |
Input |
|
Return |
|
getDirectManufacturerPrice
Returns the manufacturer's suggested retail price (MSRP) that is defined directly on this product object. Returns undef if $Product is a sub product that does not have its own MSRP and inherits its MSRP from the super product.
Syntax |
$Value = $Product->getDirectManufacturerPrice($CurrencyID, $TaxModel); |
Example |
$Value = $Product->getDirectManufacturerPrice('EUR', 1); |
Input |
|
Return |
|
getEcoParticipation
Returns the eco participation of this product. Returns the eco participation of the super product if $Product is a sub product that does not have its own price, i.e. the attribute HasSubOwnPrices is false. Returns undef if the product does not have a eco participation.
Syntax |
$Value = $Product->getEcoParticipation($CurrencyID, $TaxModel); |
Example |
$Value = $Product->getEcoParticipation('EUR', 1); |
Input |
|
Return |
|
getListPrice
Returns the list price of this product. Returns the list price of the super product if $Product is a sub product that does not have its own price, i.e. the attribute HasSubOwnPrices is false. Returns undef if the product does not have a list price.
Syntax |
$Value = $Product->getListPrice($CurrencyID, $TaxModel); |
Example |
$Value = $Product->getListPrice('EUR', 1); |
Input |
|
Return |
|
getManufacturerPrice
Returns the manufacturer's suggested retails price (MSRP) of this product. Returns the MSRP of the super product if $Product is a sub product that does not have its own price, i.e. the attribute HasSubOwnPrices is false. Returns undef if the product does not have an MSRP.
Syntax |
$Value = $Product->getManufacturerPrice($CurrencyID, $TaxModel); |
Example |
$Value = $Product->getManufacturerPrice('EUR', 1); |
Input |
|
Return |
|
getPrepayment
Returns the prepayment of this product. Returns undef if the product does not have a prepayment.
Syntax |
$Value = $Product->getPrepayment($CurrencyID, $TaxModel); |
Example |
$Value = $Product->getPrepayment('EUR', 1); |
Input |
|
Return |
|
getWithParent
Returns the values of product attributes. Similar to $Object->get(). If called on a sub product and the attribute value is not defined for the sub product, then returns the attribute value of its super product.
Syntax |
$hValues = $Product->getWithParent($aNames, $LanguageID); $hValues = $Product->getWithParent($aNames); $Values = $Product->getWithParent($Name, $LanguageID); $Value = $Product->getWithParent($Name); |
Example |
my $LangugaeID = GetPKeyLanguageByCode('en'); my $Description = $Product->getWithParent('Description', $LanguageID); |
Input |
|
Return |
|
hasPrice
Returns true if the product has a price. The result may depend on the customer or indirectly on the user. If no user or customer is given, returns whether there is a price for anonymous customers.
Syntax |
$HasPrice = $Product->hasPrice; $HasPrice = $Product->hasPrice( $hVars ); |
Example |
if( $Product->hasPrice ) { ... } if( $Product->hasPrice( { Customer => $Customer } ) ) { ... } if( $Product->hasPrice( { User => $User } ) ) { ... } |
Input |
|
Return |
|
isAllowedChild
Returns if an Object could be the parent of a PossibleChild.
Syntax |
$isAllowed = $Object->isAllowedChild($PossibleChild); |
Return |
|
isDeliveryTimeLonger
Tests if a product has a longer delivery time, because it is not currently on stock. The current basket is not involved.
Syntax |
$IsLonger = $Product->isDeliveryTimeLonger(); |
Return |
|
lineItem
Returns the required attributes to create a product line item object, which can be added to the line item container of a basket or order. Use addToContainer instead of calling this function directly.
Syntax |
$hLineItem = $Product->lineItem( $Container, $hInfo ); |
Input |
|
Return |
|
price
Returns the product price by the given requirements. The hook 'ProductPrice' is triggered before the standard price list is used.
Syntax |
$Price = $Product->price( $hVars ); |
Example |
$Price = $Product->price( { CurrencyID => 'USD', TaxModel => $Product->getSite()->get('TaxModel') } ); |
Input |
|
Return |
|
recalculateLineItem
Recalculate a product line item when something has changed on basket, for example if a different tax area was chosen.
Syntax |
$Product->recalculateLineItem( $LineItem, $hValues); |
Input |
|
renumberBundleProductMaps
Renumbers the bundled products assigned to a product.
Syntax |
$Product->renumberBundleProductMaps; |
renumberDownloadProductMaps
Renumbers the downloadfiles assigned to a product.
Syntax |
$Product->renumberDownloadProductMaps; |
setDeposit
Sets the eco participation of this product. If $Product is a sub product, then the price overrides the price of the super product. In this case, you should also set the attribute HasSubOwnPrices of the sub product to true.
Syntax |
$Product->setDeposit($CurrencyID, $TaxModel, $Value); |
Example |
$Product->setDeposit('EUR', 1, 19.99); $Product->set({ HasSubOwnPrices => 1 }) if defined $Product->get('SuperProduct'); $Product->setDeposit('EUR', 1, undef); |
Input |
|
setEcoParticipation
Sets the eco participation of this product. If $Product is a sub product, then the price overrides the price of the super product. In this case, you should also set the attribute HasSubOwnPrices of the sub product to true.
Syntax |
$Product->setEcoParticipation($CurrencyID, $TaxModel, $Value); |
Example |
$Product->setEcoParticipation('EUR', 1, 19.99); $Product->set({ HasSubOwnPrices => 1 }) if defined $Product->get('SuperProduct'); $Product->setEcoParticipation('EUR', 1, undef); |
Input |
|
setListPrice
Sets the list price of this product. If $Product is a sub product, then the price overrides the price of the super product. In this case, you should also set the attribute HasSubOwnPrices of the sub product to true.
Syntax |
$Product->setListPrice($CurrencyID, $TaxModel, $Value); |
Example |
$Product->setListPrice('EUR', 1, 19.99); $Product->set({ HasSubOwnPrices => 1 }) if defined $Product->get('SuperProduct'); $Product->setListPrice('EUR', 1, undef); |
Input |
|
setManufacturerPrice
Sets the manufacturer's suggested retail price (MSRP) of this product. If $Product is a sub product, then the MSRP overrides the MSRP of the super product.
Syntax |
$Product->setManufacturerPrice($CurrencyID, $TaxModel, $Value); |
Example |
$Product->setManufacturerPrice('EUR', 1, 19.99); $Product->setManufacturerPrice('EUR', 1, undef); |
Input |
|
setPrepayment
Sets the prepayment of this product.
Syntax |
$Product->setPrepayment($CurrencyID, $TaxModel, $Value); |
Example |
$Product->setPrepayment('EUR', 1, 19.99); $Product->setPrepayment('EUR', 1, undef); |
Input |
|
Return |
|
stockAlert
Gets the availability status of the product. Used by the attribute 'StockLevelAlert'. Possible return values are:
- NO_STOCK - sock handling is disabled (stock level is undefined)
- ON_STOCK - product is on stock, StockLevel > StockLevelAlert or StockLevelAlert is not defined
- WARN_STOCK - product is on stock, StockLevel
- OUT_STOCK - product is not on stock (StockLevel
Syntax |
$StockAlert = $Product->stockAlert($Quantity); $StockAlert = $Product->stockAlert; |
Input |
|
Return |
|
substractBundleFromStock
Decrements the stock level of each bundled Product by given quantity. See also substractFromStock($Quantity). If the product is no bundle then this function is called for this product.
Syntax |
$Product->substractBundleFromStock($Quantity); |
Input |
|
substractFromStock
Decrements the stock level by the given quantity and sets the visibility of a product if choosen and sends a stock warning.
Syntax |
$Product->substractFromStock($Quantity); |
Input |
|
taxMatrix
Returns the tax matrix of shop of product.
Syntax |
$TaxMatrix = $Product->taxMatrix; |
templatePath
Extends the Object.templatePath with the super product.
Syntax |
$aObjects = $Product->templatePath; |
Return |
|
timeFactor
Returns factor to calculate price as quotient for appointment duration devided by default appointment duration. e.g. If default duration is 1 hour and appointment duration is 30 minutes than timefactor = 0.5
Syntax |
my $TimeFactor = $Product->timeFactor($StartDate, $EndDate); |
Input |
|
Return |
|
updateBundleDeposit
Set deposit from the bundled products to a product.
Syntax |
$Product->updateBundleDeposit; |
updateBundleEcoParticipation
Set ecoparticipation from the bundled products to a product.
Syntax |
$Product->updateBundleEcoParticipation; |