Documentation

Notes for developers

Before calling any of the module functions or class methods, you have first to check for its availability and include the module using the following code:

<?
if (CModule::IncludeModule("catalog"))
{
    // call module functions here
}
?>

If you want to use any information block as a commercial catalog, you need to check whether this information block is a catalog (i.e. it is attached to the Commercial Catalog module) using the following code:

<?
if (CCatalog::GetByID($IBLOCK_ID))
{
    // now you can handle the information block
    // as a catalog
}?>

You can combine the above stated code into a single condition that checks for the module availability and includes it, as well as verifies for the ability of an information block $IBLOCK_ID to behave as a catalog:

<?
if (CModule::IncludeModule("catalog") &&
    CCatalog::GetByID($IBLOCK_ID))
{
    // now you can handle the information block
    // as a catalog
}
?>

See Also

Displaying prices
[link=9207079]Adding items to basket[/link]

© «Bitrix24», 2001-2022
Up