Shopping Basket

 x 

Cart empty


Log In

Find Us Elsewhere

SSL

Forum Search

Keyword

This article discusses how you can go about creating a product feed for your Virtuemart store using our GooglebaseXML extension, and submitting it to Google Merchant Centre, when your store has a large number of products. There are a few issues that you need to consider, although there is nothing to stop this from being done very successfully.

The main issue is that the server resources required, including the server memory, and the script execution time, will be large for a large product database, probably much more than your site is normally allocated. How you go about solving the issues mainly depends on what sort of hosting your site uses.

Shared Server Hosting

If your site is hosted on a shared server, as most are, then the memory available for your server to run PHP will probably be limited to 128MB, and the script execution time will probably be limited to around 30 seconds. So you will almost certainly find that if you try to display a feed of more than about 1000 products it simply will not work, you just see a blank screen when you try to view the feed, or maybe an error message saying that the memory allocation failed.

Increasing Server Resources

If your database is not much larger than 1000 products then pushing up the resource limits is probably a viable approach. We suggest asking your hosts what are the maximum that they allow for the PHP configuration options of max_execution_time and memory_limit, and then setting these for your site. You may be able to do this by creating a text file in the root folder of your site called php.ini and including the folllowing for example (depending on what the values available actually are):-

max_execution_time = "120"

memory_limit = "256M"

 

When GooglebaseXML runs it automatically tries to increase the available memory limit to 256M, although that may or may not have any effect depending on what your hosts allow. If you look at the feed options, on the advanced tab, you will see that there is an option called "Memory Limit". You can try setting a value of 512 for this option, see if it makes a difference.

Multiple Feeds

If messing about with the available memory and script execution times is not working for you then the only alternative is to submit your product database in multiple smaller feeds. There is no problem with this, Google will accept as many feeds as you want, and it is very easy to create multiple feeds in the GooglebaseXML admin. You just go to Components->GooglebaseXML in your Joomla admin, and click the 'New' button to create a new feed. Alternatively you can open your existing feed in the component admin, and use the 'Save as Copy' function, which is useful if you have set up a lot of specialist options for your feed, it saves having to set them.

Once you have created the mulptiple feeds you just need to configure them to display a series of products. For this you use the limit and limit start feed options. 'Limit' will control the number of products included in the feed, 'Limit Start' controls the number of products skipped before the count starts. Note that the count starts from 0, not 1. An example should make this clear. Suppose you have 5,000 products. That is a lot of products, and the chances are that your server will run out of memory before generating a feed of that size if you try to include all the products at one. To solve this, you can create 5 feeds. The limits will be set as follows for each feed:-

FeedLimitLimit Start
Feed 1 1000 0
Feed 2 1000 1000
Feed 3 1000 2000
Feed 4 1000 3000
Feed 5 1000 4000

This can seem like a bit of a nuisance to set up, but the thing to bear in mind is that you only have to do this once. Once the feeds are created and submitted to Google for scheduled upload then the system automatically runs itself so it is not so much trouble to go to in the long run.

Dedicated Server or VPS Hosting

If you have a dedicated server or a VPS then the options available to you are much greater (that's why you have it after all). It should be possible to increase the memory limit and the script execution time available to PHP to allow you to create a single feed even of many thousands of products.

However a very large feed may take a long time to generate, and this may cause an issue with submitting it to Google, as this can time out. If this is happening regularly we suggest this workaround: you can set up a cron job to regularly generate the feed, and then store the results in a text file. Submit the text file URL to Google instead of the feed URL as this should upload much more quickly, because it does not need to be generated at the same time as it is uploaded..

For example your cron job can use wget to fetch the feed URL, and send the results to a file called feed.txt:-

wget-O feed.txt http://example.com/index.php?option=com_googlebasexml&format=xml&id=1 

Note that you can still split the feeds into smaller files as described above if this is more convenient, and send them to multiple text files, eg

wget-O feed1.txt http://example.com/index.php?option=com_googlebasexml&format=xml&id=1
wget-O feed2.txt http://example.com/index.php?option=com_googlebasexml&format=xml&id=2
wget-O feed3.txt http://example.com/index.php?option=com_googlebasexml&format=xml&id=3

Then you would submit the URLs of the text files feed1.txt, feed2.txt, feed3.txt to Google for scheduled upload. In this way you can create and submit feeds of many tens of thousands of products.