SP Virtuemart Ajax Search doesn't show š, đ, č, ć, ž (diacritic symbols)

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
mratkajec
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Thu Mar 25, 2021 2:26 pm

SP Virtuemart Ajax Search doesn't show š, đ, č, ć, ž (diacritic symbols)

Post by mratkajec » Mon Oct 18, 2021 1:36 pm

Hello,
the letters are shown correctly when you're typing them in, but when you get search results, then the letters in search box will be shown as "%C5%A1". Any idea how to solve that?
Everything is set to "UTF-8" charset.

https://getim.eu/dev/em-trgovina/prodaj ... Itemid=541

Regards,
M

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2906
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: SP Virtuemart Ajax Search doesn't show š, đ, č, ć, ž (diacritic symbols)

Post by SharkyKZ » Mon Oct 18, 2021 7:39 pm

VirtueMart encodes search keyword for some reason. You can create an override the of the module layout, decode the keyword and escape it instead. Would need to change this:

Code: Select all

echo JRequest::getVar('keyword')
To this:

Code: Select all

echo htmlspecialchars(urldecode(JRequest::getVar('keyword')), ENT_COMPAT, 'UTF-8')

mratkajec
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Thu Mar 25, 2021 2:26 pm

Re: SP Virtuemart Ajax Search doesn't show š, đ, č, ć, ž (diacritic symbols)

Post by mratkajec » Tue Oct 19, 2021 6:37 am

I have some troubles finding it, I can find that line ...modules/mod_sp_vmsearch but VM search works fine. The problem is in Virtuemart AJAX Search module, and I cannot find that line in ...modules/mod_sp_vmajaxsearch, can you help me just a little more with that?

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2906
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: SP Virtuemart Ajax Search doesn't show š, đ, č, ć, ž (diacritic symbols)

Post by SharkyKZ » Tue Oct 19, 2021 7:10 am

I assumed it's this module https://www.joomshaper.com/joomla-exten ... jax-search.

Look for input with name "keyword" in the layout file. Mine looks like this:

Code: Select all

<input type="text" name="keyword" autocomplete="off" class="sp-vmsearch-box" value="<?php echo JRequest:: getVar('keyword') ?>" />
Do the same operations with item used in value. E.g. if you have this:

Code: Select all

value="<?php echo $app->input->get('keyword, '') ?>"
Change to:

Code: Select all

value="<?php echo htmlspecialchars(urldecode($app->input->get('keyword', '')), ENT_COMPAT, 'UTF-8') ?>"

mratkajec
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Thu Mar 25, 2021 2:26 pm

Re: SP Virtuemart Ajax Search doesn't show š, đ, č, ć, ž (diacritic symbols)

Post by mratkajec » Thu Nov 04, 2021 9:03 am

I was looking in ...modules/mod_sp_vmajaxsearch/tmpl/default.php, I can find "Keyword" only in this file.

Code is looking like:

<input type="text" name="keyword" id="mod_virtuemart_search" class="sp-vmajax-search-input form-control" value="<?php echo $keyword; ?>" placeholder="<?php echo JText::_('MOD_SP_VMAJAXSEARCH_PLACEHOLDER'); ?>" autocomplete="off">

I changed it to:

<input type="text" name="keyword" id="mod_virtuemart_search" class="sp-vmajax-search-input form-control" value="<?php echo htmlspecialchars(urldecode($app->input->get('keyword', '')), ENT_COMPAT, 'UTF-8') ?>" placeholder="<?php echo JText::_('MOD_SP_VMAJAXSEARCH_PLACEHOLDER'); ?>" autocomplete="off">

Still doesn't work...


Locked

Return to “Extensions for Joomla! 3.x”