GOOGLE MERCHANT ISSUES

davidson

New Member
Hi,

I'm, writing this in case some of the G Merchant users encountered this issue and hopefully managed to fix it.
Issue: the GM addon does not generate the feed for all the categories (21 cat. with 3500 prod.). It does work fine for single categories though, and it's worth to mention that it did work before.
This is the googlecatalog.xml content after generating the feed for all categories:
Screenshot 2021-03-05 090943.png
So, anyone dealt with this and managed to fix it? How?

My personal opinion is that 3500 products is too much for the plugin, and that's why it does work for single categories. However, I've been told that the plugin should hold 10000 products.
Tech info:
  1. Raspberry Pi 4 (specs)
  2. NginX 1.14.2
  3. Php 7.3.27
  4. Wordpress 5.6.2
  5. Alidropship plugin 1.8.21
  6. Google Merchant AliDropship Plugin 1.1.14
  7. MySQL 15.1 Distrib 10.3.27-MariaDB
From my side, I have disabled all the other plugins, cleared the cache, checked the php/nginx/mysql error logs (nothing there) etc. The Alidropship team is unfortunately helpless without Cpanel access, so this leads me to my fellow users of this plugin.
Any opinion is also appreciated.
 

Craig Sutcliffe

Active Member
Hi, I myself have been having a major issue with Google merchant add-on, I only had the plugin a couple of months and it was working great, then all of a sudden the "generate feed" just stopped working, I've tried everything, deactivating all plugins and theme, upgrading, downgrading PHP, restoring a backup, working with hosting, it just ain't happening, the only thing I haven't tried is rolling back to previous version because there's nowhere to download load it, my hair has gone grey lol, support are unwilling to help unless you give them wp-admin access, not on!
 

davidson

New Member
I gave them wp-admin access, but they also need Cpanel access and since this is a privately hosted server I'm not willing to pay for a Cpanel license.
 

davidson

New Member
Hi, I myself have been having a major issue with Google merchant add-on
Craig I'm using the code below in a code snippet to generate a products feed for the latest 50 entries. It is not ideal but until the GM is fixed maybe you can make use of it. Seems to be valid for Facebook as well as Google Merchant.
PHP:
/* function to create sitemap.xml file in root directory of site  */
add_action("wp_insert_post", "eg_create_sitemap");
add_action("publish_post", "eg_create_sitemap");
// add_action("publish_page", "eg_create_sitemap");
add_action( "save_post", "eg_create_sitemap" );
function eg_create_sitemap() {
            global $wpdb;
            $post = get_post();
    if ( str_replace( '-', '', get_option( 'gmt_offset' ) ) < 10 ) {
        $tempo = '-0' . str_replace( '-', '', get_option( 'gmt_offset' ) );
    } else {
        $tempo = get_option( 'gmt_offset' );
    }
    if( strlen( $tempo ) == 3 ) { $tempo = $tempo . ':00'; }
    $postsForSitemap = get_posts( array(
        'numberposts' => 50,
        'orderby'     => 'modified',
        'post_type'   => array( 'product' ),
        'order'       => 'DESC'
    ) );
    $sitemap .= '<?xml version="1.0" encoding="UTF-8"?>';
    $sitemap .= "\n" . '<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0"> <channel> <title>GM Products</title> <link>http://gadgets-mall.com</link> <description> The Gadgets Mall is the perfect online store for anyone looking for electronic gadgets, cameras, headphones &amp; earphones, MP3 players, hi-fi speaker systems, GPS devices, smart phones, laptops, tablets, accessories, Alexa and Google devices as well as renewed electronics. </description>' . "\n";
    foreach( $postsForSitemap as $post ) {
        setup_postdata( $post);
        $postdate = explode( " ", $post->post_modified );
        $sitemap .= "\t" . "<item>" . "\n";
    //    $id = $post->ID;
        $sitemap .= "\t\t" . "<g:link>" . get_permalink( $post->ID ) . '</g:link>';
     //   $sitemap .= "\t\t\t<news:publication_date>" . $postdate[0] . 'T' . $postdate[1] . $tempo . " / " . $postdate[0] . 'T' . $postdate[1] . $tempo . "</news:publication_date>\n";
        $sitemap .= "\t\t\t" . '<g:title>' . htmlspecialchars(get_the_title( $post), ENT_XML1 | ENT_QUOTES, 'UTF-8') . '</g:title>' . "\n";
        $sitemap .= "\t" . "<g:id>" . $post->ID . "</g:id>" . "\n";
// htmlspecialchars($string, ENT_XML1 | ENT_QUOTES, 'UTF-8');
        $content = $post->post_content;
        $excerpt = wp_trim_words( $content, 100);
        $sitemap .= "\t\t\t" . '<g:description>' . htmlspecialchars($excerpt, ENT_XML1 | ENT_QUOTES, 'UTF-8');
        $sitemap .= get_the_title( $post) . '</g:description>' . "\n";
            $thumbnail_ID = get_post_thumbnail_id($post->ID);
    $thumbnail = wp_get_attachment_image_src($thumbnail_ID, 'large');
            if (is_array($thumbnail)) {
    $thbm = array_shift(explode('?', $thumbnail[0]));
    //$thbm = str_replace( 'https://', 'https://i0.wp.com/', $thbm );
        $sitemap .= "\t\t\t" . '<g:image_link>' . $thbm . '</g:image_link>' . "\n";

$price = $wpdb->get_row( $wpdb->prepare(
    "SELECT salePrice FROM gm_ads_products WHERE post_id = %d",
    $post->ID
) );
$price = $price->salePrice;
                
$priceold = $wpdb->get_row( $wpdb->prepare(
    "SELECT price FROM gm_ads_products WHERE post_id = %d",
    $post->ID
) );
$priceold = $priceold->price;
            $sitemap .= "\t\t\t" . '<g:price>' . $priceold . ' USD</g:price>' . "\n";
            $sitemap .= "\t\t\t" . '<g:sale_price>' . $price . ' USD</g:sale_price>' . "\n";
        //    $nextyear  = mktime(date("Y")+1);
$newEndingDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($postdate[0])) . " + 31 day"));

