Answer the question
In order to leave comments, you need to log in
How isset works?
Good afternoon.
A normal Bitrix developer knows what the following code snippet does:
"ROOT_MENU_TYPE" => isset($arParams["ROOT_MENU_TYPE"]) ? $arParams["ROOT_MENU_TYPE"] : "left",
I have a question: is it possible to refer to the parameter of a product/selling offer in isset? Answer the question
In order to leave comments, you need to log in
Confused question for you, to be honest)
isset in php will return false in several situations:
1. The variable being checked does not exist
2. The variable being checked is set to Null
3. The array key being checked does not exist
4. The array key being checked is set to Null
In other cases, it will return true .
To your question "is it possible to refer to the product/offer parameter in isset?" you can answer yes.
If you need a universal check function for different components, for different templates, then it is better to implement it in the init.php file, and then execute this function in the right places.
Well, that is, in init.php you create a function, for example, isProductInStock($productId), and implement logic there that returns true or false. Then you already use this function where you need it, passing the product ID as a parameter to it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question