Package DE_EPAGES::Product::API::Product
API helper functions for product variations.
@EXPORT_OK |
Functions
- DeleteProductImage
- GetInfoSubProductsBySuperProductID
- InsertMultipleSubProducts
- JoinVariationValues
- RenameProductImageFile
- ScaleImageSizes
- SplitVariationValues
- SubProductFolder
- TestUPCEAN
- UpdateAvailability
- UsedVariationValues
- stringIsURL
DeleteProductImage
Deletes an image file and unassigns it from the product, its super product and all sub products.
Syntax |
DeleteProductImage($Product, $FileName); |
Input |
|
GetInfoSubProductsBySuperProductID
Returns the sub products with a given set of variation values.
Syntax |
$ahResult = GetInfoSubProductsBySuperProductID($SuperProductID, $VariationString); |
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 |
|
JoinVariationValues
Joins the values to one string, comma separated.
Syntax |
$ValueString = JoinVariationValues($raValues); |
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 |
|
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 |
|
SplitVariationValues
Splits the comma separated string to the values.
Syntax |
$raValues = SplitVariationValues($ValueString); |
Input |
|
SubProductFolder
Creates/returns a folder for sub products (type ProductFolder).
Syntax |
$Folder = SubProductFolder( $SuperProduct ); |
Input |
|
Return |
|
TestUPCEAN
Tests if the parameter $EAN is a valid EAN-13/EAN-8 or a UPC Version A / UPV Version E format.
Syntax |
TestUPCEAN($Name, $EANUPC); |
Example |
TestUPCEAN('EAN', '4004764007974'); TestUPCEAN('UPC', '768268019959'); |
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(); |
UsedVariationValues
Returns the list of all variation values that are actually used by sub products of this super product.
Syntax |
$aValueIDs = UsedVariationValues($Product); |
Example |
$aValues = UsedVariationValues($Product); foreach my $ObjectID (@$aValueIDs) { print LoadObject($ObjectID)->get('Name'), "\n"; } |
Input |
|
stringIsURL
Tests whether the given string is an URL.
Syntax |
$IsUrl = stringIsURL($String); |
Input |
|
Return |
|