2 Commits

Author SHA1 Message Date
a128906dc0 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).
2026-01-09 10:52:21 +01:00
ddec414409 fix(falcon-PS9): Auto-format postcode
This removes the annoying error when you type in 8011XD instead of 8011 XD
2026-01-09 10:17:29 +01:00
16 changed files with 101 additions and 176 deletions

View File

@ -1,6 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="18.5" height="20.5" viewBox="0 0 18.5 20.5">
<g id="Icon_feather-shopping-bag" data-name="Icon feather-shopping-bag" transform="translate(-3.75 -2.25)">
<path id="Path_13" data-name="Path 13" d="M7.333,3,4.5,6.8V20.1A1.894,1.894,0,0,0,6.389,22H19.611A1.894,1.894,0,0,0,21.5,20.1V6.8L18.667,3ZM4.5,6.8h17" transform="translate(0 0)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Path_14" data-name="Path 14" d="M19.4,15A3.7,3.7,0,1,1,12,15" transform="translate(-2.7 -4.35)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 713 B

View File

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check2" viewBox="0 0 16 16">
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0"/>
</svg>

Before

Width:  |  Height:  |  Size: 271 B

View File

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="11" height="7" viewBox="0 0 10.828 6.414">
<path d="M1560.845,813.75l4,4-4,4" transform="translate(823.164 -1559.431) rotate(90)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
</svg>

Before

Width:  |  Height:  |  Size: 286 B

View File

@ -1,3 +0,0 @@
<svg width="6" height="10" viewBox="0 0 6 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5 9L1 5L5 1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 212 B

View File

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="7" height="11" viewBox="0 0 6.414 10.828">
<path d="M1560.845,813.75l4,4-4,4" transform="translate(-1559.431 -812.336)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path>
</svg>

Before

Width:  |  Height:  |  Size: 281 B

View File

@ -1,3 +0,0 @@
<svg width="10" height="6" viewBox="0 0 10 6" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 5L5 1L9 5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 212 B

View File

@ -1,3 +0,0 @@
<svg width="16" height="14" viewBox="0 0 16 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 13.2222C0 13.0159 0.0766233 12.8181 0.213013 12.6722C0.349403 12.5264 0.534388 12.4444 0.727273 12.4444H15.2727C15.4656 12.4444 15.6506 12.5264 15.787 12.6722C15.9234 12.8181 16 13.0159 16 13.2222C16 13.4285 15.9234 13.6263 15.787 13.7722C15.6506 13.9181 15.4656 14 15.2727 14H0.727273C0.534388 14 0.349403 13.9181 0.213013 13.7722C0.0766233 13.6263 0 13.4285 0 13.2222ZM0 7C0 6.79372 0.0766233 6.59589 0.213013 6.45003C0.349403 6.30417 0.534388 6.22222 0.727273 6.22222H15.2727C15.4656 6.22222 15.6506 6.30417 15.787 6.45003C15.9234 6.59589 16 6.79372 16 7C16 7.20628 15.9234 7.40411 15.787 7.54997C15.6506 7.69583 15.4656 7.77778 15.2727 7.77778H0.727273C0.534388 7.77778 0.349403 7.69583 0.213013 7.54997C0.0766233 7.40411 0 7.20628 0 7ZM0 0.777778C0 0.571498 0.0766233 0.373668 0.213013 0.227806C0.349403 0.0819444 0.534388 0 0.727273 0H15.2727C15.4656 0 15.6506 0.0819444 15.787 0.227806C15.9234 0.373668 16 0.571498 16 0.777778C16 0.984057 15.9234 1.18189 15.787 1.32775C15.6506 1.47361 15.4656 1.55556 15.2727 1.55556H0.727273C0.534388 1.55556 0.349403 1.47361 0.213013 1.32775C0.0766233 1.18189 0 0.984057 0 0.777778Z" fill="currentColor"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="23.5" height="20.5" viewBox="0 0 23.5 20.5">
<path id="Icon_feather-heart" data-name="Icon feather-heart" d="M22.627,6.177a5.829,5.829,0,0,0-8.188,0l-1.116,1.1-1.116-1.1a5.831,5.831,0,0,0-8.188,0,5.693,5.693,0,0,0,0,8.108l1.116,1.1L13.323,23.5l8.188-8.108,1.116-1.1a5.692,5.692,0,0,0,0-8.108Z" transform="translate(-1.573 -3.747)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
</svg>

Before

Width:  |  Height:  |  Size: 489 B

View File

@ -1,6 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="18.506" height="20.5" viewBox="0 0 18.506 20.5">
<g id="Icon_akar-person" data-name="Icon akar-person" transform="translate(-4.145 -2.25)">
<path id="Path_18" data-name="Path 18" d="M20.4,7.75a4.854,4.854,0,0,1-4.952,4.75A4.854,4.854,0,0,1,10.5,7.75,4.854,4.854,0,0,1,15.452,3,4.854,4.854,0,0,1,20.4,7.75Z" transform="translate(-2.054)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Path_19" data-name="Path 19" d="M18.264,21h.343a2.9,2.9,0,0,1,2.9,2.5l.381,2.968a1.87,1.87,0,0,1-.472,1.493,1.967,1.967,0,0,1-1.459.642H6.845a1.967,1.967,0,0,1-1.46-.643,1.87,1.87,0,0,1-.472-1.493l.38-2.968a2.9,2.9,0,0,1,2.9-2.5h.342" transform="translate(0 -6.6)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 887 B

