Package DE_EPAGES::Product::API::Product
API helper functions for product variations.
Functions
- DeleteProductImage
- DeleteProductImageByAttribute
- ExistsSubProductByAttributeValues
- GenerateCustomizedProductPDF
- GetProductPrettyUnityUrlsRequest
- GetScaledImages
- GetSubProductByAttributeValues
- GetUnityPrettyUrl
- GetVisibleProductIDs
- GetVisibleSubProductIDs
- InsertMultipleSubProducts
- RenameProductImageFile
- RenameSubProductImageFile
- SaveProductPrettyUrlsResponse
- ScaleImageSizes
- SendCustomizationDocumentAsPDFMail
- SmartSearchProducts
- StartUnityProgressMonitor
- StoreProductImages
- SubProductFolder
- TestUPCEAN
- UpdateAvailability
- UpdateUnityProgressMonitor
- UsedVariationValues
DeleteProductImage
Deletes an image file and unassigns it from the product, its super product and all sub products.
Syntax |
DeleteProductImage($Product, $FileName); |
Input |
|
DeleteProductImageByAttribute
Delete images assigned to given attribute. This method calls DeleteProductImage to remove all assignments from slide show, subproducts and subproduct slide show.
Syntax |
DeleteProductImageByAttribute( $Product, $aAttributes ); |
Input |
|
ExistsSubProductByAttributeValues
Returns true if a sub product exists having both the given superproduct id and the combination of variations. This subroutine should be preferred over GetSubProductByAttributeValues() when the objective is just to get knowledge about whether or not a sub product exists.
Syntax |
$Exists = ExistsSubProductByAttributeValues($SuperProductID, $aVariations); |
Input |
|
Return |
|
GenerateCustomizedProductPDF
Converts customized product details to pdf document
Syntax |
$hPdfContent = GenerateCustomizedProductPDF($ProductLineItem); |
Input |
|
Return |
|
GetProductPrettyUnityUrlsRequest
given an array of ProductIDs, it generates proper request to get pretty unity URLs from epages-ui 'products-get-urls' end-point
Syntax |
GetProductPrettyUnityUrlsRequest( $aProductIDs, $LanguageID ); |
Input |
|
Return |
|
GetScaledImages
Resize an uploaded image to the sizes l,m,ms,ml,s,h,xs using the method ScaleImageSizes and returns the related hash.ref
Syntax |
GetScaledImages($FilePath, $Shop); |
Input |
|
Return |
|
GetSubProductByAttributeValues
Returns the sub products of a super product having the given set of variation values. In general, one can expect that only a single sub product will match the given variation combination. It should be noted, however, that the following example might be valid: Given a super product with various variations (e.g. color, size, weight). A user might only be interested in all sub products having the color 'red'. In this case, the result set is likely to be greater than 1. Since this subroutine is used to select a specific sub product in the storefront, such a query does de facto not exist. Hence, if more than one sub product matches, this subroutine returns the error 'TOO_MANY_MATCHING_SUBPRODUCTS'; the subroutine raises the error 'SUBPRODUCT_NOT_EXISTS', if the variation combination ($aVariations) itself does not exist for the given super product.
Syntax |
$SubProduct = GetSubProductByAttributeValues($SuperProductID, $aVariations); |
Input |
|
Return |
|
GetUnityPrettyUrl
it gets pretty unity URL from database or from redirect request to unity service
Syntax |
GetUnityPrettyUrl( $Product, $ShopLanguageID, $LanguageID, $UseOnStoredPrettyUrl ); |
Input |
|
Return |
|
GetVisibleProductIDs
Returns all visible product IDs.
Syntax |
$aProducts = GetVisibleProductIDs($Shop); |
Input |
|
Return |
|
GetVisibleSubProductIDs
Returns all visible sub product IDs for a given (master) product.
Syntax |
$aSubProductIDs = GetVisibleSubProductIDs($Product); |
Input |
|
Return |
|
InsertMultipleSubProducts
Creates a set of new sub products for a given master product, every combination of the given variations will be reflected as a own sub product.
Syntax |
InsertMultipleSubProducts( $SuperProduct, $ahVariationTypes, $hValues ); InsertMultipleSubProducts( $SuperProduct, $ahVariationTypes, $hValues, $hOptions ); |
Input |
|
RenameProductImageFile
Renames the given old file associated to a product to the given new name. Also renames all derivatives of the file, i.e. when the file is an image rename the smaller images for hotdeal, thumbnail, etc. If the image file was the current product image, update the product's object attributes with the new filename as well. If another file with the given new name already exists, an error is thrown.
Syntax |
$hResult = RenameProductImageFile( $Product, $OldFileName, $NewFileName, $FileExt ); |
Input |
|
Return |
|
RenameSubProductImageFile
Renames the given old file associated to a product to the given new name. Also renames all derivatives of the file, i.e. when the file is an image rename the smaller images for hotdeal, thumbnail, etc. If the image file was the current product image, update the product's object attributes with the new filename as well. If another file with the given new name already exists, an error is thrown.
Syntax |
$hResult = RenameSubProductImageFile( $SubProduct, $OldFileName, $NewFileName, $FileExt ); |
Input |
|
Return |
|
SaveProductPrettyUrlsResponse
given the response array from epages-ui 'products-get-urls' end-point, it saves product pretty urls into database
Syntax |
SaveProductPrettyUrlsResponse( $aProductPrettyUrlsResponse, $PortalLanguageID ); |
Input |
|
ScaleImageSizes
scale an image by the given scale vars
Syntax |
ScaleImageSizes($File,$hParams); $sample ScaleImageSizes('C:\test\image.gif', { "SCALE_WIDTH_m" => 200, "SCALE_WIDTH_s" => 100, "SCALE_WIDTH_h" => 150, "SCALE_HEIGHT_h" => 150, "SCALE_NAME_m" => 'ImageMedium', "SCALE_NAME_s" => 'ImageSmall', "SCALE_NAME_h" => 'ImageHotDeal', }); |
Input |
|
Return |
|
SendCustomizationDocumentAsPDFMail
Send an customization document as pdf file mail to the given email .
Syntax |
SendCustomizationDocumentAsPDFMail($LineItemProduct,$Servlet); |
Input |
|
SmartSearchProducts
Returns the product objects for a search string (alias)
Syntax |
$aProducts = SmartSearchProducts($Shop, $SearchString); |
Input |
|
Return |
|
StartUnityProgressMonitor
Starts a progress Monitor in the Unity design.
Syntax |
StartUnityProgressMonitor($Servlet, $Product, $aListItems); |
Input |
|
StoreProductImages
Stores a given image and generate smaller version of this image based on parameter $aSize
Syntax |
$hResponse = StoreProductImages( $Product, $ImageName, $ImageBinary, $aSizes ); |
Input |
|
SubProductFolder
Creates/returns a folder for sub products (type ProductFolder).
Syntax |
$Folder = SubProductFolder( $SuperProduct ); |
Input |
|
Return |
|
TestUPCEAN
Tests if the parameter $EANUPC is a valid EAN-13/EAN-8 or a UPC Version A / UPV Version E or ISBN 10 format.
Syntax |
TestUPCEAN($Name, $EANUPC); |
Example |
TestUPCEAN('EAN', '4004764007974'); TestUPCEAN('UPC', '768268019959'); TestUPCEAN('ISBN', '3-930673-48-7'); TestUPCEAN('ISBN', '3 930673 48 7'); |
Input |
|
UpdateAvailability
Updates the IsAvailable attribute of all products in the system based on the AvailabilityDate attribute. Call this function once a day for each shop database.
Syntax |
UpdateAvailability(); |
UpdateUnityProgressMonitor
Updates a progress monitor by increasing the counter.
Syntax |
UpdateUnityProgressMonitor($Servlet); |
Input |
|
UsedVariationValues
Returns the list of all variation values that are actually used by sub products of the given super product. Returns undef if a sub product is passed to this subroutine.
Syntax |
$aValueIDs = UsedVariationValues($Product); |
Example |
my $aValueIDs = UsedVariationValues($Product); foreach my $ObjectID (@$aValueIDs) { print LoadObject($ObjectID)->get('Name'), "\n"; } |
Input |
|
Return |
|