Nice one for sharing your code and congrats on getting it working with your site. It doesn’t seem to work on mine, I get an error on line 54, I’m thinking it may be to do with the way it has been posted in this forum as the errors seem to be to do with the quotes and double quotes appearing incorrectly. Rather than try and debug, are you able to post as an attachment?
Good point, I think some of the code didn’t copy over correctly. I’m sure you could automate it somehow; I had specifically requested that the developer make it a completely manual thing, but you may be able to set a Cron job for it. I just set myself a little shortcut in Firefox to the PHP file and run it whenever I want
There we go, the file is attached. Remember to test it on a development server first. Use at your own risk.
That’s weird, I get no errors at all. Is your export folder set to 777 permissions? If not, I really can’t help much - I didn’t write the script but I don’t see why it would work for me and no one else.
@alex - line 46 deals with the manufacturer section. Maybe if you don’t have a manufacturer set it doesn’t work.. I’m just guessing, don’t know for sure.
Warning: require_once(app/Mage.php) [function.require-once]: failed to open stream: No such file or directory in /home/cricketh/public_html/crickethaven.co.uk/shop/var/export/gbase.php on line 7
Fatal error: require_once() [function.require]: Failed opening required ‘app/Mage.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/cricketh/public_html/crickethaven.co.uk/shop/var/export/gbase.php on line 7
EDIT: oops forgot to create the export folder in root. That sorted it.
Thanks for adding the script as an attachment turbo1, it’s now working fine, the only modification I had to do to get it to work was like i960 suggested, change ‘default’ to ‘’ and for my site, I wanted to use the short description so just changed getDescription() to getShortDescription().
Also, in order to make it easier for updating the feed, I’ve added…
in /app/design/admin/html/default/default/template/catalog/product.phtml
This way I don’t need to worry about automation, I just set up a scheduled feed on Google Base and whenever I update products, click on this button to update the data feed text file. Bear in mind, I’ve renamed gbase.php to data_feed.php and placed it on the root folder of my site.
It works perfect!! And I have a TXT file with my feed.
Just for helping improving it, once Google Base has read it, the result is: ”Data feed contains some errors”
But I suppose this will only happen to me, because I don’t use that fields,
but I don’t understand last line… “The item is missing a required attribute. help id 49”
And also a very important thing… I have four stores, and the feed gets products from all my stores. This is not correct, because I have stores for several countries. How can I limit the feed to only the USA store?
It looks like some of your items are missing the “ID” field, which is required by Google Base. I think if you want to limit what is exported, you need to modify the gbase.php file to only pull from the particular store that you want data from. I have mine set to “default” because that’s the name of my root catalog. I’m sure the php file could be modified for specific stores though
Feel free to modify it to suit your needs!
@Dunc
Thanks for posting your idea! I’m sure a lot of people will find this useful.