Search results, with custom fields data and alias, instead of product name

  • Posts: 59
  • Thank you received: 2
7 years 7 months ago #265849

-- url of the page with the problem -- : www.nails21.com/en/search
-- HikaShop version -- : 2.6.4

Hi,

In our site ( www.nails21.com/en/search ) if we search products, with English Language Selected (it only happens when english is selected), the search results appears with some products, with the title value of a custom field or from the alias field, instead of the name of the product.

We have a local version, and "debugged" it, but the behaviour doesn't happen in localhost..

Does this seems familiar to you?

Try to search "Advance" word when on English language, and the results will be something like the attachment.
When it should be only the Product Name that should appear and not 'soft-color-chrome' that's the alias but the 'Convert colors into chrome/mirror' name.

Thanks,
AllBS

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 7 months ago #265876

Hi,

Edit the "HikaShop Products search plugin in the Joomla plugins manager.
There, you'll find a setting to choose which column of the product data should be used for the search.
If you only want to search on the product name, then only have the product_name column in that setting and that will do it.

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

  • Posts: 59
  • Thank you received: 2
7 years 7 months ago #265929

Hi Nicolas,

thanks for the quick reply.

But i think i didn't explained the situation quite well.

So, our hikashop products search plugin is configured to search in these fields "product_name,product_description".

And after debug, the following query is executed:

SELECT DISTINCT a.product_id AS id, a.product_name, a.product_alias, a.product_canonical, a.product_created AS created ,
a.product_description, "1" AS browsernav, a.product_type, a.product_parent_id, b.category_id as category_id
FROM q5sod_hikashop_product AS a
INNER JOIN q5sod_hikashop_product_category AS b ON a.product_parent_id=b.product_id OR a.product_id=b.product_id
WHERE a.product_published=1 AND (a.product_access = 'all' OR a.product_access LIKE '%,9,%')
AND b.category_id IN (2,67,68,69,......)
AND ((((a.product_name LIKE '%advance%'))) OR (((a.product_description LIKE '%advance%'))) OR (((a.product_code LIKE '%advance%'))))
GROUP BY (a.product_id) ORDER BY a.product_modified DESC


Then on hikashop products plugin, this code is executed:
$row->title=$row->product_name;

But somehow, on the live site the "title" on the search page has that 'soft-color-chrome' when the product name is "SOFT MIRROR POWDER / COLOR CHROME".
We don't know where that "alias" comes from.. and it's not even the alias of that specific product that's "soft-mirror-powder-color-chrome".

It's a very strange issue.

We even thought it could be because of Falang, but after analysis it doesn't seem to be..

What could this be? Do you need access to our backoffice to check it out?

Thanks.

Best regards,
AllBS

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 7 months ago #265943

Hi,

It's easy to check if it comes from your translations or not.
Disable the Falang system plugin via the Joomla plugins manager and try the search again.
If the product name appears correctly with Falang deactivated, then it means that the text you see comes from the translation of the product name that you have in Falang.

Looking at the code of the plugin, I might actually have an idea.
Try changing the code:

							if($item->reference_field=='product_name'){
								$row->product_name=$item->value;
							}elseif($item->reference_field=='product_description'){
								$row->product_description=$item->value;
							}else{
								$row->product_name=$item->value;
							}
							break;
to:
							if($item->reference_field=='product_name'){
								$row->product_name=$item->value;
								break;
							}elseif($item->reference_field=='product_description'){
								$row->product_description=$item->value;
								break;
							}else{
								$row->product_name=$item->value;
							}
and it might help prevent that.

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

  • Posts: 59
  • Thank you received: 2
7 years 7 months ago #266035

Hi Nicolas,

once again, great help :) you pointed to the right direction.

The solution was to take the entire final else:

if($item->reference_field=='product_name'){
	$row->product_name=$item->value;
	break;
}elseif($item->reference_field=='product_description'){
	$row->product_description=$item->value;
	break;
} //else{
//	$row->product_name=$item->value;
//}
//break;
Because we have more than just the product_name and product_description translated. In fact it was the product_alias field, that was showing in the translated Product Title (the last translated field).