$sitemap .= "\t\t\t" . '<g:sale_price_effective_date>' . $postdate[0] . 'T' . $postdate[1] . $tempo . '/' . $newEndingDate . 'T' . $postdate[1] . $tempo . '</g:sale_price_effective_date>' . "\n";
$brand = $wpdb->get_row( $wpdb->prepare(
    "SELECT * FROM gm_ads_attributes WHERE (attr_name LIKE '%Brand Name%' OR attr_value LIKE '%Brand Name%') AND post_id = %d",
    $post->ID
) );
 $brand = $brand->attr_value;
            $sitemap .= "\t\t\t" . '<g:brand>' . htmlspecialchars($brand, ENT_XML1 | ENT_QUOTES, 'UTF-8') . '</g:brand>' . "\n";
$mpn = $wpdb->get_row( $wpdb->prepare(
    "SELECT product_id FROM gm_ads_ali_meta WHERE post_id = %d",
    $post->ID
) );
 $mpn = $mpn->product_id;
            $sitemap .= "\t\t\t" . '<g:mpn>' . $mpn . '</g:mpn>' . "\n";
        }
        $sitemap .= "\t" . '<g:condition>new</g:condition> <g:availability>in stock</g:availability></item>' . "\n";
    }
    $sitemap .= '</channel></rss>';
    $fp = fopen( ABSPATH . "products.xml", 'w' );
    fwrite( $fp, $sitemap );
    fclose( $fp );
}
You can get the Code Snippets here and of course I'm not responsible for any damage blablabla...
 

Craig Sutcliffe

Active Member
I gave them wp-admin access, but they also need Cpanel access and since this is a privately hosted server I'm not willing to pay for a Cpanel license.
Yes mate, I don't have access to cpanel so that wouldn't be happening, but I do have 24/7 support from my hosting who can make changes for me in cpanel, hence the reason I'd expect support here to give me ideas to throw at hosting support.
 

Craig Sutcliffe