View File

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="17.867" height="17.867" viewBox="0 0 17.867 17.867">
<path id="Icon_akar-search" data-name="Icon akar-search" d="M18.453,18.453,14.8,14.8m2.022-4.885A6.913,6.913,0,1,1,9.913,3a6.913,6.913,0,0,1,6.913,6.913Z" transform="translate(-2 -2)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2"/>
</svg>

Before

Width:  |  Height:  |  Size: 369 B

View File

@ -1,20 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7_2)">
<g clip-path="url(#clip1_7_2)">
<mask id="mask0_7_2" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="16" height="16">
<path d="M16 0H0V16H16V0Z" fill="white"/>
</mask>
<g mask="url(#mask0_7_2)">
<path d="M2.34315 2.34315C2.53069 2.15561 2.78504 2.05025 3.05026 2.05025C3.31547 2.05025 3.56983 2.15561 3.75736 2.34315L8 6.58579L12.2426 2.34315C12.4302 2.15562 12.6846 2.05023 12.9497 2.05026C13.2149 2.05028 13.4693 2.15561 13.6569 2.34315C13.8444 2.53068 13.9497 2.78507 13.9497 3.05026C13.9498 3.31545 13.8444 3.56983 13.6569 3.75736L9.41422 8L13.6569 12.2426C13.8444 12.4302 13.9498 12.6846 13.9497 12.9497C13.9497 13.2149 13.8444 13.4693 13.6569 13.6569C13.4693 13.8444 13.2149 13.9497 12.9497 13.9497C12.6846 13.9498 12.4302 13.8444 12.2426 13.6569L8 9.41421L3.75736 13.6569C3.56983 13.8444 3.31547 13.9497 3.05026 13.9498C2.78504 13.9497 2.53069 13.8444 2.34315 13.6569C2.15561 13.4693 2.05026 13.215 2.05025 12.9497C2.05026 12.6845 2.15561 12.4302 2.34315 12.2426L6.58579 8L2.34315 3.75736C2.15561 3.56982 2.05026 3.31547 2.05025 3.05025C2.05026 2.78504 2.15561 2.53068 2.34315 2.34315Z" fill="currentColor"/>
</g>
</g>
</g>
<defs>
<clipPath id="clip0_7_2">
<rect width="16" height="16" fill="white"/>
</clipPath>
<clipPath id="clip1_7_2">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,108 +1,90 @@
import $ from "jquery"; import $ from 'jquery';
import prestashop from "prestashop"; import prestashop from 'prestashop';
$(() => { $(() => {
const createInputFile = () => { const createInputFile = () => {
$(".js-file-input").on("change", (event) => { $('.js-file-input').on('change', (event) => {
const target = $(event.currentTarget)[0]; const target = $(event.currentTarget)[0];
const file = target ? target.files[0] : null; const file = (target) ? target.files[0] : null;
if (target && file) { if (target && file) {
$(target).prev().text(file.name); $(target).prev().text(file.name);
} }
}); });
}; };
const createProductSpin = () => { const createProductSpin = () => {
const $quantityInput = $("#quantity_wanted"); const $quantityInput = $('#quantity_wanted');
$quantityInput.TouchSpin({ $quantityInput.TouchSpin({
min: parseInt($quantityInput.attr("min"), 10), verticalupclass: 'material-icons touchspin-up',
max: 1000000, verticaldownclass: 'material-icons touchspin-down',
verticalbuttons: true, buttondown_class: 'btn btn-touchspin js-touchspin',
verticalupclass: "btn btn-touchspin js-touchspin", buttonup_class: 'btn btn-touchspin js-touchspin',
verticaldownclass: "btn btn-touchspin js-touchspin", min: parseInt($quantityInput.attr('min'), 10),
verticalup: max: 1000000,
'<img src="/themes/falcon/_dev/img/chevron_up.svg" alt="Up" />', });
verticaldown:
'<img src="/themes/falcon/_dev/img/chevron_down.svg" alt="Down" />',
});
$quantityInput.on("focusout", () => { $quantityInput.on('focusout', () => {
if ( if ($quantityInput.val() === '' || $quantityInput.val() < $quantityInput.attr('min')) {
$quantityInput.val() === "" || $quantityInput.val($quantityInput.attr('min'));
$quantityInput.val() < $quantityInput.attr("min") $quantityInput.trigger('change');
) { }
$quantityInput.val($quantityInput.attr("min")); });
$quantityInput.trigger("change");
}
});
$("body").on("change keyup", "#quantity_wanted", (event) => { $('body').on('change keyup', '#quantity_wanted', (event) => {
$(event.currentTarget).trigger("touchspin.stopspin"); $(event.currentTarget).trigger('touchspin.stopspin');
prestashop.emit("updateProduct", { prestashop.emit('updateProduct', {
eventType: "updatedProductQuantity", eventType: 'updatedProductQuantity',
event, event,
}); });
}); });
}; };
createProductSpin(); createProductSpin();
createInputFile();
let updateEvenType = false;
prestashop.on('updateProduct', ({ eventType }) => {
updateEvenType = eventType;
});
prestashop.on('updateCart', (event) => {
if (
prestashop.page.page_name === 'product'
&& parseInt(event.reason.idProduct, 10) === parseInt($('#add-to-cart-or-refresh').find('[name="id_product"]').val(), 10)) {
prestashop.emit('updateProduct', {
event,
resp: {},
reason: {
productUrl: prestashop.urls.pages.product || '',
},
});
}
});
prestashop.on('updatedProduct', (event) => {
createInputFile(); createInputFile();
let updateEvenType = false;
prestashop.on("updateProduct", ({ eventType }) => { if (event && event.product_minimal_quantity) {
updateEvenType = eventType; const minimalProductQuantity = parseInt(event.product_minimal_quantity, 10);
}); const quantityInputSelector = '#quantity_wanted';
const quantityInput = $(quantityInputSelector);
prestashop.on("updateCart", (event) => { // @see http://www.virtuosoft.eu/code/bootstrap-touchspin/ about Bootstrap TouchSpin
if ( quantityInput.trigger('touchspin.updatesettings', {
prestashop.page.page_name === "product" && min: minimalProductQuantity,
parseInt(event.reason.idProduct, 10) === });
parseInt( }
$("#add-to-cart-or-refresh")
.find('[name="id_product"]')
.val(),
10
)
) {
prestashop.emit("updateProduct", {
event,
resp: {},
reason: {
productUrl: prestashop.urls.pages.product || "",
},
});
}
});
prestashop.on("updatedProduct", (event) => { if (updateEvenType === 'updatedProductCombination') {
createInputFile(); $('.js-product-images').replaceWith(event.product_cover_thumbnails);
$('.js-product-images-modal').replaceWith(event.product_images_modal);
prestashop.emit('updatedProductCombination', event);
}
if (event && event.product_minimal_quantity) { updateEvenType = false;
const minimalProductQuantity = parseInt(
event.product_minimal_quantity,
10
);
const quantityInputSelector = "#quantity_wanted";
const quantityInput = $(quantityInputSelector);
// @see http://www.virtuosoft.eu/code/bootstrap-touchspin/ about Bootstrap TouchSpin prestashop.pageLazyLoad.update();
quantityInput.trigger("touchspin.updatesettings", { });
min: minimalProductQuantity,
});
}
if (updateEvenType === "updatedProductCombination") {
$(".js-product-images").replaceWith(event.product_cover_thumbnails);
$(".js-product-images-modal").replaceWith(
event.product_images_modal
);
prestashop.emit("updatedProductCombination", event);
}
updateEvenType = false;
prestashop.pageLazyLoad.update();
});
}); });

