> For the complete documentation index, see [llms.txt](https://support.morozovpimnev.ru/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.morozovpimnev.ru/retailcrm/sobytiya-khuki.md).

# События (хуки)

Для добавление в отправляемые данные своих данных можно использовать следующие хуки ([подробнее](https://www.hostcms.ru/documentation/modules/core/events/))

<pre class="language-php" data-line-numbers data-full-width="true"><code class="lang-php"><strong>// добавление данных в произвольные поля
</strong><strong>class My_RetailCRM
</strong>{
    static public function onBeforeCreateOrder($controller, $args)
    {
        $oShop_Order = $args[0]; // Shop_Order_Model
        $oRetailCRM = $args[1]; // RetailCRM_Model
        
        /** $args[2] - параметры,
         * добавление параметров в customFields
         */
        $args[2]['customFields']['dop_pole'] = '123';
    }
}

Core_Event::attach('retailCRM_Controller.onBeforeCreateOrder', array('My_RetailCRM', 'onBeforeCreateOrder'));
</code></pre>
