fix(falcon-PS9): prevent 500 error on AJAX filtering by normalizing data
Resolved a Fatal Error occurring during AJAX product listing requests (e.g., price slider). - Issue: In PHP 8.2+, accessing properties of a 'CategoryLazyArray' object using array syntax (dot notation) triggers a Fatal Error. - Cause: The Faceted Search module returns a LazyArray object during XHR requests, whereas standard page loads provide a native array. - Solution: Implemented a normalization block using JSON serialization to flatten the object into a standard associative array. This ensures template syntax compatibility regardless of the request type or property visibility (protected vs public).
This commit is contained in:
@ -1,5 +1,13 @@
|
|||||||
|
{* Defensive: Handles LazyArray objects for category *}
|
||||||
|
{if is_object($category)}
|
||||||
|
{$category = $category|json_encode|json_decode:true}
|
||||||
|
{if isset($category.category)}
|
||||||
|
{$category = $category.category}
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div id="js-product-list-footer">
|
<div id="js-product-list-footer">
|
||||||
{if $category.additional_description && $listing.pagination.items_shown_from == 1}
|
{if isset($category.additional_description) && $category.additional_description && $listing.pagination.items_shown_from == 1}
|
||||||
<div id="category-description-2" class="cms-content my-3">
|
<div id="category-description-2" class="cms-content my-3">
|
||||||
{$category.additional_description nofilter}
|
{$category.additional_description nofilter}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user