Hikashop Google Products Plugin Missing Variants?

  • Posts: 250
  • Thank you received: 7
4 years 5 months ago #216509

Hi Nicolas,

It's not clear from your post where I should close the foreach loop, but I have tried a few apparently sensible places.

I'm still getting an SQL error further down...

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND a.category_published=1 AND a.category_type='product' AND b.category_id!=2 ' at line 1 SQL=SELECT DISTINCT b.* FROM ap_hikashop_category AS a LEFT JOIN ap_hikashop_category AS b ON a.category_left >= b.category_left WHERE b.category_right >= a.category_right AND a.category_id IN () AND a.category_published=1 AND a.category_type='product' AND b.category_id!=2 ORDER BY b.category_left

There are no comments in the plugin code and I'm finding it very difficult to figure out what's going on, it looks like the $catlist variable has no value in the SQL statement.

Very frustrating.

Ian

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

  • Posts: 68452
  • Thank you received: 10202
  • MODERATOR
4 years 5 months ago #216522

Hi,

I knew it wouldn't be that simple. As I said, the code isn't made to do what you want.

You need to change the line:
if($row->product_id == $catId->product_id){
to:
if($row->product_parent_id == $catId->product_id){

Then it should fix that query.

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

  • Posts: 250
  • Thank you received: 7
4 years 5 months ago #216589

Hi Nicolas,

Well that's looking better, it runs without errors and Google merchant Centre is importing 630 products instead of 158, it's still reporting some missing attributes and I need to check that the data actually makes sense but it's progress.

Thanks,

Ian

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

  • Posts: 250
  • Thank you received: 7
4 years 5 months ago #216652

Hi Nicolas,

Just one more problem....!

I would like to add the product characteristics to the description field

So for each variant I have a description and two characteristics; UNIT (pad/pack/book/sheet) and SHEETS (number of sheets)

I need a bit of fancy SQL that can retrieve the characteristics for each variant so that I get a description to pass to Google which is something like "Wire Bound Book 50 Sheets"

I can concatenate the strings but the SQL is going to require some joins which are a bit beyond me and I reckon you could do that in your sleep.

Otherwise - IT WORKS!

Thanks,

Ian

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

  • Posts: 68452
  • Thank you received: 10202
  • MODERATOR
4 years 5 months ago #216669

Hi,

You don't need joins.
Just load everything in the tables hikashop_characteristic (results in $characteristics) and hikashop_variant (results in $variants) with two simple selects. You'll need them all anyway since you're extracting all the variants in the XML anyway.
Then, just use some php loops to get your data. For example:

foreach($rows as $row){
 foreach($variants as $variant){
  if($variant->product_id=$row->product_id){
   foreach($characteristics as $characteristic){
    if($characteristic->characteristic_id = $variant->characteristic_id){
     $row->product_description .= $variant->characteristic_value.' ';
    }
   }
  }
 }
}
If you know basic PHP and MySQL, that shouldn't be a problem.

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

  • Posts: 250
  • Thank you received: 7
4 years 5 months ago #217264

Hi Nicolas,

That looping methiod didn't work for me, apart from looking rather inefficient I found I was getting timeouts however I tried to use it so I used some SQL queries.

I do now have a modified plugin that works, I have added characteristic names and values to the description fed to Google, and have also added a check that the parent product is published as the original plugin only looked at the variant's publishing state.

I have also wrapped this up into a separate plugin that can be installed alongside the original so the changes don't get over written.

HOWEVER: I've just read through the changelog of the new version of Hikashop which includes the line ...

"The remarketing plugin now handles products with characteristics"

Is this telling me the feature is in the new version, that the Google products plugin now handles variants?

Regards,

Ian

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

  • Posts: 68452
  • Thank you received: 10202
  • MODERATOR
4 years 5 months ago #217417

Hi,

No. The changelog talks about the remarketing plugin. It's something completely different from the Google Products plugin.

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

  • Posts: 250
  • Thank you received: 7
4 years 5 months ago #217419

Hi Nicolas,

Ok thanks, I hadn't spotted that one at all despite looking for it!

Ian

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

  • Posts: 265
  • Thank you received: 1
4 years 5 months ago #217521

Hello,

It's interesting that the remarketing plugin is being discussed. For those of us using variants of products, it isn't at all useful. To make use of dynamic remarketing, it requires a feed from the Google Merchant Centre.

As the products plugin can't handle variants, there's no feed for the Merchant Centre...

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

  • Posts: 68452
  • Thank you received: 10202
  • MODERATOR
4 years 5 months ago #217526

Hi,

With the current Google Products plugin, when a product has variants it is listed in the XML as one normal product. And that's the same now with the remarketing plugin. Before, that plugin was just creating an error on a product page with characteristics.

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

  • Posts: 250
  • Thank you received: 7
4 years 5 months ago #217728

Hi Nicolas,

Ok, that explains it. It would be so helpful if there was documentation for these plugins, some description text would help, as it isn't obvious what most of them are supposed to do, let alone how to use them.

Holmes-Pierce I have emailed you my version of the Products plugin to try, has it got to you?

Ian

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

  • Posts: 265
  • Thank you received: 1
4 years 5 months ago #217758

Ian: Thank you, that's brilliant. I'm going to get to work straight away and I'll make sure to let you know how I get on.

Nicolas: I'm coming across problems setting up the attributes (Gender and Colour). I'm testing using the old version of the plugin for now.

1) I already have a category for colour, which I use for filtering. Looking at the instructions of the plugin it says I need a custom product field. Is this duplication necessary?

2) Having created a custom product field for testing, it doesn't seem to work. I've made the custom fields (products) with the column name set to "Colours" for one and "Gender" for the other. In the backend listing, I've then set one product to "black" and "female". On triggering a download it just gives the text "Colours" and "Gender" rather than fetching the information.

