Zen Cart Logo
Forums / All Other Contributions/Addons / Google Product Search Feeder II [Support Thread]

Google Product Search Feeder II [Support Thread]

Views: 18,118

Results 1 to 20 of 94
13 Nov 2023, 3:03 PM
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Google Product Search Feeder II [Support Thread]

This is the support thread for the to-be-released shortly Google Product Search Feeder II (aka GPSF-2) plugin.

The plugin has been tested on zc156b through zc158a on PHP versions 7.0 through 8.2 and replaces

I'll post the download link once it's available.

13 Nov 2023, 6:26 PM
#2
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

Thank you for making this available @lat9!

15 Nov 2023, 6:41 PM
#4
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

ZC v1.5.8a
PHP 8.0
GPSF v1.0.0
New install, not converting from a previous version.

Admin > Tools > Google Product Search Feeder II

Generate Feed gives 'Request failed, Gone (410).'

If I remove the currency_code portion from the GET request URL

mydomain.co.uk/gpsf_main_controller.php?key=&feed=fy_un_tp&limit=0&offset=0&currency_code=GBP&language_id=1

to

mydomain.co.uk/gpsf_main_controller.php?key=&feed=fy_un_tp&limit=0&offset=0&language_id=1

The feed is successfully generated, with the currency included together with the price:

<g:price>2.75 GBP</g:price>

I gather that this is correct from Google's point of view and wonder if the '&currency_code=GBP' in the GET request is actually needed.

I might have overthought all of this and there may exist a simple solution.

Edit: this is on a local dev server (WAMP) with self-signed SSL

15 Nov 2023, 10:53 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Google Product Search Feeder II [Support Thread]

Any logs generated? If the $_GET['currency_code'] is set, the processing looks for that in the currencies class.

16 Nov 2023, 9:31 AM
#6
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

lat9:

Any logs generated? If the $_GET['currency_code'] is set, the processing looks for that in the currencies class.

No logs, I'll delve deeper.

19 Nov 2023, 3:20 PM
#7
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

simon1066:

No logs, I'll delve deeper.

Some plonker(me) had added a currency redirect to 410 in .htaccess - when its contents were brought in from another site. All's working now.

19 Nov 2023, 3:36 PM
#8
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

These PHP extension classes are new to me, but as I wanted to create a custom product_type (I used 666 as a test) for category 66 I used this code in a new classes file (includes/classes/gpsf/gpsfKb.php):

<?php
/**
 */
class gpsfKb extends gpsfBase
{
	public function getProductsAttributes(string $products_id, array $product, array $categories_list, $cPath = '66', array $custom_fields): array
    {
        $extension_custom_fields = ['product_type' => '666',];

        return $extension_custom_fields;
    }
}

This works in that it adds the product_type to the feed,

<g:product_type>666</g:product_type>
<g:product_type><![CDATA[Gift Vouchers]]></g:product_type>

I would appreciate some guidance on the code changes needed to replace the already generated product_type rather than add a new one.

I think that this plugin's 'site-specific additions to a product feed' is going to be a stretch for most non-coders, like me, so hopefully this example will get the ball rolling.

19 Nov 2023, 6:24 PM
#9
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

Actually, what I've done hasn't worked as it adds the '666' to all products. Back to the drawing board.

19 Nov 2023, 6:39 PM
#10
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Google Product Search Feeder II [Support Thread]

simon1066:

These PHP extension classes are new to me, but as I wanted to create a custom product_type (I used 666 as a test) for category 66 I used this code in a new classes file (includes/classes/gpsf/gpsfKb.php):

