agentsclimarketplace

Bitrix catalog

Skill bxmaximum/bitrix-framework-skills/skills/bitrix-catalog

AI-скиллы для Bitrix Framework (D7): ORM, контроллеры, роутинг, кеш, безопасность. npx skills add bxmaximum/bitrix-framework-skills. Открытый проект сообщества BXMax.

Install
npx -y skills add bxmaximum/bitrix-framework-skills --skill bitrix-catalog

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

3 things to look at

  • 20 days oldThe repository was created 20 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 13 stars13 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Covers Trade Catalog module — products, SKU/offers, prices, inventory, discounts, bundles, export/import, catalog API choice. Applied for e-commerce features requiring prices, stock, and sale integration. Key terms — catalog, product, SKU, offer, price type, CCatalogProduct, catalog module.

SKILL.md

6.2 KB, as published. Nobody here has run it

Trade Catalog Module

Baseline: main 23.0+. Features newer than baseline are marked Since.

Catalog attaches commerce data to iblock elements. Requires iblock + catalog. Cart/orders live in sale — see skill bitrix-sale.

\Bitrix\Main\Loader::includeModule('iblock');
\Bitrix\Main\Loader::includeModule('catalog');

Product ID = iblock element ID. Trade row: b_catalog_product (ProductTable). Prices: b_catalog_price (PriceTable). Catalog↔iblock link: b_catalog_iblock (CatalogIblockTable / CCatalog).

Linking an Iblock to Catalog

Register the product iblock as a catalog:

\CCatalog::Add([
    'IBLOCK_ID' => $productIblockId,
    'YANDEX_EXPORT' => 'N',
    'SUBSCRIPTION' => 'N',
]);

Read binding via ORM:

$row = \Bitrix\Catalog\CatalogIblockTable::getByPrimary($productIblockId)->fetch();
// IBLOCK_ID, PRODUCT_IBLOCK_ID, SKU_PROPERTY_ID, VAT_ID, …

Iblock catalog kinds (CCatalogSku, catalog/general/catalog_sku.php):

ConstantMeaning
TYPE_CATALOG (D)Simple catalog (no SKU)
TYPE_PRODUCT (P)Product iblock with separate offers iblock
TYPE_OFFERS (O)Offers (SKU) iblock
TYPE_FULL (X)Product iblock that itself holds simple products + SKUs
$info = \CCatalogSku::GetInfoByIBlock($iblockId);
// CATALOG_TYPE, PRODUCT_IBLOCK_ID, SKU_PROPERTY_ID, …

Product Types (ProductTable)

Verified in catalog/lib/product.php:

ConstantValueMeaning
TYPE_PRODUCT1Simple product
TYPE_SET2Set / bundle
TYPE_SKU3Parent with offers
TYPE_OFFER4Offer (SKU variant)
TYPE_FREE_OFFER5Offer without parent link
TYPE_EMPTY_SKU6SKU parent without offers
TYPE_SERVICE7Service (no warehouse tracking)
use Bitrix\Catalog\ProductTable;

$product = ProductTable::getByPrimary($elementId, [
    'select' => ['ID', 'TYPE', 'QUANTITY', 'AVAILABLE', 'VAT_ID', 'VAT_INCLUDED'],
])->fetch();

ProductTable::update($elementId, [
    'QUANTITY' => 10,
    'QUANTITY_TRACE' => ProductTable::STATUS_YES,
    'CAN_BUY_ZERO' => ProductTable::STATUS_NO,
]);

Prefer \Bitrix\Catalog\Model\Product for add/update when you need catalog automation (availability, parent SKU type, subscriptions). Legacy: CCatalogProduct.

SKU / Offers Pattern

  1. Product iblock (parents) + offers iblock (variants).
  2. In the offers iblock: property PROPERTY_TYPE = E, LINK_IBLOCK_ID = product iblock (SKU link). Prefer USER_TYPE = SKU (PropertyTable::USER_TYPE_SKU).
  3. Register offers iblock as catalog linked to the product iblock:
\CCatalog::Add([
    'IBLOCK_ID' => $offersIblockId,
    'PRODUCT_IBLOCK_ID' => $productIblockId,
    'SKU_PROPERTY_ID' => $skuPropertyId, // E-property on offers iblock
]);

Parent elements get TYPE_SKU; offer elements get TYPE_OFFER. Customer buys a specific offer (or a simple TYPE_PRODUCT when no SKU).

Prices and Price Types

  • Price type (catalog group): b_catalog_groupBitrix\Catalog\GroupTable (BASE, NAME, …). Access: GroupAccessTable / legacy CCatalogGroup.
  • Price row: Bitrix\Catalog\PriceTablePRODUCT_ID, CATALOG_GROUP_ID, PRICE, CURRENCY, optional QUANTITY_FROM / QUANTITY_TO.
use Bitrix\Catalog\PriceTable;
use Bitrix\Catalog\GroupTable;

$base = GroupTable::getRow(['filter' => ['=BASE' => 'Y']]);

PriceTable::add([
    'PRODUCT_ID' => $elementId,
    'CATALOG_GROUP_ID' => (int)$base['ID'],
    'PRICE' => 1990.00,
    'CURRENCY' => 'RUB',
]);

$prices = PriceTable::getList([
    'filter' => ['=PRODUCT_ID' => $elementId],
    'select' => ['ID', 'PRICE', 'CURRENCY', 'CATALOG_GROUP_ID'],
])->fetchAll();

Legacy write helpers: CPrice. VAT fields live on the product (VAT_ID, VAT_INCLUDED).

Stock and Stores (Overview)

  • Product-level qty: ProductTable fields QUANTITY, QUANTITY_RESERVED, QUANTITY_TRACE, CAN_BUY_ZERO, AVAILABLE.
  • Multi-store: StoreTable (b_catalog_store) + StoreProductTable (b_catalog_store_product: STORE_ID, PRODUCT_ID, AMOUNT, QUANTITY_RESERVED).
  • Documents / batches: StoreDocumentTable, StoreBatchTable, … — use for warehouse ops, not ad-hoc SQL.
use Bitrix\Catalog\StoreProductTable;

$amounts = StoreProductTable::getList([
    'filter' => ['=PRODUCT_ID' => $elementId],
    'select' => ['STORE_ID', 'AMOUNT', 'QUANTITY_RESERVED'],
])->fetchAll();

TYPE_SERVICE products are not warehouse-tracked like ordinary goods.

Boundary with sale

ConcernModule
Product card, type, qty, prices, storescatalog
Basket, order, payment, delivery, shipmentssale

Basket lines reference catalog product/offer IDs; price resolution and discounts may involve both modules. Do not invent cart APIs inside catalog — use skill bitrix-sale.

API Choice

UsePrefer
Read product/price/store rowsProductTable, PriceTable, StoreProductTable, CatalogIblockTable
Write with catalog side effects\Bitrix\Catalog\Model\Product, CCatalog::Add/Update
Legacy admin / compatibilityCCatalogProduct, CPrice, CCatalogSku

Inspect bitrix/modules/catalog/lib/ before adopting newer v2 / REST helpers — confirm against the project kernel.

Performance

  • Batch price/stock updates; avoid per-item CCatalogProduct::GetByID in loops/templates.
  • Cache list queries; warm after bulk import.
  • Load with ORM collections / joins, not N+1.

Checklist

  • iblock + catalog included.
  • Product iblock linked via CCatalog::Add / CatalogIblockTable.
  • SKU: offers iblock + PRODUCT_IBLOCK_ID + SKU_PROPERTY_ID.
  • Types use ProductTable::TYPE_*.
  • Prices via PriceTable / price types (GroupTable).
  • Stock via catalog API / StoreProductTable, not raw SQL.
  • Cart/orders delegated to sale (bitrix-sale).

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.