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

Google Product Search Feeder II [Support Thread]

Views: 18,151

Results 61 to 80 of 94
13 Dec 2024, 11:00 AM
#61
lat9 avatar

lat9

Administrator

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

Google Product Search Feeder II [Support Thread]

I'm not a user of the Google Merchant Center's hosted console, so can't help there. If the data's being sent but Google isn't happy, I'll suggest doing a web-search for the symptom. If you've run across it, it's likely that someone else has too.

13 Dec 2024, 1:26 PM
#62
bumba000 avatar

bumba000

Totally Zenned

Join Date:
Feb 2007
Location:
Pennsylvania
Posts:
858
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

Ok. So the issue is resolved. A user in the google merchant center forum caught this....

shipping weight is not a sub attribute of shipping.

Instead of:
<g:shipping>
<g:country>US</g:country>
<g:price>9.95 USD</g:price>
<g:shipping_weight>

it should be:
<g:shipping>
<g:country>US</g:country>
<g:price>9.95 USD</g:price>
</g:shipping>
<g:shipping_weight>3 lb</g:shipping_weight>

So I move a line in the classes/gpsFeedGenerator.php

Moved
if (GPSF_WEIGHT === 'true' && $product['products_weight'] > 0) {
$this->xmlWriter->writeElement('g:shipping_weight', $product['products_weight'] . ' ' . GPSF_UNITS);
}

to just after
$this->xmlWriter->endElement(); //- END g:shipping

All product that had been "missing shipping weight" are now no longer missing shipping weight.

Thank you,
John

13 Dec 2024, 5:23 PM
#63
lat9 avatar

lat9

Administrator

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

Re: Google Product Search Feeder II [Support Thread]

bumba000:

Ok. So the issue is resolved. A user in the google merchant center forum caught this....

shipping weight is not a sub attribute of shipping.

Instead of:
<g:shipping>
<g:country>US</g:country>
<g:price>9.95 USD</g:price>
<g:shipping_weight>

it should be:
<g:shipping>
<g:country>US</g:country>
<g:price>9.95 USD</g:price>
</g:shipping>
<g:shipping_weight>3 lb</g:shipping_weight>

So I move a line in the classes/gpsFeedGenerator.php

Moved
if (GPSF_WEIGHT === 'true' && $product['products_weight'] > 0) {
$this->xmlWriter->writeElement('g:shipping_weight', $product['products_weight'] . ' ' . GPSF_UNITS);
}

to just after
$this->xmlWriter->endElement(); //- END g:shipping

All product that had been "missing shipping weight" are now no longer missing shipping weight.

Thank you,
John
Thanks for the investigation and correction; I'll get that fixed in v1.0.5. Here's the GitHub issue for tracking: https://github.com/lat9/gpsf/issues/46

13 Dec 2024, 6:15 PM
#64
bumba000 avatar

bumba000

Totally Zenned

Join Date:
Feb 2007
Location:
Pennsylvania
Posts:
858
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

Hey Lat9,
No problem. I really didn't want anything to do with uploading products to google but ... I had been doing some price checking in google serps and found they have all of our products (organic results) with a 7-day return period. So I set out on a mission to correct this and found the only way is to updated shipping and returns in merchant center even if you don't already have a merchant center account. But the only way to change your sites return policy is to have a product feed loaded there.

If you think something else is causing the 7-day return period showing in organic google serps please let me know. I have no structured data.. nothing other than now the merchant upload.

Thanks again,
John

16 Dec 2024, 2:42 AM
#65
bumba000 avatar

bumba000

Totally Zenned

Join Date:
Feb 2007
Location:
Pennsylvania
Posts:
858
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

Just to follow up. Rearranging a bit of code worked to resolve the "missing shipping weight" issue, and setting shipping and return policy in google merchant center did reflect in the organic serps.

18 Apr 2025, 8:20 AM
#66
heathenmagic avatar

heathenmagic

Totally Zenned

Join Date:
May 2005
Location:
England
Posts:
733
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

I finally managed to get to zencart 2.10 , I noticed out of 6500 items, it gives a 500 error but no log in folder. I can do 3000 . I Did increase resources on server, and it reflected on the page what I had set. Though on v1.58 version it could do a full batch. As an aside, I do notice when I go store manager and clear logs, then optimise databes, it does a 500 error too. But never done that on prior versions. I thought maybe related as nobody has chimed in about it on this thread about it? I am on same server as with 1.58a. Thanks in advance.

