Answer the question
In order to leave comments, you need to log in
When adding a product through the admin panel, all balances are displayed in the quantity at once. Where can this be fixed?
Good afternoon! I got a project in which a little poked around in the core, now there are some bugs. One of them is adding products in the administrative panel not by 1, but at once all that is, all leftovers. By the OnBeforeBasketAdd event, I see that a new product with QUANTITY = 1 is being formed. The OnBasketAdd event does not work after the product is added to the order. In the order itself, the product appears already with QUANTITY = 932 (the number of leftovers in the warehouse).
Tell me, please, is it possible somehow to intercept this quantity and replace it with 1 when placing an order?
Or at least somehow localize where you can try to catch the error?
PS I would very much not want to touch the core, which has already suffered, but to influence the order from the outside. On the client side, the item is added to the cart correctly.
Answer the question
In order to leave comments, you need to log in
is it possible to somehow intercept this quantity and replace it with 1 when placing an order?You can check this on the order placement event ( OnBeforeOrderAdd ), but this is a crutch to support with another crutch.
Maybe someone will help.
Saved by the OnBeforeSaleBasketItemSetField event. Responds when fields are set via the SetField method.
Next, check if the product was added for the first time through the isNewItem method and set the desired value.
Documentation
https://dev.1c-bitrix.ru/api_d7/bitrix/sale/events...
There is no such submit function. Try onsubmit or via
document.getElementsByTagName('form').addEventListener("submit",function(e){},false);
document.getElementsByTagName('form')[0].addEventListener("submit",function(e){},false);
this is not jquery for you
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question