From f2a87f4d12ac47f5ff93e60c5050315317923934 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Sat, 4 Oct 2025 13:54:21 +0200 Subject: [PATCH] new: make click in choices of search box load the page of the product --- .../Shop/layout/partials/search.blade.php | 18 +++++++++++++++++- .../views/load/form/autocomplete.blade.php | 7 ++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/resources/views/Shop/layout/partials/search.blade.php b/resources/views/Shop/layout/partials/search.blade.php index 565827aa..edb3bd41 100644 --- a/resources/views/Shop/layout/partials/search.blade.php +++ b/resources/views/Shop/layout/partials/search.blade.php @@ -16,11 +16,27 @@ @push('js') @endpush diff --git a/resources/views/load/form/autocomplete.blade.php b/resources/views/load/form/autocomplete.blade.php index ef12cbee..e8b94167 100644 --- a/resources/views/load/form/autocomplete.blade.php +++ b/resources/views/load/form/autocomplete.blade.php @@ -13,9 +13,10 @@ var id = item.value; $('#' + field).val(id); - if (typeof(callback) != 'undefined') { - var c = callback + '(' + id + ')'; - eval(c); + if (typeof callback === 'function') { + callback.call(this, item, evt); + } else if (typeof callback === 'string' && callback.length && typeof window[callback] === 'function') { + window[callback].call(this, item, evt); } }); }