Answer the question
In order to leave comments, you need to log in
How to override url in template.php?
Dear experts of Bitrix. Such is my question. There is a complex catalog component.
I have a condition in template.php
if($arItem["CODE"] == ""){
$arItem["DETAIL_PAGE_URL"] .= $arItem["NAME"].$arItem["DISPLAY_PROPERTIES"]["SIZE"]["~VALUE"]
}
Answer the question
In order to leave comments, you need to log in
Why should it work?
Well, there is a component A that displays the URL in the template of which this code is written. OK. It outputs this URL.
And there is a component B which displays products by URL. You opened this URL, but how can component B even know that in this particular case it is necessary to search for a product not with the foo150 code, but with the name foo and size 150?
There is no reason for this implementation to work and no way for you to make it work. Those. in principle, this can be done, but it is difficult (suffice it to say that you will have to write your own component) and unnecessary, because even if you need such logic, it can be implemented differently.
Make an element creation and modification interceptor, and if it does not have a code filled in, fill in the code automatically by substituting $arItem["NAME"].$arItem["DISPLAY_PROPERTIES"]["SIZE"]["~VALUE"]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question