View File

@ -79,4 +79,19 @@ $(() => {
$(".js-select-link").on("change", ({ target }) => { $(".js-select-link").on("change", ({ target }) => {
window.location.href = $(target).val(); window.location.href = $(target).val();
}); });
// Postcode input formatting
const $postCodeInput = $("input[name='postcode']");
$postCodeInput.on("input", function () {
let value = $(this).val();
// Match 4 digits followed by 2 letters (e.g., 1234AB)
const match = value.match(/^(\d{4})([a-zA-Z]{2})$/);
if (match) {
// Add space between numbers and letters
const formatted = `${match[1]} ${match[2]}`;
$(this).val(formatted);
}
});
}); });

View File

@ -1,19 +0,0 @@
<div class="col flex-grow-0 header-top__block header-top__block--favorite js-favorite-top-content">
<a
class="header-top__link"
rel="nofollow"
href="{$favoritePageUrl}"
>
<div class="header-top__icon-container">
{capture name="svg_output"}{svg_icon file='heart.svg'}{/capture}
{if $smarty.capture.svg_output}
{$smarty.capture.svg_output nofilter}
{else}
<span class="header-top__icon material-icons">favorite</span>
{/if}
<span class="header-top__badge">
{$favoriteProductsCount}
</span>
</div>
</a>
</div>

View File

@ -20,11 +20,6 @@
{if $node.open_in_new_window} target="_blank" {/if} {if $node.open_in_new_window} target="_blank" {/if}
> >
<span class="align-self-center">{$node.label}</span> <span class="align-self-center">{$node.label}</span>
{if $node.children|count}
<span class="d-none d-md-block pl-1" style="margin-bottom: 3px;">
{svg_icon file='chevron_down.svg' }
</span>
{/if}
</a> </a>
{if $node.children|count} {if $node.children|count}
{* Cannot use page identifier as we can have the same page several times *} {* Cannot use page identifier as we can have the same page several times *}

View File

@ -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>