Jump to content

5.2.3 Google Identifier Exists new code


Dirty Butter

Recommended Posts

I'm trying to see what to do with section of new code in products.export.inc.php, starting at line 104:

Line 104 -----------
From:         $result['google_category'] = $GLOBALS['seo']->getDirectory($result['cat_id'], false, ' > ');
              $result['shopping_com_category'] = $GLOBALS['seo']->getDirectory($result['cat_id'], false, ' -> ');
To:           $result['store_category'] = $GLOBALS['seo']->getDirectory($result['cat_id'], false, ' > ');
              $result['shopping_com_category'] = $GLOBALS['seo']->getDirectory($result['cat_id'], false, ' -> ');
              if (isset($result['mpn']) && empty($result['mpn']) && isset($result['gtin']) && empty($result['gtin'])) {
                $result['identifier_exists'] = 'FALSE';
              } else {
                $result['identifier_exists'] = 'TRUE';
              }

There seems to be an assumption that ALL CC stores would be providing the upc, and/or other product identifiers, so exemptions are only taken into account for mpn and gtin.

 

In our case, since ALL our items are used, almost all are missing all such identifiers as upc, etc. - parents used to cut off all tush tags for safety, and today little ones stroke, suck, and otherwise damage the ones that are left on.

 

SO... for my needs would it be better to comment out everything but 

$result['identifier_exists'] = 'FALSE';

OR should I add similar code to  

if (isset($result['mpn']) && empty($result['mpn']) && isset($result['gtin']) && empty($result['gtin']) ADD MORE HERE?)

for 'upc','ean','jan','isbn'

 

I don't even know what mpn, gtin, ean, and jan mean. I do know that isbn is for books.

 

I doubt I'm the only one who would need to tweak this code.

 

So it would make sense that a book seller might need to add code for those situations where a book is so old it does not have an isbn or upc code, so identifier exists would have a FALSE value.

 

 

 

Link to comment
Share on other sites

Wikipedia has descriptions for the Manufacturer Part Number, Global Trade Item Number, Stock Keeping Unit, Universal Product Code, European Article Number, Japanese Article Number, and the International Standard Book Number.

 