18 Apr 2025, 8:34 AM
#67
shop_suey avatar

shop_suey

Zen Follower

Join Date:
Feb 2014
Location:
Germany
Posts:
375
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

Sorry in advance if it seems spammy.
But what is the advantage in comparison to the successor "Merchant Center Next" for which you don't need to do anything?

No feeds, no cron jobs, no server issues - just a super easy setup at merchant center next.
Google crawls itself daily which works pretty well.

18 Apr 2025, 1:09 PM
#68
lat9 avatar

lat9

Administrator

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

Re: Google Product Search Feeder II [Support Thread]

Shop Suey:

Sorry in advance if it seems spammy.
But what is the advantage in comparison to the successor "Merchant Center Next" for which you don't need to do anything?

No feeds, no cron jobs, no server issues - just a super easy setup at merchant center next.
Google crawls itself daily which works pretty well.
I'm not a Merchant Center user, so I've got no access to view the options of the Merchant Center Next tool.

One thing that GPSF2 provides is a means to restrict the products a site publishes to its product-search-feed.

18 Apr 2025, 9:52 PM
#69
flappingfish avatar

flappingfish

Zen Follower

Join Date:
Nov 2020
Posts:
319
Plugin Contributions:
4

Re: Google Product Search Feeder II [Support Thread]

One thing i noticed for quite some time is that Google "finds" additional products on my behalf on my merchant centre. When in merchant centre on the feeds page it shows a products uploaded by me count of a few thousand and an additional products found by Google count of around 340 items as a clearly displayed metric. Maybe they have subtly upgraded the merchant centre accounts and started auto crawling regardless?

14 Jul 2025, 12:53 PM
#70
nldav avatar

nldav

New Zenner

Join Date:
Jan 2005
Posts:
55
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

I would like to report a bug (and a fix). Case;

[14-Jul-2025 02:43:56 Europe/Amsterdam] Request URI: /gpsf_main_controller.php?key=&language=nl, IP address: x.x.x.x, Language id 4
#1  gpsfFeedGenerator->numinixGetZonesRate() called at [/home/zencart210/includes/classes/gpsfFeedGenerator.php:1200]
#2  gpsfFeedGenerator->getProductsShippingRate() called at [/home/zencart210/includes/classes/gpsfFeedGenerator.php:830]
#3  gpsfFeedGenerator->createBaseProduct() called at [/home/zencart210/includes/classes/gpsfFeedGenerator.php:373]
#4  gpsfFeedGenerator->generateProductsFeed() called at [/home/zencart210/gpsf_main_controller.php:167]
--> PHP Warning: Undefined variable $table_cost in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266.

[14-Jul-2025 02:43:56 Europe/Amsterdam] PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/zencart210/includes/classes/gpsfFeedGenerator.php:1266
Stack trace:
#0 /home/zencart210/includes/classes/gpsfFeedGenerator.php(1200): gpsfFeedGenerator->numinixGetZonesRate()
#1 /home/zencart210/includes/classes/gpsfFeedGenerator.php(830): gpsfFeedGenerator->getProductsShippingRate()
#2 /home/zencart210/includes/classes/gpsfFeedGenerator.php(373): gpsfFeedGenerator->createBaseProduct()
#3 /home/zencart210/gpsf_main_controller.php(167): gpsfFeedGenerator->generateProductsFeed()
#4 {main}
  thrown in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266

[14-Jul-2025 02:43:56 Europe/Amsterdam] Request URI: /gpsf_main_controller.php?key=&language=nl, IP address: x.x.x.x
--> PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/zencart210/includes/classes/gpsfFeedGenerator.php:1266
Stack trace:
#0 /home/zencart210/includes/classes/gpsfFeedGenerator.php(1200): gpsfFeedGenerator->numinixGetZonesRate()
#1 /home/zencart210/includes/classes/gpsfFeedGenerator.php(830): gpsfFeedGenerator->getProductsShippingRate()
#2 /home/zencart210/includes/classes/gpsfFeedGenerator.php(373): gpsfFeedGenerator->createBaseProduct()
#3 /home/zencart210/gpsf_main_controller.php(167): gpsfFeedGenerator->generateProductsFeed()
#4 {main}
  thrown in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266.

