Answer the question
In order to leave comments, you need to log in
Why doesn't the product add event fire?
Good day!
It is necessary to make the following functionality: when adding a product to the sales catalog: create a TP for it. I hang the handler:
AddEventHandler("sale", "OnProductAdd", "OnProductAddHandler");
AddEventHandler("catalog", "OnBeforeProductAdd", "OnProductAddHandler");
Answer the question
In order to leave comments, you need to log in
These events are triggered specifically for adding a PRODUCT to the catalog (ie, for CCatalogProduct::Add ), and you are probably expecting an item to be triggered - that's not how it works. The IB element is not a catalog item. A catalog product is, simply speaking, information about the price of an IB element (there are actually still taxes, units of measurement, etc.) and the event will work when you set a price on the element, because it is at this moment that the catalog product is created.
And you apparently do not add a price, because you want to create a TP.
But this is good - imagine what would happen if it worked? You want to generate a TP for each addition of a product, i.e.... ADD A PRODUCT.
Do you understand what will happen?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question