Re: Search by product code

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
13 years 9 months ago #7896

Business 1.4.5

Hi there,

in the backend you can find at product by product code. In the front end it appears that you can only search by name and description. Am I missing something? If I am not, and search works only for product name and description could I request that you add search by product code as well please.

Thanks, James

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

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
13 years 9 months ago #7897

You're not missing anything. Search is only done on the product name and the product description. We'll add that to the todo list.

Last edit: 13 years 9 months ago by nicolas.

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

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
13 years 9 months ago #7899

In the mean time, you can look at that post where I gave a solution for the keywords search:
www.hikashop.com/en/support/forum/2-gene...-possible-.html#6840
You can just change the name of the field and that should do the job.

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
13 years 9 months ago #7922

Okay thanks for the pointer. I'll add the product code search and post the code.

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
13 years 9 months ago #7923

case 'exact':
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$filters[] = "a.product_name LIKE ".$text;
$filters[] = "a.product_description LIKE ".$text;
$filters[] = "a.product_code LIKE ".$text;
if($multi){
$filters2[] = "b.value LIKE ".$text;
}
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wordFilters = array();
$subWordFilters1 = array();
$subWordFilters2 = array();
$subWordFilters3 = array();
$wordFilters2 = array();
foreach ($words as $word) {
$word = $db->Quote( '%'.$db->getEscaped( $word, true ).'%', false );
$subWordFilters1[] = "a.product_name LIKE ".$word;
$subWordFilters2[] = "a.product_description LIKE ".$word;
$subWordFilters3[] = "a.product_code LIKE ".$word;
if($multi){
$wordFilters2[] = "b.value LIKE ".$word;
}
}
$wordFilters[0]= '(' .implode( ($phrase == 'all' ? ') AND (' : ') OR ('),$subWordFilters1). ')';
$wordFilters[1]= '(' .implode( ($phrase == 'all' ? ') AND (' : ') OR ('),$subWordFilters2). ')';
$wordFilters[2]= '(' .implode( ($phrase == 'all' ? ') AND (' : ') OR ('),$subWordFilters3). ')';
$filters[] = '(' . implode( ') OR (', $wordFilters ) . ')';
if($multi){
$filters2[] = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wordFilters2 ) . ')';
}
break;

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

  • Posts: 17
  • Thank you received: 0
2 weeks 3 days ago #364345

Is this feature added in new versions?

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

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
2 weeks 3 days ago #364346

Hi,

Yes. You have two main ways to provide search on the frontend:

- You can use filters:
www.hikashop.com/support/documentation/1...-filter-listing.html

- You can use Joomla's Smart search:
docs.joomla.org/Smart_Search_quickstart_guide
HikaShop comes with an integration plugin for Smart search, which you can configure via the Joomla plugins manager.

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

Time to create page: 0.072 seconds
Powered by Kunena Forum