Skip to main content

Re: Search by product code

More
15 years 8 months ago #7896 by jameswadsworth
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.

More
15 years 8 months ago - 15 years 8 months ago #7897 by nicolas
Replied by nicolas on topic Re: Search by product code
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: 15 years 8 months ago by nicolas.

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

More
15 years 8 months ago #7899 by nicolas
Replied by nicolas on topic Re: Search by product code
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.

More
15 years 8 months ago #7922 by jameswadsworth
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.

More
15 years 8 months ago #7923 by jameswadsworth
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.

More
1 year 11 months ago #364345 by HadiTak
Replied by HadiTak on topic Re: Search by product code
Is this feature added in new versions?

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

More
1 year 11 months ago #364346 by nicolas
Replied by nicolas on topic Re: Search by product code
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.096 seconds
Powered by Kunena Forum