GetInfoByIBlock
Description and parameters
mixed CCatalogSku::GetInfoByIBlock( $intIBlockID )
Static method.
Call parameters
Parameter | Description |
---|---|
$intIBlockID | Iblock ID. |
Returned value
Returns information if iblock is a catalog:
- false - not a catalog;
- In case iblock is confirmed as a catalog, returns array to be checked for the key value CATALOG_TYPE:
if (\Bitrix\Main\Loader::includeModule('catalog')) { $catalog = CCatalogSku::GetInfoByIBlock(iblock_ID); if (empty($catalog)) { echo 'Iblock is not found or has to connection to commercial catalog'; } else { switch ($catalog['CATALOG_TYPE'] ) { case CCatalogSku::TYPE_CATALOG: echo 'Simple commercial catalog'; break; case CCatalogSku::TYPE_FULL: echo 'Expanded commercial catalog'; break; case CCatalogSku::TYPE_PRODUCT: echo 'Product iblock with estimates'; break; case CCatalogSku::TYPE_OFFERS: echo 'Estimate catalog'; } } }
Important: before catalog 16.0.3, if iblock has stopped being a commercial catalog, product and price characteristics are have been deleted immediately for all elements of this iblock. Now this information is erased only when deleting the element itself.
Possible CATALOG_TYPE key values
- CCatalogSku::TYPE_CATALOG - standard catalog. Can contain the following
product types
:
- \Bitrix\Catalog\ProductTable::TYPE_PRODUCT – simple product
- \Bitrix\Catalog\ProductTable::TYPE_SET – bundle
When creating other types of products you can select - bundle or set .
- CCatalogSku::TYPE_FULL - expanded commercial catalog. Can contain all types за products of commercial catalog plus products with SKUs:
- \Bitrix\Catalog\ProductTable::TYPE_PRODUCT – simple product
- \Bitrix\Catalog\ProductTable::TYPE_SET – bundle
- \Bitrix\Catalog\ProductTable::TYPE_SKU – product with SKUs
When selecting other types of products, you can create product with SKUs, bundle or set .
- CCatalogSku::TYPE_PRODUCT - product iblock with SKUs. Is not considered a commercial catalog. Contains only a
single main product type or a single additional type
:
- \Bitrix\Catalog\ProductTable::TYPE_SKU – product with SKUs
- \Bitrix\Catalog\ProductTable::TYPE_EMPTY_SKU – product without SKUs (deleted or not created)
When selecting other types of products, you can create bundle .
- CCatalogSku::TYPE_OFFERS - SKU catalog. Its
product types
:
- \Bitrix\Catalog\ProductTable::TYPE_OFFER – SKU
- \Bitrix\Catalog\ProductTable::TYPE_FREE_OFFER – SKU without a product (not specified)
When selecting other types of products, you can create a bundle .
© «Bitrix24», 2001-2024