product button code in search result

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #172504

-- HikaShop version -- : 2.3.2

Hello,
the search results shows the hikashop product code ( 2|link|picture|menuid:419 ) in the description of articles listed.
This is unpleasant to see for users, is there a way to hide it or make the plugin be parsed before the data is being shown ?

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 11 months ago #172506

Hi,

The best will be to edit the plugin "search | hikashop_products" in order to parse the "$row->text" fields before the return.
I will recommend you to duplicate the plugin otherwise, you will loose your modification with updates ; by creating a new (custom) search plugin, you will be sure that the updates won't modify yours.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #172619

Well, I can try to override the plugin (how?), but don't you think this is a kind of issue for the plugin ?
All the users that exploit the insert-product-button will have this kind of problem ...

Thank you for the suggestion !

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

  • Posts: 13201
  • Thank you received: 2322
10 years 11 months ago #172631

Hi,

Are you sure that this code is not present in your product description ?
By default the plugin return only the product description for the description part of the result.

If it's a variant, thanks to check the product description of this variant.

Else to parse the content, you have to duplicate the plugin, rename it (folder name, file names, file content), and in the function "onSearch()" parse the content after "$row->text=$row->product_description;".

You have to edit the content of "$row->text".

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #172817

The element that contains the insert-product-button code isn't a product, but it's a joomla article that by the insert-product-button code recalls a product, then because this code is present in the description of the article is normal that the search results reports this string as a element description. I think this could be hided or parsed in some manner to avoid people see the coding instead of plain text

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

  • Posts: 84301
  • Thank you received: 13698
  • MODERATOR
10 years 11 months ago #172841

Hi,

The product code plugin of HikaShop parses the whole page and can replace product tags anywhere, even in the search results.
So the problem is actually that something else is stripping out the opening and closing tags without removing the content inside in your search results and thus you see the text.
You can try to trick it like this:

{product}<!-- |2|link|picture|menuid:419| -->{/product}
That way, it should not be a problem for HikaShop to parse the tags and if something else strips the opening and closing tags, the rest will be in a HTML comment and thus not visible.

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #173025

Are you planning to update the plugin with this change ?
Meanwhile could you suggest me where is the code to update ?

Last edit: 10 years 11 months ago by gulp.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 11 months ago #173030

Hi,

There is nothing to edit in the plugins, you just have to edit the Joomla article where this tag has been added.
It's a tag added by HikaShop when you click on the button to display a product in an article.

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #173233

Sure, I know, but I can't think to a simple user that correct the insert-product-button code adding braces inside.
Then I need to override your plugin to always avoid this issue for this site.
I suggest you to a little improve this plugin by:
- adding this braces, if you think it's a good solution for everybody
- make the menu-id selectable with an html-select to let the user quick decide the destination item-id

Could you please suggest where to update the code to add braces ?

Thank you

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

  • Posts: 13201
  • Thank you received: 2322
10 years 11 months ago #173243

Hi,

You have to edit the plugin in "plugins/editors-xtd/hikashopproduct" file "hikashopproduct.php, function "productDisplay()", replace:

document.getElementById('product_insert').value = "{"+"product"+"}";
By:
document.getElementById('product_insert').value = "{"+"product"+"}<!--";
And:
document.getElementById('product_insert').value=document.getElementById('product_insert').value + "{/"+"product"+"}";
By:
document.getElementById('product_insert').value=document.getElementById('product_insert').value + "-->{/"+"product"+"}";

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #173593

It works ! Thanxxx !!
Patch recommended !!

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #173596

No, sorry, it doesn't works fine, because (obviously) the code generated is being commented also on the module that loads the article, then the product code with image and product name doesn't show up !!!! :-(

Last edit: 10 years 11 months ago by gulp.

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 11 months ago #173784

Hi,

I'm afraid that I the patch proposed and the solution explained by Nicolas are not the same.

I was talking about modification in the search plugin...
So please, edit the search plugin and do what I was telling in my first message, I really don't know why they came on such different solution...
I know that my solution will work and won't impact the rest of the website.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #173898

Hi Jerome,
don't you worry about this, the site is still in development then there is no hurry at present, but I would like to solve this issue.
I can't find your suggestion on how to solve it on the search plugin, could you please link it or re-post it here ?

Thank you

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 11 months ago #173988

Hi,

The best will be to edit the plugin "search | hikashop_products" in order to parse the "$row->text" fields before the return.
I will recommend you to duplicate the plugin otherwise, you will loose your modification with updates ; by creating a new (custom) search plugin, you will be sure that the updates won't modify yours.

Like I said in my first message, you have to edit the "search/hikashop_products" plugins ( plugins/search/hikashop_products/hikashop_products.php).
In this file, the plugin prepare the content for the Joomla search component, it returns the product description in the "$row->text" variable.

The idea is to replace the content in this variable in order to remove the tags you don't want to display.
Like
$row->text = preg_replace('#\{product\}.*\{\/product\}#Ui', '', $row->text);

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 10 years 11 months ago by Jerome.

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #174025

Hi, I'm sorry but probably I didn't explained well this issue:
your patch hides the product description on the products records that comes as results of the search,
but the problem isn't on the product records, but in articles records that contains the code.

When the search lists one of these articles it doesn't parses (or hide) the plugin, but let the user view the raw ugly code.
I've attached a screenshot of the typical result when the search find both the product and also an article that contains the product code.

Attachments:

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 11 months ago #174119

Hi,

Oh... Right, I see.

Ok then, you can use the trick that Nicolas gave you in your articles, so you will add an "<!--" and " -->" to hide the content in most cases.
Then, in order to let the product insert plugin works, the best is to add the support for the tags too.

So edit the file "plugins/system/hikashopproductinsert/hikashopproductinsert.php" and replace

if (preg_match_all('#\{product\}(.*)\{\/product\}#Uis', $body, $matches)) {
By
if (preg_match_all('#\{product\}(.*)\{\/product\}#Uis', $body, $matches)) {
  if(!empty($matches[1])) $matches[1] = trim(str_replace(array('<!--','-->'),'',$matches[1]));
It will remove the tags while parsing the data and should display the content correctly afterwards.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #174451

Hello,
I'm sorry to inform you that this code breaks the pages where the articles that contains the product code are loaded,
no errors to report except

(104) Connection reset by peer

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

  • Posts: 12953
  • Thank you received: 1778
10 years 11 months ago #174548

Hello,
The problem is coming from one of your plugin System/search plugin which is hiding the "{product}{/product}" tags, can you unpublish them one by one and tell me if you find the one which is hiding the product tag ?
Thanks.

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #174588

I didn't change anything except for you patch, why should a plugin now try to hide the {product} tag ?
Which kind of plugin ?

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

Time to create page: 0.110 seconds
Powered by Kunena Forum