Active Member
Craig I'm using the code below in a code snippet to generate a products feed for the latest 50 entries. It is not ideal but until the GM is fixed maybe you can make use of it. Seems to be valid for Facebook as well as Google Merchant.
PHP:
/* function to create sitemap.xml file in root directory of site  */
add_action("wp_insert_post", "eg_create_sitemap");
add_action("publish_post", "eg_create_sitemap");
// add_action("publish_page", "eg_create_sitemap");
add_action( "save_post", "eg_create_sitemap" );
function eg_create_sitemap() {
            global $wpdb;
            $post = get_post();
    if ( str_replace( '-', '', get_option( 'gmt_offset' ) ) < 10 ) {
        $tempo = '-0' . str_replace( '-', '', get_option( 'gmt_offset' ) );
    } else {
        $tempo = get_option( 'gmt_offset' );
    }
    if( strlen( $tempo ) == 3 ) { $tempo = $tempo . ':00'; }
    $postsForSitemap = get_posts( array(
        'numberposts' => 50,
        'orderby'     => 'modified',
        'post_type'   => array( 'product' ),
        'order'       => 'DESC'
    ) );
    $sitemap .= '<?xml version="1.0" encoding="UTF-8"?>';
    $sitemap .= "\n" . '<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0"> <channel> <title>GM Products</title> <link>http://gadgets-mall.com</link> <description> The Gadgets Mall is the perfect online store for anyone looking for electronic gadgets, cameras, headphones &amp; earphones, MP3 players, hi-fi speaker systems, GPS devices, smart phones, laptops, tablets, accessories, Alexa and Google devices as well as renewed electronics. </description>' . "\n";
    foreach( $postsForSitemap as $post ) {
        setup_postdata( $post);
        $postdate = explode( " ", $post->post_modified );
        $sitemap .= "\t" . "<item>" . "\n";
    //    $id = $post->ID;
        $sitemap .= "\t\t" . "<g:link>" . get_permalink( $post->ID ) . '</g:link>';
     //   $sitemap .= "\t\t\t<news:publication_date>" . $postdate[0] . 'T' . $postdate[1] . $tempo . " / " . $postdate[0] . 'T' . $postdate[1] . $tempo . "</news:publication_date>\n";
        $sitemap .= "\t\t\t" . '<g:title>' . htmlspecialchars(get_the_title( $post), ENT_XML1 | ENT_QUOTES, 'UTF-8') . '</g:title>' . "\n";
        $sitemap .= "\t" . "<g:id>" . $post->ID . "</g:id>" . "\n";
// htmlspecialchars($string, ENT_XML1 | ENT_QUOTES, 'UTF-8');
        $content = $post->post_content;
        $excerpt = wp_trim_words( $content, 100);
        $sitemap .= "\t\t\t" . '<g:description>' . htmlspecialchars($excerpt, ENT_XML1 | ENT_QUOTES, 'UTF-8');
        $sitemap .= get_the_title( $post) . '</g:description>' . "\n";
            $thumbnail_ID = get_post_thumbnail_id($post->ID);
    $thumbnail = wp_get_attachment_image_src($thumbnail_ID, 'large');
            if (is_array($thumbnail)) {
    $thbm = array_shift(explode('?', $thumbnail[0]));
    //$thbm = str_replace( 'https://', 'https://i0.wp.com/', $thbm );
        $sitemap .= "\t\t\t" . '<g:image_link>' . $thbm . '</g:image_link>' . "\n";

$price = $wpdb->get_row( $wpdb->prepare(
    "SELECT salePrice FROM gm_ads_products WHERE post_id = %d",
    $post->ID
) );
$price = $price->salePrice;
               
$priceold = $wpdb->get_row( $wpdb->prepare(
    "SELECT price FROM gm_ads_products WHERE post_id = %d",
    $post->ID
) );
$priceold = $priceold->price;
            $sitemap .= "\t\t\t" . '<g:price>' . $priceold . ' USD</g:price>' . "\n";
            $sitemap .= "\t\t\t" . '<g:sale_price>' . $price . ' USD</g:sale_price>' . "\n";
        //    $nextyear  = mktime(date("Y")+1);
$newEndingDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($postdate[0])) . " + 31 day"));

$sitemap .= "\t\t\t" . '<g:sale_price_effective_date>' . $postdate[0] . 'T' . $postdate[1] . $tempo . '/' . $newEndingDate . 'T' . $postdate[1] . $tempo . '</g:sale_price_effective_date>' . "\n";
$brand = $wpdb->get_row( $wpdb->prepare(
    "SELECT * FROM gm_ads_attributes WHERE (attr_name LIKE '%Brand Name%' OR attr_value LIKE '%Brand Name%') AND post_id = %d",
    $post->ID
) );
$brand = $brand->attr_value;
            $sitemap .= "\t\t\t" . '<g:brand>' . htmlspecialchars($brand, ENT_XML1 | ENT_QUOTES, 'UTF-8') . '</g:brand>' . "\n";
$mpn = $wpdb->get_row( $wpdb->prepare(
    "SELECT product_id FROM gm_ads_ali_meta WHERE post_id = %d",
    $post->ID
) );
$mpn = $mpn->product_id;
            $sitemap .= "\t\t\t" . '<g:mpn>' . $mpn . '</g:mpn>' . "\n";
        }
        $sitemap .= "\t" . '<g:condition>new</g:condition> <g:availability>in stock</g:availability></item>' . "\n";
    }
    $sitemap .= '</channel></rss>';
    $fp = fopen( ABSPATH . "products.xml", 'w' );
    fwrite( $fp, $sitemap );
    fclose( $fp );
}
You can get the Code Snippets here and of course I'm not responsible for any damage blablabla...
Thanks allot mate, and your not even support lol.
 

