Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Export Module for Google Base
 
Dunc
Member
 
Avatar
Total Posts:  56
Joined:  2008-08-05
 

@turbo1

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?

Thanks
Duncan

PS. How would this be automated?

 
Magento Community Magento Community
Magento Community
Magento Community
 
turbo1
Sr. Member
 
Avatar
Total Posts:  296
Joined:  2008-08-19
Los Angeles, CA
 

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 smile

There we go, the file is attached. Remember to test it on a development server first. Use at your own risk.

All credit goes to Anda!

File Attachments
gbase.php  (File Size: 3KB - Downloads: 3717)
 
Magento Community Magento Community
Magento Community
Magento Community
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

way to go, but yeah, line 54..
Parse error: syntax error, unexpected ‘,’ in /var/www/alex/meanmachines.biz/html/store/export/googleBase.php on line 54

 
Magento Community Magento Community
Magento Community
Magento Community
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

heh that was quick..
im using the file now, placed in ROOT and getting

Fatal errorCall to a member function getFrontend() on a non-object in /var/www/alex/meanmachines.biz/html/store/gbase.php on line 46

If placed in export I get other errors.. using magento 1.1.6.

 
Magento Community Magento Community
Magento Community
Magento Community
 
turbo1
Sr. Member
 
Avatar
Total Posts:  296
Joined:  2008-08-19
Los Angeles, CA
 

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.  confused

@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.

 
Magento Community Magento Community
Magento Community
Magento Community
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

how right your are.. i was looking at that line myself with suspicion..
i have no manufacturers set.. commented the line out and all is well!!

nice one!!! off to google base now lol! i just hope manufacturer is not needed…

 
Magento Community Magento Community
Magento Community
Magento Community
 
turbo1
Sr. Member
 
Avatar
Total Posts:  296
Joined:  2008-08-19
Los Angeles, CA
 

Excellent!! I’m glad to hear it LOL

 
Magento Community Magento Community
Magento Community
Magento Community
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

Manufacturer afaik is not needed, but I also needed to remove it from the header of the file.. all very easy mods.

By working together Magento can kick ass far swifter! wink turbo1, u are a legend..
btw just got SUCCESS by Google Base!! WOOOOHOOOOO!!!!

A tick in a CRUCIAL marketing strategy..
btw.. how long does it take before items are listed in google’s product search?

 
Magento Community Magento Community
Magento Community
Magento Community
 
turbo1
Sr. Member
 
Avatar
Total Posts:  296
Joined:  2008-08-19
Los Angeles, CA
 

Thanks for the kind words grin

Google updates my products at midnight, so I would think by tomorrow your stuff will be listed.

 
Magento Community Magento Community
Magento Community
Magento Community
 
i960
Guru
 
Avatar
Total Posts:  633
Joined:  2007-10-01
Bakersfield, CA
 

I had to change this:

Mage::app('default');

To this:

Mage::app('');

Otherwise it would throw an exception and not generate the txt file.  Other than that, works perfectly. grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
speedyss
Jr. Member
 
Total Posts:  24
Joined:  2008-07-02
 

Hi, thanks a lot for the code.

i960 did u get the following error

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 a lot!

 
Magento Community Magento Community
Magento Community
Magento Community
 
i960
Guru
 
Avatar
Total Posts:  633
Joined:  2007-10-01
Bakersfield, CA
 

@speedyss - No, this is the error I got:

PHP Fatal error:  Uncaught exception 'Mage_Core_Model_Store_Exception' in D:\wwwroot\app\code\core\Mage\Core\Model\App.php:1131
Stack trace
:
#0 D:\wwwroot\app\code\core\Mage\Core\Model\App.php(583): Mage_Core_Model_App->throwStoreException()
#1 D:\wwwroot\app\Mage.php(212): Mage_Core_Model_App->getStore(NULL)
#2 D:\wwwroot\app\Mage.php(217): Mage::getStoreConfig('web/url/use_sto...', NULL)
#3 D:\wwwroot\app\code\core\Mage\Core\Controller\Req.

Works fine for me now though.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Dunc
Member
 
Avatar
Total Posts:  56
Joined:  2008-08-05
 

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…

<button onclick="document.location = '<?php echo $this->getBaseUrl ?>/data_feed.php'" type="button"><span>Update Feed</span></button>

just after

<?php echo $this->getAddNewButtonHtml() ?>

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.

Thanks again,
Duncan

 
Magento Community Magento Community
Magento Community
Magento Community
 
tradiArt
Guru
 
Avatar
Total Posts:  379
Joined:  2008-04-28
 

@turbo1

Thank you very much for the script!!

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?

Thank you!!

Image Attachments
google_basefeed.gif
 
Magento Community Magento Community
Magento Community
Magento Community
 
turbo1
Sr. Member
 
Avatar
Total Posts:  296
Joined:  2008-08-19
Los Angeles, CA
 

@XOXO

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 smile

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.  cool smile

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top