diff --git a/falcon/_dev/js/theme/index.js b/falcon/_dev/js/theme/index.js index fa9a71d..323fef8 100644 --- a/falcon/_dev/js/theme/index.js +++ b/falcon/_dev/js/theme/index.js @@ -79,4 +79,19 @@ $(() => { $(".js-select-link").on("change", ({ target }) => { 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); + } + }); }); diff --git a/falcon/templates/catalog/_partials/category-footer.tpl b/falcon/templates/catalog/_partials/category-footer.tpl index c3c07ff..faee68e 100644 --- a/falcon/templates/catalog/_partials/category-footer.tpl +++ b/falcon/templates/catalog/_partials/category-footer.tpl @@ -1,7 +1,15 @@ +{* 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} +
+ \ No newline at end of file