[14-Jul-2025 02:43:56 Europe/Amsterdam] Request URI: /gpsf_main_controller.php?key=&language=nl, IP address: x.x.x.x
--> PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/zencart210/includes/classes/gpsfFeedGenerator.php:1266
Stack trace:
#0 /home/zencart210/includes/classes/gpsfFeedGenerator.php(1200): gpsfFeedGenerator->numinixGetZonesRate()
#1 /home/zencart210/includes/classes/gpsfFeedGenerator.php(830): gpsfFeedGenerator->getProductsShippingRate()
#2 /home/zencart210/includes/classes/gpsfFeedGenerator.php(373): gpsfFeedGenerator->createBaseProduct()
#3 /home/zencart210/gpsf_main_controller.php(167): gpsfFeedGenerator->generateProductsFeed()
#4 {main}
  thrown in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266.

problem;

    protected function numinixGetZonesRate($products_weight, $products_price, $table_zone)
    {
        switch (MODULE_SHIPPING_ZONES_METHOD) {
            case 'Price':
                $rate_basis = $products_price;
                break;
            case 'Weight':
                $rate_basis = round($products_weight, 9);
                break;
            case 'Item':
                $rate_basis = 1;
                break;
        }

        $shipping = 0;

        $zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $table_zone);
        $zones_table = preg_split("/[:,]/", $zones_cost);
        for ($i = 0, $n = count($table_cost); $i < $n; $i += 2) {

fix;

for ($i = 0, $n = count($zones_table); $i < $n; $i += 2) {
14 Jul 2025, 12:59 PM
#71
nldav avatar

nldav

New Zenner

Join Date:
Jan 2005
Posts:
55
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

HeathenMagic:

I finally managed to get to zencart 2.10 , I noticed out of 6500 items, it gives a 500 error but no log in folder. I can do 3000 . I Did increase resources on server, and it reflected on the page what I had set. Though on v1.58 version it could do a full batch. As an aside, I do notice when I go store manager and clear logs, then optimise databes, it does a 500 error too. But never done that on prior versions. I thought maybe related as nobody has chimed in about it on this thread about it? I am on same server as with 1.58a. Thanks in advance.

would like to chime out that I experience the same. Its not possible to generate from the admin panel anymore because the performance has degraded .. like.. hhmm.. I do not want to exxagarate but it is at least seven times as slow. In 1.57d it took 4.5 minutes for 80000 products. Now it takes half an hour. I'm using the cron feature now because that one doesnt die. But the performance is poor nevertheless, not sure yet whats causing it.

14 Jul 2025, 1:00 PM
#72
nldav avatar

nldav

New Zenner

Join Date:
Jan 2005
Posts:
55
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

I also would like to report a bug (and a fix). It's already there for quite a while. Case;

[14-Jul-2025 02:43:56 Europe/Amsterdam] Request URI: /gpsf_main_controller.php?key=&language=nl, IP address: x.x.x.x, Language id 4
#1  gpsfFeedGenerator->numinixGetZonesRate() called at [/home/zencart210/includes/classes/gpsfFeedGenerator.php:1200]
#2  gpsfFeedGenerator->getProductsShippingRate() called at [/home/zencart210/includes/classes/gpsfFeedGenerator.php:830]
#3  gpsfFeedGenerator->createBaseProduct() called at [/home/zencart210/includes/classes/gpsfFeedGenerator.php:373]
#4  gpsfFeedGenerator->generateProductsFeed() called at [/home/zencart210/gpsf_main_controller.php:167]
--> PHP Warning: Undefined variable $table_cost in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266.

[14-Jul-2025 02:43:56 Europe/Amsterdam] PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/zencart210/includes/classes/gpsfFeedGenerator.php:1266
Stack trace:
#0 /home/zencart210/includes/classes/gpsfFeedGenerator.php(1200): gpsfFeedGenerator->numinixGetZonesRate()
#1 /home/zencart210/includes/classes/gpsfFeedGenerator.php(830): gpsfFeedGenerator->getProductsShippingRate()
#2 /home/zencart210/includes/classes/gpsfFeedGenerator.php(373): gpsfFeedGenerator->createBaseProduct()
#3 /home/zencart210/gpsf_main_controller.php(167): gpsfFeedGenerator->generateProductsFeed()
#4 {main}
  thrown in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266

[14-Jul-2025 02:43:56 Europe/Amsterdam] Request URI: /gpsf_main_controller.php?key=&language=nl, IP address: x.x.x.x
--> PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/zencart210/includes/classes/gpsfFeedGenerator.php:1266
Stack trace:
#0 /home/zencart210/includes/classes/gpsfFeedGenerator.php(1200): gpsfFeedGenerator->numinixGetZonesRate()
#1 /home/zencart210/includes/classes/gpsfFeedGenerator.php(830): gpsfFeedGenerator->getProductsShippingRate()
#2 /home/zencart210/includes/classes/gpsfFeedGenerator.php(373): gpsfFeedGenerator->createBaseProduct()
#3 /home/zencart210/gpsf_main_controller.php(167): gpsfFeedGenerator->generateProductsFeed()
#4 {main}
  thrown in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266.

[14-Jul-2025 02:43:56 Europe/Amsterdam] Request URI: /gpsf_main_controller.php?key=&language=nl, IP address: x.x.x.x
--> PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/zencart210/includes/classes/gpsfFeedGenerator.php:1266
Stack trace:
#0 /home/zencart210/includes/classes/gpsfFeedGenerator.php(1200): gpsfFeedGenerator->numinixGetZonesRate()
#1 /home/zencart210/includes/classes/gpsfFeedGenerator.php(830): gpsfFeedGenerator->getProductsShippingRate()
#2 /home/zencart210/includes/classes/gpsfFeedGenerator.php(373): gpsfFeedGenerator->createBaseProduct()
#3 /home/zencart210/gpsf_main_controller.php(167): gpsfFeedGenerator->generateProductsFeed()
#4 {main}
  thrown in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266.

problem;

    protected function numinixGetZonesRate($products_weight, $products_price, $table_zone)
    {
        switch (MODULE_SHIPPING_ZONES_METHOD) {
            case 'Price':
                $rate_basis = $products_price;
                break;
            case 'Weight':
                $rate_basis = round($products_weight, 9);
                break;
            case 'Item':
                $rate_basis = 1;
                break;
        }

        $shipping = 0;

        $zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $table_zone);
        $zones_table = preg_split("/[:,]/", $zones_cost);
        for ($i = 0, $n = count($table_cost); $i < $n; $i += 2) {

fix;

for ($i = 0, $n = count($zones_table); $i < $n; $i += 2) {
14 Jul 2025, 1:40 PM
#73
lat9 avatar

lat9

Administrator

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

Re: Google Product Search Feeder II [Support Thread]

nl2dav:

I also would like to report a bug (and a fix). It's already there for quite a while. Case;

[14-Jul-2025 02:43:56 Europe/Amsterdam] Request URI: /gpsf_main_controller.php?key=&language=nl, IP address: x.x.x.x, Language id 4
#1 gpsfFeedGenerator->numinixGetZonesRate() called at [/home/zencart210/includes/classes/gpsfFeedGenerator.php:1200]
#2 gpsfFeedGenerator->getProductsShippingRate() called at [/home/zencart210/includes/classes/gpsfFeedGenerator.php:830]
#3 gpsfFeedGenerator->createBaseProduct() called at [/home/zencart210/includes/classes/gpsfFeedGenerator.php:373]
#4 gpsfFeedGenerator->generateProductsFeed() called at [/home/zencart210/gpsf_main_controller.php:167]
--> PHP Warning: Undefined variable $table_cost in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266.

[14-Jul-2025 02:43:56 Europe/Amsterdam] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/zencart210/includes/classes/gpsfFeedGenerator.php:1266
Stack trace:
#0 /home/zencart210/includes/classes/gpsfFeedGenerator.php(1200): gpsfFeedGenerator->numinixGetZonesRate()
#1 /home/zencart210/includes/classes/gpsfFeedGenerator.php(830): gpsfFeedGenerator->getProductsShippingRate()
#2 /home/zencart210/includes/classes/gpsfFeedGenerator.php(373): gpsfFeedGenerator->createBaseProduct()
#3 /home/zencart210/gpsf_main_controller.php(167): gpsfFeedGenerator->generateProductsFeed()
#4 {main}
thrown in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266

[14-Jul-2025 02:43:56 Europe/Amsterdam] Request URI: /gpsf_main_controller.php?key=&language=nl, IP address: x.x.x.x
--> PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/zencart210/includes/classes/gpsfFeedGenerator.php:1266
Stack trace:
#0 /home/zencart210/includes/classes/gpsfFeedGenerator.php(1200): gpsfFeedGenerator->numinixGetZonesRate()
#1 /home/zencart210/includes/classes/gpsfFeedGenerator.php(830): gpsfFeedGenerator->getProductsShippingRate()
#2 /home/zencart210/includes/classes/gpsfFeedGenerator.php(373): gpsfFeedGenerator->createBaseProduct()
#3 /home/zencart210/gpsf_main_controller.php(167): gpsfFeedGenerator->generateProductsFeed()
#4 {main}
thrown in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266.

[14-Jul-2025 02:43:56 Europe/Amsterdam] Request URI: /gpsf_main_controller.php?key=&language=nl, IP address: x.x.x.x
--> PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/zencart210/includes/classes/gpsfFeedGenerator.php:1266
Stack trace:
#0 /home/zencart210/includes/classes/gpsfFeedGenerator.php(1200): gpsfFeedGenerator->numinixGetZonesRate()
#1 /home/zencart210/includes/classes/gpsfFeedGenerator.php(830): gpsfFeedGenerator->getProductsShippingRate()
#2 /home/zencart210/includes/classes/gpsfFeedGenerator.php(373): gpsfFeedGenerator->createBaseProduct()
#3 /home/zencart210/gpsf_main_controller.php(167): gpsfFeedGenerator->generateProductsFeed()
#4 {main}
thrown in /home/zencart210/includes/classes/gpsfFeedGenerator.php on line 1266.

> 
> problem;
> ```
    protected function numinixGetZonesRate($products_weight, $products_price, $table_zone)
    {
        switch (MODULE_SHIPPING_ZONES_METHOD) {
            case 'Price':
                $rate_basis = $products_price;
                break;
            case 'Weight':
                $rate_basis = round($products_weight, 9);
                break;
            case 'Item':
                $rate_basis = 1;
                break;
        }

        $shipping = 0;

        $zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $table_zone);
        $zones_table = preg_split("/[:,]/", $zones_cost);
        for ($i = 0, $n = count($table_cost); $i < $n; $i += 2) {

fix;

for ($i = 0, $n = count($zones_table); $i < $n; $i += 2) {

Thanks for that; GitHub issue created for tracking: <https://github.com/lat9/gpsf/issues/49>
23 Jul 2025, 1:20 PM
#74
lat9 avatar

lat9

Administrator

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

Re: Google Product Search Feeder II [Support Thread]

v1.0.5 of the plugin is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2379

This release contains changes associated with these GitHub issues:

#45: Enable shipping costs to be set via the Google merchant-center console.
#46: g:shipping_weight isn't a sub-attribute of g:shipping.
#48: g:availability values need underscores.
#49: Correct PHP warning when using numinix Zone Rates.

31 Aug 2025, 2:53 PM
#75
nldav avatar

nldav

New Zenner

Join Date:
Jan 2005
Posts:
55
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

nl2dav:

would like to chime out that I experience the same. Its not possible to generate from the admin panel anymore because the performance has degraded .. like.. hhmm.. I do not want to exxagarate but it is at least seven times as slow. In 1.57d it took 4.5 minutes for 80000 products. Now it takes half an hour. I'm using the cron feature now because that one doesnt die. But the performance is poor nevertheless, not sure yet whats causing it.

After extensive testing I think one of the key problems lies within zen_get_products_base_price somehow. My generation time for the feed are down 38% if I change that particular function (includes/functions/functions_prices.php) to this;

function zen_get_products_base_price($product_id, bool $force_retail_price = false)
{
    global $db, $zco_notifier;

    // Observer pattern
    $products_base_price = 0;
    $base_price_is_handled = false;
    $zco_notifier->notify('ZEN_GET_PRODUCTS_BASE_PRICE', $product_id, $products_base_price, $base_price_is_handled);
    if ($base_price_is_handled === true) {
        return $products_base_price;
    }

    // Fetch product details
    $sql = "SELECT products_price, products_price_w, products_priced_by_attribute
            FROM " . TABLE_PRODUCTS . "
            WHERE products_id = :products_id";
    $sql = $db->bindVars($sql, ':products_id', (int)$product_id, 'integer');
    $product_check = $db->Execute($sql);

    if ($product_check->EOF) {
        return false;
    }

    // Get base price
    if ($force_retail_price === true) {
        $products_price = $product_check->fields['products_price'];
    } else {
        $products_price = zen_get_retail_or_wholesale_price(
            $product_check->fields['products_price'],
            $product_check->fields['products_price_w']
        );
    }

    if ($product_check->fields['products_priced_by_attribute'] !== '1') {
        return $products_price;
    }

    // Fetch attributes
    $sql = "SELECT options_id, price_prefix, options_values_price, options_values_price_w
            FROM " . TABLE_PRODUCTS_ATTRIBUTES . "
            WHERE products_id = :products_id
            AND attributes_display_only != 1
            AND attributes_price_base_included = 1
            ORDER BY options_id,
                CAST(CONCAT(price_prefix, options_values_price) AS decimal(15,4))";
    $sql = $db->bindVars($sql, ':products_id', (int)$product_id, 'integer');
    $results = $db->Execute($sql);

    $the_options_id = null;
    $the_base_price = 0;

    foreach ($results as $result) {
        if ($the_options_id !== $result['options_id']) {
            $the_options_id = $result['options_id'];
            if ($force_retail_price === true) {
                $options_values_price = $result['options_values_price'];
            } else {
                $options_values_price = zen_get_retail_or_wholesale_price(
                    $result['options_values_price'],
                    $result['options_values_price_w']
                );
            }
            $factor = $result['price_prefix'] == '-' ? -1 : 1;
            $the_base_price += $factor * $options_values_price;
        }
    }

    return $products_price + $the_base_price;
}

not going to the ZenCart "Code Suggestions" section yet but eehh ye.. Maybe it helps someone else or would be nice to have some more feedback about performance in general.

1 Sep 2025, 4:17 AM
#76
nldav avatar

nldav

New Zenner

Join Date:
Jan 2005
Posts:
55
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

The other performance problem is in function zen_get_products_special_price . You can find this function in the same file as above (includes/functions/functions_prices.php).

If I change the function to this;

function zen_get_products_special_price($product_id, $specials_price_only = false)
{
    global $db;

    // Fetch only needed fields
    $sql = "SELECT products_model, master_categories_id, products_priced_by_attribute
            FROM " . TABLE_PRODUCTS . "
            WHERE products_id = :products_id";
    $sql = $db->bindVars($sql, ':products_id', (int)$product_id, 'integer');
    $product = $db->Execute($sql);

    if ($product->EOF || Customer::isWholesaleCustomer() === true) {
        return false;
    }
    $product_price = zen_get_products_base_price($product_id);

    $sql = "SELECT specials_new_products_price
            FROM " . TABLE_SPECIALS . "
            WHERE products_id = :products_id AND status = 1";
    $sql = $db->bindVars($sql, ':products_id', (int)$product_id, 'integer');
    $specials = $db->Execute($sql); // Fixed: Removed incorrect parameters
    if (!$specials->EOF) {
        $special_price = $specials->fields['specials_new_products_price'];
    } else {
        $special_price = false;
    }

    if (strpos(($product->fields['products_model'] ?? ''), 'GIFT') === 0) {
        if (!empty($special_price)) {
            return $special_price;
        }
        return false;
    }

    if ($specials_price_only == true) {
        if (!empty($special_price)) {
            return $special_price;
        }
        return false;
    }

    $category = $product->fields['master_categories_id'];
    $sale = zen_get_sale_for_category_and_price($category, $product_price);

    global $zco_notifier;
    $zco_notifier->notify('NOTIFY_ZEN_GET_PRODUCTS_SPECIAL_PRICE', $product->fields, $sale, $product_price);

    if ($sale === false) {
        return $special_price;
    }

    if (!$special_price) {
        $tmp_special_price = $product_price;
    } else {
        $tmp_special_price = $special_price;
    }

    switch ($sale['sale_deduction_type']) {
        case 0:
            $sale_product_price = $product_price - $sale['sale_deduction_value'];
            $sale_special_price = $tmp_special_price - $sale['sale_deduction_value'];
            break;
        case 1:
            $sale_product_price = $product_price - (($product_price * $sale['sale_deduction_value']) / 100);
            $sale_special_price = $tmp_special_price - (($tmp_special_price * $sale['sale_deduction_value']) / 100);
            break;
        case 2:
            $sale_product_price = $sale['sale_deduction_value'];
            $sale_special_price = $sale['sale_deduction_value'];
            break;
        default:
            return $special_price;
    }

    if ($sale_product_price < 0) {
        $sale_product_price = 0;
    }

    if ($sale_special_price < 0) {
        $sale_special_price = 0;
    }

    if (!$special_price) {
        return number_format($sale_product_price, 4, '.', '');
    }

    switch ($sale['sale_specials_condition']) {
        case 0:
            return number_format($sale_product_price, 4, '.', '');
            break;
        case 1:
            return number_format($special_price, 4, '.', '');
            break;
        case 2:
            return number_format($sale_special_price, 4, '.', '');
            break;
        default:
            return number_format($special_price, 4, '.', '');
    }
}

I'm back on 1.5.7 performance levels. And if I dig through and compare code its also logical. 1.5.7 used direct database queries in the functions. 2.1.0 uses a complete class to load -all- Product details from various database tables. This is like using a cannon to kill a fly for these two particular functions. It's way too much overhead.

Either ZenCart >2.1.0 needs to improve on this or the maintainer (lat9) of this plugin need to write these two functions into GPSF and not rely on zen_get_products_base_price/zen_get_products_special_price anymore. The difference in performance is huge.

1 Sep 2025, 7:31 AM
#77
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,875
Plugin Contributions:
7

Re: Google Product Search Feeder II [Support Thread]

2.1.0 uses a complete class to load -all- Product details from various database tables. This is like using a cannon to kill a fly for these two particular functions. It's way too much overhead.

Agreed, I also have had to revert some code elsewhere back to a simple query for the same reason.

3 Sep 2025, 12:26 PM
#78
lat9 avatar

lat9

Administrator

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

Re: Google Product Search Feeder II [Support Thread]

@nl2dav, I've created an issue (https://github.com/zencart/zencart/issues/7223) on Zen Cart's GitHub repository to address this issue; thanks for the report.

5 May 2026, 5:12 PM
#79
jeff_mash avatar

jeff_mash

Totally Zenned

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

Re: Google Product Search Feeder II [Support Thread]

[Delete Post] Problem solved

25 Jun 2026, 3:50 PM
#80
gsh68 avatar

gsh68

Zen Follower

Join Date:
Mar 2011
Posts:
103
Plugin Contributions:
0

Re: Google Product Search Feeder II [Support Thread]

Installed this just now on 1.57c site running php 7.4.33
First run and I get this error.

[25-Jun-2026 16:33:15 Europe/London] PHP Fatal error:  Uncaught Error: Class 'App\Models\PluginControl' not found in /includes/classes/gpsfFeedGenerator.php:103
Stack trace:
#0 /home/xxxx/public_html/xxxxxx/gpsf_main_controller.php(62): gpsfFeedGenerator->__construct()
#1 {main}
  thrown in /home/xxxx/public_html/xxxxxx/includes/classes/gpsfFeedGenerator.php on line 103

[25-Jun-2026 16:33:15 Europe/London] Request URI: /gpsf_main_controller.php?key=&feed=fy_un_tp&limit=0&offset=0&currency_code=GBP&language=en, IP address: xxxxxx
--> PHP Fatal error: Uncaught Error: Class 'App\Models\PluginControl' not found in /home/xxxx/public_html/xxxxxxx/includes/classes/gpsfFeedGenerator.php:103
Stack trace:
#0 /home/xxxx/public_html/xxxxxx/gpsf_main_controller.php(62): gpsfFeedGenerator->__construct()
#1 {main}
  thrown in /home/xxxx/public_html/xxxxxx/includes/classes/gpsfFeedGenerator.php on line 103.

I'm pretty sure everything uploaded.
Any tips?
Cheers.