Maybe (I haven't done the research), it is only the case that the "user" of the exported data (i.e., Google) is only interested in MPN and GTIN.

 

Such that, If these two things are empty, then FALSE, otherwise TRUE.

 

Edit: I'm actually going to back away from the following assertion, as a more diligent study of the logic has me doubting what I've said as follows.

===================

(That's not a logical error, but a misstatement of the argument.)

 

Here's the problem I think is happening: If MPN and GTIN are null, then its FALSE, otherwise, one or both must have content, so its TRUE. That's the correct statement of the argument, but that's not how PHP's else clause works.

 

The correct phrasing is: it must be FALSE unless MPN or GTIN has content.

  $result['identifier_exists'] = 'FALSE';

  if (isset($result['mpn']) && !empty($result['mpn'])) $result['identifier_exists'] = 'TRUE';

  if (isset($result['gtin']) && !empty($result['gtin'])) $result['identifier_exists'] = 'TRUE';

===================

 

We will need to do the research to learn exactly what Google needs. If the assumption made above proves false, we need to add other identifiers.

Link to comment
Share on other sites

I am currently marking all "Identifier Exists" as FALSE, and our feed is being accepted. They always warn for the ones that I can't search and locate a brand, and I get a warning for not having the mpn. No warning is seen for other identifiers.

 

I'm logged into my Google account, so I don't know if this link will send you to the full list of what attributes are required or optional, depending on what is sold.

 

https://support.google.com/merchants/answer/1344057?hl=en

Link to comment
Share on other sites

What I don't see is that according to this set of rules, a number of the possible individual identifiers are supposed to be submitted under the GTIN attribute. That is, if you have an ISBN for an item in the Books category, the mapping is to go to 'gtin' and not 'isbn'. The same for 'upc', 'ean', and 'jan', Then, if there is no suitable content for 'gtin', then you would use 'mpn'. So, GTIN and MPN are the only two attributes of concern (see the assumption in post#2).

 

Also, 'identifier_exists' is required if applicable. The presence of this attribute and its value being FALSE is only required when there is no other identifier. This attribute being TRUE is the default.

 

To me, the change in code at line 106 is looking more and more reasonable. Just need to get the mapping straightened out.

Link to comment
Share on other sites

Glad you could see it.

 

With 5.2.2 I tried using FALSE only where I didn't have brand, and that didn't work. The only way I was able to get an acceptable feed was to use FALSE for all, because I don't have upc codes or any other manufacturer product identifier.

 

I'm about to upgrade, so we'll see how that goes for me. As soon as I can, I'll send Google a feed with the stock 5.2.3 code, and we'll see what happens. Maybe someone else will chime in with their results, too.

Link to comment
Share on other sites

I'm going to need help with a query before I can use the Export properly.

 

I had created my own google_product_category column for the MyphpAdmin CubeCart_inventory table. I need to be able to copy all the values from MY google_product_category column to the CC created google_category column.

Link to comment
Share on other sites

I am adding this here as it is related. I have noticed that although in 5.3 they have added the Google category in to the list but the brand part has disappeared and cannot be entered now. You also need brand when uploading to google. How do we get this back.



I am adding this here as it is related. I have noticed that although in 5.3 they have added the Google category in to the list but the brand part has disappeared and cannot be entered now. You also need brand when uploading to google. How do we get this back.

 

Miscellaneous
UPC Code
EAN Code
JAN Code
ISBN Code
GTIN Code
MPN Code
Google Category
Link to comment
Share on other sites

Also on this area I have a lot of handmade items so I am supposed to submit this. Do I just add False to one of the boxes?

In categories where unique product identifiers are required, merchants must submit the ‘identifier exists’ attribute with a value of FALSE when the item does not have unique product identifiers appropriate to its category, such as GTIN, MPN, and brand.

When to include: Required according to the Unique Product Identifier Rules for all target countries except for Canada, India, and Russia. This attribute is recommended for Canada, India, and Russia.

Type Boolean: TRUE or FALSE Text/Tab delimited FALSE XML <g:identifier_exists>FALSE</g:identifier_exists>

Important:

  • When the attribute is not specified, the default value is TRUE.
Link to comment
Share on other sites

Manufacturer and brand have been combined in this version of CC - it never did make sense to input the same thing twice. Google gets the brand as long as you have entered something for manufacturer. We have a lot of None.

 

As for FALSE - if you don't have an mpn or gtin value input, the code automatically chooses FALSE for Identifier Exists, so just leave the product identifiers blank and it takes care of itself.

 

You are going to have to go through all your current products and add the Google Product Category, though. If they all fall in one category, you should be able to accomplish that with a query.

Link to comment
Share on other sites

"the products do not show the Google Category choice on the Product page"

 

Please visit the admin Request Log. There may be an entry where CubeCart requested a list of their category paths. This request is not logged.

 

If CubeCart received this list, CubeCart will use it to display a drop-down selector of that list. (In this one case) It is Smarty's job, while building the drop-down's HTML code, to identify which drop-down option is equal to the product's 'google_category' and add the "selected" attribute to that option.

 

As you learned previously, these paths must match exactly! If there is just one extra or one less space character, there is no match.

 

If CubeCart did not receive a list of categories from Google, CubeCart will display a simple text-entry field. Whatever you manually entered here for the 'google_category', whatever it is, will be shown here.

 

Edit: I've just looked at Google's list: its 5798 lines long! This would be a perfect example to do the sequential drop-down trick:

Choose Main, then the next drop-down contains only Main sub-cats, etc, etc, etc.

 

Some of these category paths are far, far wider than the width of a computer monitor!

Link to comment
Share on other sites

Oh, believe me I'm well aware of how long some of these taxonomies get - we run into that on our estates store.

 

So CC is putting in a call to Google each time to populate their choices for the selection of Google Product?

 

That would explain why the one product I filled in the Google Product FROM the product page, rather than my own system, still shows Please Select, even though the correct wording is in the database.

 

Edit: I've just looked at Google's list: its 5798 lines long! This would be a perfect example to do the sequential drop-down trick:

Choose Main, then the next drop-down contains only Main sub-cats, etc, etc, etc.

 

Some of these category paths are far, far wider than the width of a computer monitor!

 

That's the way Google used to do it on their own site. Then they changed it to a downloadable spreadsheet, which I've saved in Excel.

 

And inputting your own text is NOT going to please Google at all - from what I've seen in the past - they won't accept it. (NOT THE CASE, EVIDENTLY - needs further testing)

 

Long or not, It would be useful to have an echo of that choice showing underneath the Google Product Select line, or at least an acknowledgement that one is in the database. As it stands now, a person who is trying to add this to their products can't tell if they've done this one or not. This turned out to be my use of an out of date taxonomy already in use in a custom table I had previously created.

Link to comment
Share on other sites

"So CC is putting in a call to Google each time to populate their choices for the selection of Google Product?"

 

Not necessarily. The Request (uses the same request mechanism as shipping modules) is not logged, but it is cached.

 

"I filled in the Google Product FROM the product page, and still shows Please Select."

 

Would you please reply with the value as seen in the database. I see no reason why the drop-down would not show the value if that value was found in the list.

Link to comment
Share on other sites

In the admin template file, products.index.php, near line 174, after: </span></div>

 

On a new line, add:

<div><label>Currently:</label><span>{$PRODUCT.google_category|replace:' > ':'<br />'}</span></div>

 

I wonder if the ampersands and less-than characters are getting encoded???

Link to comment
Share on other sites

Your code works, but it's not necessary. My own category table that I used to fill google_category ended with Stuffed Toys, but the current one ends with Stuffed Animals. Once that was fixed in the database with a find/replace query, it does show the category in the choice box.

Link to comment
Share on other sites

I tried the automatic upgrade on the estates kurouto store, and the browser hung after a while. I came back to Admin and it showed as 5.2.3. After checking some files it appeared that the install had gone correctly, and there were no error messages.

 

I didn't find an error until I started working on the Google Product Category. That column did not exist in my database. Since I had a correct one in plushcatalog, I created one. Then I used your query to copy all my taxonomy to the new google_product column, and it worked.

 

It occurred to me while making the copy - Is 250 characters REALLY enough to cover the longest possible Google Category taxonomy, with room for growth, as they constantly change these things?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...