/
SQL error, when printing related pages [5.2.1-RC1]
SQL error, when printing related pages [5.2.1-RC1]
Attempting to display related pages on page without proper category_id
being passed in url results in following SQL error:
RuntimeException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND TargetType = 1) OR (Type = 1 AND ( (' at line 5 (1064) SQL: SELECT SourceId, TargetId FROM usn_CatalogRelationships WHERE (Enabled = 1) AND ( (Type = 0 AND SourceId = AND TargetType = 1) OR (Type = 1 AND ( (SourceId = AND TargetType = 1) OR (TargetId = AND SourceType = 1) ) ) ) in ...\core\kernel\utility\logger.php on line 877
This happens, because in code no check is made, that actual category_id
from url does exist in database at all.
Here is the stack trace:
Here is template code, that leads to this error:
<inp2:m_DefineElement name="recommended_page_element"> <li> <a href="<inp2:CategoryLink template='__default__'/>"><inp2:Field name="Name"/></a> </li> </inp2:m_DefineElement> <ul> <inp2:c_PrintList types="related" per_page="-1" parent_cat_id="any" render_as="recommended_page_element"/> </ul>