Now it shows fine the name of the products :)

Thank you very much.

Regards,
AllBS

Last edit: 7 years 7 months ago by Jerome. Reason: [code] is nice

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 7 months ago #266048

Hi,

Then try like that:

							if($item->reference_field=='product_name'){
								$row->product_name=$item->value;
								break;
							}elseif($item->reference_field=='product_description'){
								$row->product_description=$item->value;
							}else{
								$row->product_name=$item->value;
							}
we need to keep the line $row->product_name=$item->value; as we want to have the matching value replacing the product name on the listing when a match is found on something else than the product_name and that the product_name itself doesn't match.

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

  • Posts: 59
  • Thank you received: 2
7 years 7 months ago #266217

Hi Nicolas,

Tried that way, but still the problem persists..

I didn't had the time to analise this deeply, but the solution i found works for now apparently.

If you come up with the right solution, it would be greatly appreciated :)

Thanks,
Best Regards,
AllBS

The following user(s) said Thank You: jameswadsworth

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 7 months ago #266225

Hi,

Then we would need a FTP and backend access to be able to look at the problem because we're not able to reproduce the problem.
Could you provide that along with a link to this thread via our contact form ?
www.hikashop.com/support/contact-us.html

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
6 years 10 months ago #285882

We have been able to replicate the same issue when products have custom fields. It returns the alias instead of the title. We have modified the code per @allbs suggestion and it seems to work fine. I didn't understand why it is necessary to keep this last line in.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 10 months ago #285888

Hi,

That's because if you remove it, when you search for some text which is in a custom field but not in the product name, you won't see the searched text anywhere on the results listing. So your customers won't understand why the product matched.

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

  • Posts: 32
  • Thank you received: 0
  • Hikashop Business
6 years 5 months ago #293422

The other MAIN problem with using Falang along with Hikashop, that Falang search gives result scanning all translated fields - not only those listed in Hikashop Product Search plugin.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 5 months ago #293441

Hi,

That's not a general problem but actually a bug that no one reported so far.
Thank you for reporting it. I've added a patch for it.
Download again the install package on our website and install it on yours and you'll get the patch to handle that properly.

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

  • Posts: 32
  • Thank you received: 0
  • Hikashop Business
6 years 5 months ago #293474

That's fine now, thanks.

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

  • Posts: 32
  • Thank you received: 0
  • Hikashop Business
6 years 5 months ago #293564

However, we still have to opt out the last 'else', as it was suggested by 'allbs':

if($item->reference_field=='product_name'){
	$row->product_name=$item->value;
	break;
}elseif($item->reference_field=='product_description'){
	$row->product_description=$item->value;
	break;
}//else{
	//$row->product_name=$item->value;
//}
Otherwise, not the product name but some translated other field e.g. product description will be loaded into the forst row as 'product name'.

Last edit: 6 years 5 months ago by Jerome. Reason: [code] tag is nice !!

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

  • Posts: 32
  • Thank you received: 0
  • Hikashop Business
6 years 5 months ago #293640

Furthermore;
When the result comes from Falang's translated field, the path is different.

www.studio-general.hu/index.php/hu/compo...op/sound-devices-688
while without translation /i.e. there is no translated field or original language is active/:
www.studio-general.hu/index.php/en/categories/sound-devices-688

It should be the same, because category-related modules should be loaded in both cases.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 5 months ago #293669

Hi,

Wouldn't that mean that you have different canonical URLs for different languages for the product ?
In that case, you need to check the canonical URLs that you set in the product.

Otherwise, that would mean that you've created a menu item for the English language to display the categories listing of HikaShop and restricted it to the English language and didn't create a similar menu item for Hungarian. In that case, without a menu item, the search plugin can't use the menu item's alias and instead falls back to "component/hikashop" in order to not generate an error when you click on the link.

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

Time to create page: 0.093 seconds
Powered by Kunena Forum