G
G
Ganjubas_Original2017-06-08 11:51:59
PHP
Ganjubas_Original, 2017-06-08 11:51:59

Why can't AddEventHandler work in bitrix?

Code in init.php

AddEventHandler("catalog", "OnDiscountAdd", Array("MyClass", "OnDiscountAddTest"));

class MyClass
{
  function OnDiscountAddTest($arFields)
  {
    var_dump($arFields);
    echo("test");
    exit();
  }
}

Actually, when adding a discount, nothing happens. Where is the mistake. Tried both OnDiscountAdd and OnBeforeDiscountAdd.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Emelyanov, 2017-06-08
@Ganjubas_Original

Try calling the CCatalogDiscount::Add method and see if your handler works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question