<?php /** */ class gpsfKb extends gpsfBase { public function getProductsAttributes(string $products_id, array $product, array $categories_list, $cPath = '66', array $custom_fields): array { $extension_custom_fields = ['product_type' => '666',]; return $extension_custom_fields; } } ``` > > This works in that it adds the product_type to the feed, > ``` <g:product_type>666</g:product_type> <g:product_type><=!=[=C=D=A=T=A=[Gift Vouchers]=]=></g:product_type> ``` > > I would appreciate some guidance on the code changes needed to replace the already generated product_type rather than add a new one. > > I think that this plugin's '*site-specific additions to a product feed*' is going to be a stretch for most non-coders, like me, so hopefully this example will get the ball rolling. At this point, the **gpsfFeedGenerator **class doesn't acknowledge an override for the product_type, using either a fixed value or a selection from the product's master-category's name 'tree'. I've created a change-request (<https://github.com/lat9/gpsf/issues/11>) on the GPSF GitHub repository.
19 Nov 2023, 6:46 PM
#11
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Google Product Search Feeder II [Support Thread]

simon1066:

Actually, what I've done hasn't worked as it adds the '666' to all products. Back to the drawing board.
Right, you'd need to check the incoming $products_id value and possibly the $product/$categories_list/$cPath arrays to see if the current product 'qualifies' for the change.

For what I think you're trying to do:

public function getProductsAttributes(string $products_id, array $product, array $categories_list, array $cPath, array $custom_fields): array 
    {
        if (!in_array(66, $cPath)) {
            return [];
        }
        $extension_custom_fields = ['product_type' => '666',]; 

        return $extension_custom_fields; 
    } 

That checks to see if categories-id 66 is present in the current product's category-tree, returning the 'product_type' override if so; otherwise, no override is supplied.

20 Nov 2023, 8:38 AM
#12
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

lat9:

Right, you'd need to check the incoming $products_id value and possibly the $product/$categories_list/$cPath arrays to see if the current product 'qualifies' for the change.

For what I think you're trying to do:

public function getProductsAttributes(string $products_id, array $product, array $categories_list, array $cPath, array $custom_fields): array
{
if (!in_array(66, $cPath)) {
return [];
}
$extension_custom_fields = ['product_type' => '666',];

    return $extension_custom_fields; 
} 
> That checks to see if categories-id 66 is present in the current product's category-tree, returning the 'product_type' override if so; otherwise, no override is supplied.

That's great, thanks so much for the pointer/correction.
20 Nov 2023, 8:40 AM
#13
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

lat9:

At this point, the **gpsfFeedGenerator **class doesn't acknowledge an override for the product_type, using either a fixed value or a selection from the product's master-category's name 'tree'. I've created a change-request (https://github.com/lat9/gpsf/issues/11) on the GPSF GitHub repository.

Understood.

20 Nov 2023, 6:57 PM
#14
jeff_mash avatar

jeff_mash

Totally Zenned

Join Date:
Aug 2004
Posts:
732
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

Cindy - Excited to try this one out! I just put it on our site but I'm seeing the following debug error on ALL the products:

Array
(
    [20361] => # SELFIE by Simon R. Stefan & Alex Pandrea - Trick: title cannot be empty
    [25185] => #Augmented (Gimmick and Online Instructions) by Luca Volpe and Renato Cotini - Trick: title cannot be empty
    [21745] => #How by Magic from Holland and Ferry de Riemer - Trick: title cannot be empty
    [35629] => $1.00 Prop Bill (1 bill/$1.00 value) - Realistic Fake Money: title cannot be empty
    [35623] => $10.00 Prop Bill (1 bill/$10.00 value) - Realistic Fake Money: title cannot be empty
    [24025] => $100 bill Silk 36 inch by Magic by Gosh - Trick: title cannot be empty
    [12237] => $100 Bill Switch - Booklet + Gimmick by Royal Magic: title cannot be empty
.....
.....

Any idea what I should be looking at to resolve this?

20 Nov 2023, 7:28 PM
#15
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Google Product Search Feeder II [Support Thread]

Jeff_Mash:

Cindy - Excited to try this one out! I just put it on our site but I'm seeing the following debug error on ALL the products:

Array
(
[20361] => # SELFIE by Simon R. Stefan & Alex Pandrea - Trick: title cannot be empty
[25185] => #Augmented (Gimmick and Online Instructions) by Luca Volpe and Renato Cotini - Trick: title cannot be empty
[21745] => #How by Magic from Holland and Ferry de Riemer - Trick: title cannot be empty
[35629] => $1.00 Prop Bill (1 bill/$1.00 value) - Realistic Fake Money: title cannot be empty
[35623] => $10.00 Prop Bill (1 bill/$10.00 value) - Realistic Fake Money: title cannot be empty
[24025] => $100 bill Silk 36 inch by Magic by Gosh - Trick: title cannot be empty
[12237] => $100 Bill Switch - Booklet + Gimmick by Royal Magic: title cannot be empty
.....
.....

> 
> Any idea what I should be looking at to resolve this?
Are you using products' meta-tag titles as the g:title?  The value's either a product's name (which, for above isn't empty) or the metatags_title.

I might see the issue, darn it.  /includes/classes/gpsfFeedGenerator.php, line 280, change from

if (GPSF_META_TITLE === 'true' && $product['metatags_title'] !== '') {

to

if (GPSF_META_TITLE === 'true' && !empty($product['metatags_title'])) {

... and let me know if that corrects the issue.  That darn metatags_title can be null.
20 Nov 2023, 9:38 PM
#16
jeff_mash avatar

jeff_mash

Totally Zenned

Join Date:
Aug 2004
Posts:
732
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

lat9:

Are you using products' meta-tag titles as the g:title? The value's either a product's name (which, for above isn't empty) or the metatags_title.

I might see the issue, darn it. /includes/classes/gpsfFeedGenerator.php, line 280, change from

if (GPSF_META_TITLE === 'true' && $product['metatags_title'] !== '') {

to

if (GPSF_META_TITLE === 'true' && !empty($product['metatags_title'])) {

... and let me know if that corrects the issue. That darn metatags_title can be null.

BINGO! That fixed the issue!

21 Nov 2023, 1:21 AM
#17
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Google Product Search Feeder II [Support Thread]

Jeff_Mash:

BINGO! That fixed the issue!
Thanks for the validation; I'll get a GitHub issue logged.

GitHub issue: https://github.com/lat9/gpsf/issues/12

24 Dec 2023, 5:06 PM
#18
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

lat9:

At this point, the **gpsfFeedGenerator **class doesn't acknowledge an override for the product_type, using either a fixed value or a selection from the product's master-category's name 'tree'. I've created a change-request (https://github.com/lat9/gpsf/issues/11) on the GPSF GitHub repository.

Your code examples were a great help in enabling me to set up category changes, brand addition and title changes through the use of extensions. However, I jumped the gun a bit in that I didn't fully understand the workings of Google Merchant Center before posting. I now cannot see a need to manipulate the product_type so don't spend time on the Github change, on my account.

12 Jan 2024, 4:06 PM
#19
flappingfish avatar

flappingfish

Zen Follower

Join Date:
Nov 2020
Posts:
318
Plugin Contributions:
3

Re: Google Product Search Feeder II [Support Thread]

hey guys, super happy to have found this module after realising mine is almost ready to fail me completely. Thankyou lat9 for updating this :)

I've just downloaded the zip file and wanted to quickly ask if there is anything that needed updating before i proceed? I assume the github version has been updated to resolve the few issues identified in the thread already?

12 Jan 2024, 4:41 PM
#20
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Google Product Search Feeder II [Support Thread]

Other than the meta-tags' title issue; all others are included in the v1.0.0 version.