Answer the question
In order to leave comments, you need to log in
Custom fields in Bitrix CRM documents?
It is necessary to display the values from the product properties in the sales receipt. I found this link , read it, made a custom field in the list of fields.
But I could not find the info, how to assign product properties to the created field? How to find out the ID of the product in the code so that any values can be chained to it?
Here is the code how I added the field to the list of fields.
\Bitrix\Main\EventManager::getInstance()->addEventHandler('documentgenerator', 'onGetDataProviderList', 'orderReceiptGenerator');
function orderReceiptGenerator()
{
\Bitrix\Main\Loader::includeModule('documentgenerator');
class orderReceiptGenerator extends \Bitrix\DocumentGenerator\DataProvider implements \Bitrix\DocumentGenerator\Nameable
{
public function getFields()
{
return [
'CODE' => [
'TITLE' => 'Код',
'VALUE' => function()
{
return 'test';
}
],
];
}
public function isLoaded()
{
return true;
}
public static function getLangName()
{
return 'Код';
}
}
$result['orderReceiptGenerator'] = [
'NAME' => 'Товарный чек (склад)',
'CLASS' => 'orderReceiptGenerator',
'MODULE' => 'documentgenerator',
];
return $result;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question