How to generate XML feed for over 30k products on Google Merchant Center?

How to generate XML feed for over 30k products on Google Merchant Center?

adnan-mallik
Shopify Partner
6 1 6

Hi,
       I'm currently working in app which generate XML Feed for google merchant center. I'm doing this by creating Shopify pages. For single page Shopify returns 1000 products so if I have a store which contains almost 30k products then there will be the 30 pages request to Shopify to get all products from Shopify.

Currently my code is working for 4k products but It mean I can only make 4 request at a time but for a 5th request Shopify not giving response I don't know why may be there are limitation for each request.

Below is the code in which I'm making request for each page.
Note: $pages contains the all pages URLs which I'm hitting 

foreach ($pages as $page) :
            sleep(4);
            $response       = HTTP::get($page);
            $response       = str_replace('g:','',$response->body());
            $xml            = @simplexml_load_string($response, 'SimpleXMLElement',LIBXML_NOCDATA | LIBXML_NOBLANKS | LIBXML_BIGLINES );
            $json           = json_encode($xml);
            $phpArray       = json_decode($json, true);
            if(isset($phpArray['channel']) && isset($phpArray['channel']['item']) && count($phpArray['channel']['item']) > 0):
                $obj_merged = array_merge($obj_merged, $phpArray['channel']['item']);
            else:
                break;
            endif;
        endforeach;

------------------------------------------------------------------
As you can see I used a sleep method to delay between each request but its also not working


can you tell me the what is the issue?

  

Reply 1 (1)

Syncee_Team
Shopify Partner
493 2 42

Hi @adnan-mallik 

You can do that with Syncee DataFeed Manager: https://syncee.co/datafeed-manager/

Syncee - Global Dropshipping
Hit 'Like' if our reply was helpful!
Click on 'Accept as Solution' if our reply answered your question!
Visit Our Marketplace!