Craig Sutcliffe

Active Member
Yes mate, I couldn't find a previous version to download, I think I originally installed version 1.1.13 when I bought the plugin, so I looked in download history but I must of deleted it and it's nowhere on the forum
 

biavixx

New Member
I'm having trouble with Google Merchant plugin feed as well. All my products were no aproved, aparently because lack of value (price), but all prices are there, the plugin in is not generating a proper feed info.
I called customer service, that gave me a list of things to do, and nothing changed.
 

davidson

New Member
Looks like only me and Craig have this issue so far. Meanwhile, although I've told support several times that I'm on a private server without cpanel, they keep asking for access to my hosting account.
I'd like to know at least:
- what files/folders and their permission are needed for this plugin to function properly
- what would be minimum server requirements (hardware & software) to use this, like for example: for 5000 products you need at least a quadcore, 4gb ram, php 7.3 etcetcetc
If I'd have this, then I'll know for sure it's the script's issue, not my server's.
This is my server btw. I know it doesn't look like much, but it has everything it needs to function properly and trust me, it's a beast :)
IMG_20210306_104816.jpg
 

Craig Sutcliffe

Active Member
There was another post yesterday, someone having the same issue "generate XML" not working, apparently they uninstalled and reinstalled the plugin and it fixed the issue, wish it was that simple for us.
 

davidson

New Member
I've missed that, although I believe the devs did it when they had admin access. I'll try it myself now.
 

chris37

Well-Known Member
Meanwhile, although I've told support several times that I'm on a private server without cpanel, they keep asking for access to my hosting account.
That is normal ! I understand your concerns you have your own private server, you can handle thing yourself and you don't even need cpanel to work with this. But from the time you get third part plugins and themes you have to undestand you must handle things yourself .. the developers they build the plugin for be compatible with 99.9% of wordpress serves ... You are in 00.1 % you must do it yourself (support is not required to help you in this case because you make a custom server yourself)
 

chris37

Well-Known Member
There was another post yesterday, someone having the same issue "generate XML" not working, apparently they uninstalled and reinstalled the plugin and it fixed the issue, wish it was that simple for us.
In your case If you want fast solution I think the only way is to give them access.
I don't see other way here..
 

davidson

New Member
That is normal !
It's not normal m8, because people doing the same thing over and over again and expecting different results are called __________?
support is not required to help you in this case because you make a custom server yourself
Which is more performant than most of 99.9% wordpress hosting servers, so you don't make much sense here. Unless, of course, you are in fact working for this co. and not just a Well-Known Member of this forum ;)
In my case, I can accept that the support can only read a server configuration or whatever they're searching for (and they don't want to ask specifically) from cpanel in black on white, unlike me that I'm doing it from the shell where is white on black. And I've already let them know about giving up, and not even asked for a refund for this plugin. What I don't understand however is why they cannot say the minimal requirements that a server must meet for this plugin to function properly. Although this is probably not the issue either, because as stated before, it worked once. So I'm guessing it is probably an update, ali's or wordpress, that causes it.
ANYWAY
the only reason I've opened this topic was to find help from the other clients/users who might have this issue. And it looks like you are not one of them. In other words, if you cannot help, I must kindly ask you not to reply to my thread as I really don't have time for chit-chat.
Thank you for your understanding.
 

Craig Sutcliffe

Active Member
Just realized, it's not just the "generate XML" not working for me, I can no longer create categories or labels as when you press save, that does nothing, it's the same in Facebook business add-on too
 

chris37

Well-Known Member
Which is more performant than most of 99.9% wordpress hosting servers,
You say it, nobody know ! ;) Myself have a dropshipping website whit 38 plugins have onload loading speed 1,5 second, then I don't believe I must to build the server myself and I run in all of the issue you face now .

I pay 30 dollar a year (and yes you guest it right is having a cpanel us well ;) )
 

chris37

Well-Known Member
Just realized, it's not just the "generate XML" not working for me, I can no longer create categories or labels as when you press save, that does nothing, it's the same in Facebook business add-on too
When you restore your site from backup, did you restore and the database us well?
How you restore it?
 

Craig Sutcliffe

Active Member
Tried restoring every which way Chris mate, it shows how desperate I am, I've just bought the Facebook business add-on as a alternative just to find out I'm having the exact same problems
 
Top