Setting up the linking of quality documents to 1C-Bitrix products

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    565
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    657
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    980

Quality Documents Attachment to Products Setup in 1C-Bitrix

Quality documents — broader concept than compliance certificates. Includes: TR TS declarations, quality passports, test protocols, SgR (government registration certificates), usage instructions. Each document type has different storage and display requirements.

Document Storage Structure

For flexible attachment of multiple document types, separate infoblock optimal.

"QUALITY_DOCS" Infoblock (standard content type, not catalog):

Property Code Type Description
Document Type DOC_TYPE List Declaration / Certificate / Quality Passport / SgR
File FILE File PDF or image
Document Number DOC_NUMBER String Declaration/certificate number
Valid Until VALID_TO Date Expiration date
Products PRODUCTS Infoblock Link Multiple, product IDs
Trademarks BRANDS Infoblock Link Optional, if covers brand entirely

"One Document — Many Products" Attachment

TR TS declaration usually issued for product series or entire trademark. Property PRODUCTS in documents infoblock is multiple — one document references product list.

On product card output, do reverse query:

$docsRes = \CIBlockElement::GetList(
    ['PROPERTY_VALID_TO' => 'DESC'],
    [
        'IBLOCK_ID'          => QUALITY_DOCS_IBLOCK_ID,
        'PROPERTY_PRODUCTS'  => $productId,
        'ACTIVE'             => 'Y',
    ],
    false,
    false,
    ['ID', 'NAME', 'PROPERTY_DOC_TYPE', 'PROPERTY_FILE',
     'PROPERTY_DOC_NUMBER', 'PROPERTY_VALID_TO']
);
$docs = [];
while ($doc = $docsRes->GetNext()) {
    $docs[] = $doc;
}

Expiration Control

Expired documents can't be shown as current. Processing variants:

Option 1 — Filter in query:

'>=PROPERTY_VALID_TO' => date('d.m.Y')

Option 2 — Auto-deactivation via agent. Create Bitrix agent (table b_agent) that checks expired documents daily and sets ACTIVE = N. Register via \CAgent::AddAgent():

\CAgent::AddAgent(
    '\Local\QualityDocs\Agent::deactivateExpired();',
    'local_quality_docs',
    'N',  // not one-time
    86400 // daily
);

Batch Document Attachment

If attaching one document to hundreds products — manual via admin inconvenient. Create import via CIBlockElement::Update() with PRODUCTS property update. Or create admin page with product search by filter (category, brand) and batch attachment.

For batch attachment of all brand products to document:

$productIds = [];
$res = \CIBlockElement::GetList(
    [],
    ['IBLOCK_ID' => CATALOG_IBLOCK_ID, 'PROPERTY_BRAND' => $brandId],
    false, false, ['ID']
);
while ($row = $res->Fetch()) {
    $productIds[] = ['VALUE' => $row['ID']];
}

\CIBlockElement::SetPropertyValueCode(
    $docElementId,
    'PRODUCTS',
    $productIds
);

Expiring Document Notifications

Useful addition: 30 days before document expiration — notification to responsible manager. Via same agent: find documents with VALID_TO in range today+30 days, send email via \CEvent::Send() with notification template.

Stage Time
Create quality documents infoblock 2–3 h
Product card rework 3–4 h
Agent for expired document deactivation 2–3 h
Batch attachment page (optional) 4–6 h
Expiration notifications (optional) 2–3 h