google products plugin and product category

  • Posts: 18
  • Thank you received: 0
3 years 5 months ago #333373

-- HikaShop version -- : 4.4.2
-- Joomla version -- : 3.9.26
-- PHP version -- : 7.3
-- Browser(s) name and version -- : Chrome 91.0.4472.77

I am trying the google products plugin and it only displays one product.
I see that the problem has to do with the categories. Because this product is also in the main category - under root.

All my other products are in categories that are under the main category. Lets say my products are not direct sub elements of the main category. Is this wrong? Should I include the main category in all the products?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 5 months ago #333374

Hi,

The Google Products plugin automatically list all the products that are:
- with their "access level" set to "all"
- published
- with stock if the "in stock only" setting is activated in the plugin
- linked to at least one published category
If some of your products do not appear in the XML feed generated by the plugin, it means that at least one of the above is false for these products.

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

  • Posts: 18
  • Thank you received: 0
3 years 5 months ago #333393

ΟΚ now I see that the problem is that the products are not set to "all" because there is a group of users that are not supposed to see them.
Can I change the plugin so the products can be included, if the public can access them?
Or for all the products regardless of access

Last edit: 3 years 5 months ago by kathrin20.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 5 months ago #333402

Hi,

You can change the line:

$query = 'SELECT * FROM '.hikashop_table('product').' WHERE product_access=\'all\' AND product_published=1 AND product_type=\'main\'';
to:
$query = 'SELECT * FROM '.hikashop_table('product').' WHERE product_published=1 AND product_type=\'main\'';
in the file plugins/hikashop/google_products/google_products.php and it will list the products regardless of the "access level" of the product.
Note however that it means that Google will reference these products. And thus users that might not be able to see the products on the website will get them on their search results on Google.
Note also that you'll loose the change when you update HikaShop in the future, so you'll have to reapply it.

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

  • Posts: 18
  • Thank you received: 0
3 years 5 months ago #333494

Ok thank you, it works.

Imagine a case where there is retail and wholesale and the wholesale user sees different prices than the normal user or the public. Then the store may want to "hide" some products from the wholesale users, because these products are not available in wholesale prices, so the store restricts the access. However, those products are available in retail, so they can be referenced by Google.
Does this make sense? (I am just describing a case where one would want the products in google even thought there are restrictions. Your solution works fine thank you very much, maybe in the future one could have a choice in the plugin, about this)

Also, is it easy to add another custom field to the xml apart from those that are available in the settings of the plugin?

Thank you in advance.

Last edit: 3 years 5 months ago by kathrin20.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 5 months ago #333518

Hi,

1. It indeed makes sense to be able to list products that are restricted to the guest user group too.
We'll look at improving that in the future.

2. Regarding adding custom fields to the XML, that would require :
- some code modification. Not that difficult for a developer since it should just require a few lines of code to be added in the plugin
- that google's API supports the additional data you're adding in the XML. Otherwise, your custom field might either be ignored, or, even worst, prevent Google from parsing the XML file.

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

  • Posts: 18
  • Thank you received: 0
3 years 5 months ago #333652

Thank you very much for your help

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

Time to create page: 0.062 seconds
Powered by Kunena Forum