Could you please let me know how to make this work?

Is there a way to perform a 'mass action' from a category to a custom product field?

Many thanks,
Hal

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

  • Posts: 68452
  • Thank you received: 10202
  • MODERATOR
4 years 5 months ago #217765

Hi,

0. Yes, we're actually working on creating a documentation page listing all the plugins, with some documentation etc. Thanks for your feedback.

1. Well, you could use that custom field for your filter instead of using categories and in that case you wouldn't have a duplication.

2. Did you enter the corresponding column name in the Google Products plugin ? Without screenshots of the settings of your plugin or your custom field, it's hard to say what is wrong. But there must be something with your settings as it's working fine for everyone else.

3. Yes, running a mass action for each category to set the field to each corresponding value should allow you to do that. It's simple, just one filter on the category and one "update the column" action on the custom field column with the value you want in it.

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

  • Posts: 265
  • Thank you received: 1
4 years 5 months ago #217861

Thanks for your reply,

1. I'm reluctant to do that, as some of my products have a variety of colours.

2. For some reason, this has now worked. Someone must be playing with me :)

3. I found the "update the values" and have managed to put it to good use. I must say that it's a bit hit and miss though. It seems to work for some products and not others.

4. A new one. Is there a way to just copy information like "Name", "Description", "Price" so that the main product and variants are identical? In my instance the product is the same, the only variable is size.

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

  • Posts: 68452
  • Thank you received: 10202
  • MODERATOR
4 years 5 months ago #217915

Hi,

1. I don't see the problem. You can have several values selected for a custom field. For example, if you set its type as "checkbox" or "multiple dropdown".

4. If you don't set anything in the name/description/price of your variants, they will automatically use the information from the main product. So there should be no need to copy that data to the variants.

The following user(s) said Thank You: Holmes-Pierce

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

  • Posts: 265
  • Thank you received: 1
4 years 5 months ago #217936

Thank you for your excellent support as always!

1. I'm going to schedule mass actions to copy the information from category to custom field. I think it will be quicker and easier for me when creating a product.

4. That's great news, thanks.

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

  • Posts: 117
  • Thank you received: 3
  • Hikashop Business
4 years 4 months ago #219496

Any News about Variants in Google products xml?

It's a very important feature, mainly to use this file for generating feed for product comparator (shoppydoo, trovaprezzi, and so on)

Is there a way to implement this feature? Is it in the roadmap of hikashop?

People usually find a product adding mpn code or color to the title of product they search. Usually this feature is added like charateristic in a ecommerce. If hikashop can't export variants, we can't pass to merchant (and evven to other product comparator) a lot of important product!!!

Thankyou

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

  • Posts: 250
  • Thank you received: 7
4 years 4 months ago #219500

Hi crealagroup

Thanks for adding your voice to this discussion.

The official line from Hikashop seems to be we don't need variants or it can't be done. I have managed to adapt the plugin and got it working for me with 600 variants, Holmes-Pierce has tried my version and gets time out issues, he has 3000 variants.

It seems to me that this plugin is quite badly written, it reads your product data into arrays and loops through the arrays to find what it wants, so more products means more memory and longer processing, when really the work could be done with smarter SQL queries. This is where resource issues are occurring. As yet I haven't had time to go over the bits that need rewriting ( I'm not an expert programmer and these things take me time to work out ) to see if we can get it working for more variants but I'd be happy to share what I have with Nicolas if he'll undertake to rewrite it to use less resource.

Ian

Last edit: 4 years 4 months ago by iedwards.

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

  • Posts: 117
  • Thank you received: 3
  • Hikashop Business
4 years 4 months ago #219505

Optimum will be to create a ceckbox inside product to decide if you want esxclude product (or single variant) from generation of google feed.

Why don't to split the generation of google xml by category? If you make to generate a singli file.xml for each category, you can limit server resources. It could be a solution.

Merchant consent to import different file and even merge them manually is very fast.

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

  • Posts: 68452
  • Thank you received: 10202
  • MODERATOR
4 years 4 months ago #219539

Hi,

The official line from Hikashop seems to be we don't need variants or it can't be done.

You misunderstood. I've never said that.

I've never said that support for the variants is unnecessary. I agree with you that it would be nice to add.
And I've never said that it can't be done. It is possible to add.
The issue is that it is complex to add to the plugin for several reasons that I already talked about before:
- the code is indeed not adapted for that
- the code is already complex
- the amount of data to handle with variants would be enormous and would create a lot of performance issues, which means that the solution would need to be even more complex
On top of that, so far, the need for that wasn't that important as most people don't use variants and google products at the same time.
But I do recognize that it is important for people who do.
The problem is always a matter of what is the most important for the most people and the amount of time we can dedicate to it.
If you give me a few millions euros, I'll be happy to hire a bunch of developers and work on all the features requests that are waiting on our end. Sine no one did yet, we have to choose.

Thank you for adding your voice to the discussion.

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

Time to create page: 0.097 seconds
Powered by Kunena Forum