Search for only last 4 characters of product name?

  • Posts: 37
  • Thank you received: 2
13 years 2 weeks ago #29701

Hello everyone,

I am thinking about how to implement the last 4 characters search feature.

Let's say all my products have got 11 characters in a name (numbers). I need the Hikashop plugin to show me the results based on only last 4 characters.

Ex: I have a product like this: 18910678910, so if i am searching for 8910, I only want to see the resalt based on the last 4 characters even if there is another part which contains same characters within the name.

Any advice would be highly appreciated.

ZoomyMan

Please Log in or Create an account to join the conversation.

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
13 years 2 weeks ago #29720

Hi,

You need to edit the search plugin file plugins/search/hikashop_product.php and change
$word = $db->Quote( '%'.$db->getEscaped( $word, true ).'%', false );
to:
$word = $db->Quote( '%'.$db->getEscaped( $word, true ), false );

and:
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
to:
$text = $db->Quote( '%'.$db->getEscaped( $text, true ), false );

Please Log in or Create an account to join the conversation.

  • Posts: 37
  • Thank you received: 2
13 years 2 weeks ago #29909

Thank you Nicolas, works great.

Please Log in or Create an account to join the conversation.

Time to create page: 0.043 seconds
Powered by Kunena Forum