Configuring Safety Data Sheet Display for Products in 1C-Bitrix
When loading a batch of chemical products, safety data sheets are often lost, attached to the wrong product, or have incorrect versions. Manual processing takes up to 2 hours per 100 items, and filename errors lead to non-compliance with legal requirements. Automation solves this: we configure info block properties, write a script for mass upload from ZIP, and display the SDS link in the product card. The result — the manager uploads documents in minutes, the buyer sees the current version. Our experience — years of implementations for chemical, paint and varnish, and industrial equipment stores. We guarantee support after launch.
Safety Data Sheet (SDS) is a mandatory document for many categories: chemical substances, varnishes, paints, cleaning agents, industrial gases. In an e-commerce store on Bitrix, the document must be available to the buyer before purchase — this means a PDF in the product card with version control and download capability.
Problems We Solve
Typical difficulties:
- Manual upload of each file — up to 2 hours per 100 products.
- Filename errors: article does not match, SDS attached to wrong product.
- Lack of versioning: unclear if document is current.
- Manual search for products without SDS via admin panel.
We automate the process, reducing upload time by 80% compared to manual attachment. Savings on manager salary are significant.
Organizing Mass Upload of Safety Data Sheets
Document Storage
Safety data sheets are stored in the Bitrix file storage (/upload/) via the main module. The link to the product is through a file-type info block property:
Property SAFETY_DATA_SHEET (type F):
- Multiple: no (one current SDS)
- Required: no (not all products have one)
- Hint: "PDF of safety data sheet (GOST 30333-2007)"
For version control — property SAFETY_DATA_SHEET_DATE (type DateTime).
Script for Mass Upload from ZIP
Safety data sheets often arrive in a ZIP archive from the supplier with filenames based on the article. Our script processes the archive in minutes:
Expand script example
function importSdsDocuments(string $zipPath, int $iblockId): array {
$zip = new \ZipArchive();
$zip->open($zipPath);
$results = ['ok' => 0, 'not_found' => [], 'error' => []];
for ($i = 0; $i < $zip->numFiles; $i++) {
$filename = $zip->getNameIndex($i);
if (!str_ends_with(strtolower($filename), '.pdf')) continue;
preg_match('/^([A-Z0-9\-]+)/i', $filename, $matches);
$article = $matches[1] ?? '';
$product = \CIBlockElement::GetList([], [
'IBLOCK_ID' => $iblockId,
'PROPERTY_ARTICLE' => $article,
], false, ['nPageSize' => 1], ['ID', 'NAME'])->GetNext();
if (!$product) {
$results['not_found'][] = $filename;
continue;
}
$tmpPath = sys_get_temp_dir() . '/' . $filename;
file_put_contents($tmpPath, $zip->getFromIndex($i));
$fileId = \CFile::SaveFile([
'name' => $filename,
'tmp_name' => $tmpPath,
'type' => 'application/pdf',
], 'sds_documents');
if ($fileId) {
\CIBlockElement::SetPropertyValuesEx($product['ID'], $iblockId, [
'SAFETY_DATA_SHEET' => $fileId,
'SAFETY_DATA_SHEET_DATE' => date('d.m.Y'),
]);
$results['ok']++;
}
}
$zip->close();
return $results;
}The script is 5 times faster than manual upload: processes 100 files in 20 minutes instead of 2 hours.
Setup in 4 steps:
- Create properties
SAFETY_DATA_SHEETandSAFETY_DATA_SHEET_DATEin the product info block. - Place the
importSdsDocumentsscript in the administrative section. - Add a link to the SDS in the product card template.
- Set up the report and validation handler.
Checking SDS Presence: Importance and Implementation
Display in the Product Card
In the bitrix:catalog.element template, add this block:
<?php if (!empty($arResult['PROPERTIES']['SAFETY_DATA_SHEET']['VALUE'])): ?>
<?php $sdsFile = \CFile::GetFileArray($arResult['PROPERTIES']['SAFETY_DATA_SHEET']['VALUE']); ?>
<div class="product-sds">
<h4>Safety Documentation</h4>
<a href="<?= \CFile::GetPath($arResult['PROPERTIES']['SAFETY_DATA_SHEET']['VALUE']) ?>" download="<?= htmlspecialchars($sdsFile['ORIGINAL_NAME']) ?>" class="sds-download-btn">
<span class="pdf-icon"></span> Safety Data Sheet (PDF)
<?php if (!empty($arResult['PROPERTIES']['SAFETY_DATA_SHEET_DATE']['VALUE'])): ?>
<small>version from <?= $arResult['PROPERTIES']['SAFETY_DATA_SHEET_DATE']['VALUE'] ?></small>
<?php endif; ?>
</a>
<p class="sds-note">In accordance with <cite>GOST 30333-2007</cite></p>
</div>
<?php endif; ?>The download attribute ensures direct download.
Validation When Adding a Product
For sections where SDS is required (e.g., "Chemicals", "Paints"), use the OnBeforeIBlockElementAdd handler:
AddEventHandler('iblock', 'OnBeforeIBlockElementAdd', function(&$fields) {
$requiredSdsSections = \Bitrix\Main\Config\Option::get('sds_module', 'required_sections', '');
$requiredSectionIds = array_filter(explode(',', $requiredSdsSections));
if (in_array($fields['IBLOCK_SECTION_ID'], $requiredSectionIds)) {
if (empty($fields['PROPERTY_VALUES']['SAFETY_DATA_SHEET'])) {
$GLOBALS['APPLICATION']->ThrowException(
'Attention: for this section it is recommended to attach a safety data sheet.',
'SDS_MISSING'
);
}
}
});
Report for Products Without SDS
An administrative report (GET /bitrix/admin/sds_report.php) shows a list of products from "chemical" sections without an attached SDS, with a quick upload button.
SELECT ie.ID, ie.NAME, s.NAME as section_name
FROM b_iblock_element ie
JOIN b_iblock_section s ON s.ID = ie.IBLOCK_SECTION_ID
LEFT JOIN b_iblock_element_property iep ON iep.IBLOCK_ELEMENT_ID = ie.ID AND iep.IBLOCK_PROPERTY_ID = (
SELECT ID FROM b_iblock_property WHERE IBLOCK_ID = ie.IBLOCK_ID AND CODE = 'SAFETY_DATA_SHEET'
)
WHERE ie.IBLOCK_ID = ? AND ie.ACTIVE = 'Y' AND s.ID IN (/* sections with mandatory SDS */) AND (iep.VALUE IS NULL OR iep.VALUE = '')
ORDER BY s.NAME, ie.NAME;The report allows identifying all products without SDS in a few clicks.
Work Process
| Stage | What we do |
|---|---|
| Analysis | Examine the catalog, identify sections with mandatory SDS, agree on properties |
| Design | Storage schema, upload script, output template, report |
| Implementation | Configure info blocks, script, template, validation handler |
| Testing | On test data, fix errors |
| Deployment | Move to live site, train managers |
What's Included
- Info block properties (SAFETY_DATA_SHEET, SAFETY_DATA_SHEET_DATE)
- Mass upload script from ZIP with error handling
- Display template in product card
- Report for products without SDS
- Documentation and training (1 hour)
- 1 month support
Typical Errors and Checklist
Errors:
- Incorrect filename (article mismatch) — script marks as
not_found. - File exceeds limit (>20 MB) — configure limitations.
- Version date not set — automatically takes current date.
- Forgot to attach SDS manually — validation warns.
Pre-launch checklist:
- [ ] All article names in filenames match products
- [ ] Properties SAFETY_DATA_SHEET and SAFETY_DATA_SHEET_DATE created
- [ ] Sections with mandatory SDS set in options
- [ ] Product card template displays download link
- [ ] Report works and shows correct products
Timeline
| Stage | Duration |
|---|---|
| Configuring info block properties | 0.5 day |
| Mass upload script from ZIP | 1 day |
| Display template in product card | 1 day |
| Report for missing documents | 1 day |
| Testing and deployment | 0.5 day |
| Total | 4 days |
Order turnkey configuration of safety data sheets — get a ready solution in 4 days. Contact us for a consultation and assessment of your project. We guarantee quality and support after launch.

