ePages 6.10 - DE_EPAGES/Catalog/API/Catalog.pm

Package DE_EPAGES::Catalog::API::Catalog

Functions to assign or remove products to categories.

@EXPORT
AssignProductToCategory
IsProductAssignedToCategory
IsProductAssignedToCategoryWithParent
RemoveProductFromCategory
RenumberCategoryProducts
SortProductList

Functions

AssignProductToCategory
IsProductAssignedToCategory
IsProductAssignedToCategoryWithParent
RemoveProductFromCategory
RenumberCategoryProducts
SortProductList

AssignProductToCategory

Assign a product to a catalog. The products will not be renumbered. If the product is alreday assigned to the category, nothing happens. If the super product of a subproduct is already assigned, nothing happens.

Syntax
$ret = AssignProductToCategory($Product, $Category);
$ret = AssignProductToCategory($Product, $Category, 25);
Input
$Product (product object)
the product
$Category (category object)
the category
$Position (integer (optional))
the position for sorting the product list
Return
$ret (integer)
1 - product has been assigned
2 - product already assigned before; position has been updated if passed
3 - super product already assigned before; no changes apply

IsProductAssignedToCategory

Indicates whether or not a product is assigned to a category. For subproducts true will be returned only if the subproduct itself is assigned to the category.

Syntax
if (IsProductAssignedToCategory($Product, $Category)) {...
Input
$Product (product object)
the product
$Category (category object)
the category
Return
$ret (boolean)
true - product is assigned to category
false - product is not assigned to category

IsProductAssignedToCategoryWithParent

Indicates whether or not a product is assigned to a category. For subproducts true will be returned if the superproduct or the subproduct (or both) are assigned to the category.

Syntax
if (IsProductAssignedToCategoryWithParent($Product, $Category)) {...
Input
$Product (product object)
the product
$Category (category object)
the category
Return
$ret (boolean)
true - product is assigned to category
false - product is not assigned to category

RemoveProductFromCategory

Remove a product from a category. The products will not be renumbered. If the product is not yet assigned no changes apply, even if its superproduct is assigned to the category.

Syntax
$ret = RemoveProductFromCategory($Product, $Category);
Input
$Product (product object)
the product
$Category (category object)
the category
Return
$ret (integer)
1 - product has been removed
2 - product had not been already assigned before

RenumberCategoryProducts

Renumber the products assigned to a category.

Syntax
RenumberCategoryProducts($Category);
Input
$Category (category object)
the category

SortProductList

Changes the sort order of products in category list accordning to the given sort criteria.

Syntax
SortProductList($Category, 'byStockLevel');
Input
$Category (category object)
the category
$sortName (string)
sort criteria, i.e. alphabetize, byPriceASC,
byPriceDESC, byNew, byStockLevel, byProductAlias