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

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

Will look forward to seeing what you come up with but a profile will still need to run the export wouldn’t it and schedule that? Also, wouldn’t the url’s still be a problem? Sorry if I just need to be patient and wait to see what it is you come up with but in the mean time, to do all this in Magento the following would probably need to be done…

The coding part is beyond my capabilities but perhaps the solution is to first add attributes to the products in the Admin section (e.g. link and image_link) and then add some code to the section that saves the product, which writes the {{unsecure_base_url}} plus the url_path to the link attribute and the {{unsecure_base_url}} and thumbnail to the image_link attribute. (The skin url should not be needed, e.g. “www.example.com/productid.html” is sufficient). Then, when exporting, just map the link attribute and image_link attribute and you have a Google Base tsv file which can then be picked up by Google Base Scheduler after running it.

It would be good to hear from any of the Magento developers on this.

Thanks,
Dunc

 
Magento Community Magento Community
Magento Community
Magento Community
 
hyteckit
Sr. Member
 
Avatar
Total Posts:  166
Joined:  2008-04-01
Los Angeles, CA
 

Well, it has nothing to do with dataflow, profiles, or the export function.  It’s a RSS datafeed, not a export profile using dataflow.

Actually, it’s sorta done.  Just tested it out on Google Base and it was a success.  I had to modify the RSS feed to generate a Google Base compatible feed. Too many hacks and too many customization.  Due to the nature of Google Base, I don’t think my solution would work for everyone. 

Well, at least it works.

 
Magento Community Magento Community
Magento Community
Magento Community
 
John
Sr. Member
 
Avatar
Total Posts:  129
Joined:  2007-12-20
Sheffield, United Kingdom
 
hyteckit - 23 August 2008 02:59 AM

Actually, it’s sorta done.  Just tested it out on Google Base and it was a success.  I had to modify the RSS feed to generate a Google Base compatible feed. Too many hacks and too many customization.  Due to the nature of Google Base, I don’t think my solution would work for everyone. 

Well, at least it works.

Well done hyteckit, could you give us a pointer on what you did or post the updated files for us to crawl through to get a next level of RSS for Google Base?

Thanks in advance
John

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

Yes, sounds good hyteckit, nice one. When do you think you’ll have something we could test?

 
Magento Community Magento Community
Magento Community
Magento Community
 
speedyss
Jr. Member
 
Total Posts:  24
Joined:  2008-07-02
 
hyteckit - 23 August 2008 02:59 AM

Well, it has nothing to do with dataflow, profiles, or the export function.  It’s a RSS datafeed, not a export profile using dataflow.

Actually, it’s sorta done.  Just tested it out on Google Base and it was a success.  I had to modify the RSS feed to generate a Google Base compatible feed. Too many hacks and too many customization.  Due to the nature of Google Base, I don’t think my solution would work for everyone. 

Well, at least it works.

It would be great if you could share how you have managed to get your products into google base.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hyteckit
Sr. Member
 
Avatar
Total Posts:  166
Joined:  2008-04-01
Los Angeles, CA
 

You might want to check out:

http://framework.zend.com/manual/en/zend.feed.importing.html

I just created a new Class overloading the function createRssXml.  I also created a new Google Base Interface Builder for Zend_Feed.

In that function createRssXml, I call the function Zend_Feed::importBuilder to import my data using the new Google Base Interface Builder which basically formats the RSS feed for Google Base.

 
Magento Community Magento Community
Magento Community
Magento Community
 
speedyss
Jr. Member
 
Total Posts:  24
Joined:  2008-07-02
 
hyteckit - 25 August 2008 04:47 AM

You might want to check out:

http://framework.zend.com/manual/en/zend.feed.importing.html

I just created a new Class overloading the function createRssXml.  I also created a new Google Base Interface Builder for Zend_Feed.

In that function createRssXml, I call the function Zend_Feed::importBuilder to import my data using the new Google Base Interface Builder which basically formats the RSS feed for Google Base.

Hi,
Thanks for your help, I have to admit I am not a programmer and hence do not have that *great* a grasp of how magento works. I have looked at your link and can understand what they are trying to say/do.

Then I went to app/code/core/Mage/Rss/Block/Catalog/Category.php which is the file that creates the RSS feed. I am guessing the google base rss feed is based on that. So, I will have to work on it to see if I can get a feed to comply with Google Base guidelines.

Also I was wondering, isn’t the code going to be same for everyone? So would you be willing to share your code and may be write a wiki on how we will all be able to import our products into Google Base....

It would be great if you could put together something for the rest of us…

Thanks again.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hyteckit
Sr. Member
 
Avatar
Total Posts:  166
Joined:  2008-04-01
Los Angeles, CA
 

I guess if all you sell are simple products and only want to upload the required information to GoogleBase, I guess it would work.

The basic required fields are: id, title, description, price, link, and image_link.

Even with those basic fields, you still have some issues.  I’m still working on them because I had products that didn’t show in my feed because some products have attributes other products didn’t have, like color.

What description do you want to use? Short description or the long description?

Which image do you want to use?  The default image?  The thumbnail?  The small image?  A custom image with watermark?

What price do you want to show?  The special price? The regular price?  The catalog rule price? The cheapest price in the tier pricing?

What about all those configurable products?  Bundles?  What about all those attributes such as color, weight, dimensions, and so forth?

Once I’m done with mine, I might post it to Magento Connect.

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

Hi

Thanks for your reply.

I personally need the basic information really.

name -> Meta Title
description -> long description
price -> special_price
id-> sku
image -> thumbnail

and only products that have been set as ‘catalog, search’ are to appear in the feed (doesn’t matter if they are config/simple)

Do you think this could be done???

I think it might help to release some code for the basic version of the feed so that we can all help out to make it more efficient/functional.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hyteckit
Sr. Member
 
Avatar
Total Posts:  166
Joined:  2008-04-01
Los Angeles, CA
 

Sorry, but I highly doubt it.

All I’ll get are more questions.

How do you install this?  It doesn’t work.  How do you do this?  Hey hyteckit, can you create a 4 page wiki on how to get this thing installed and working.

I say no thanks.

Wait till it’s done and when I make it available on Magento Connect.

 
Magento Community Magento Community
Magento Community
Magento Community
 
[db] DigitalBlueprint
Member
 
Avatar
Total Posts:  37
Joined:  2007-10-11
Eastbourne, UK
 

I needed a quick fix for a google base feed too, but ran into the same problem with link and image_link fields not having the full urls when exported with the DataFlow module.

As a temporary workaround I’ve put together the following script:

<?php
    
require_once 'app/Mage.php';
        
umask(0);
        
Mage::app('default');
        
        
/**** CONFIGURATION ****/
        
$domain "http://www.francis-birch.co.uk/";
        
$media_path "media/catalog/product";
        
/***********************/
        
        
function addQuotes($text{
            
return('"'.$text.'"');
        
}
        
function cleanForCSV($text{
            $text 
str_replace('"'""$text);
            
$text str_replace("\r\n"" "$text);
            
$text str_replace("\t"""$text);
            return 
$text;
        
}
        
        $products 
Mage::getModel('catalog/product')->getCollection();
        
$products->addAttributeToFilter('status'1);
        
$products->addAttributeToFilter('visibility'4);
        
$products->addAttributeToSelect('*');
        
$products->load();
        
        
$fields = array('id','title','description','link','image_link','price');
        echo 
implode("\t"$fields)."\r\n";
        
        foreach(
$products as $_product{
            $data 
$_product->getData();
            
            
$csv = array($data['sku'],
                                     
$data['name'],
                                     
$data['description'],
                                     
$domain.$data['url_path'],
                                     
$domain.$media_path.$data['image'],
                                     
$data['price']);
            
$csv array_map("cleanForCSV"$csv);
            
$csv array_map("addQuotes"$csv);
            
            echo 
implode("\t"$csv)."\r\n";
        
}
?>

It just outputs all the products that are enabled and have visibility set to ‘Catalog, Search’ using a tab-seperated syntax that Google Base will import with their schedular.

Just place it in your Magento root folder (after customising it for your site!) and then call it from a web browser or just give Google Base the url.

As you can probably tell, this script only outputs the bare minimum needed for Google Base feeds, but it’s fairly easy to customise. Hope it helps someone!

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

Excellent script there Kevin, works perfectly. I’ve just now had confirmation of the scheduled data feed being a success, yippee!. Top bloke!

 
Magento Community Magento Community
Magento Community
Magento Community
 
[db] DigitalBlueprint
Member
 
Avatar
Total Posts:  37
Joined:  2007-10-11
Eastbourne, UK
 

Thanks Dunc, I’m glad you found it useful.

I’ve just updated it so that it also pulls out the brand (bit trickier as it’s not stored as core product data). If you have any familiarity with PHP it should be quite simple to expand for other data as well:

<?php
    
require_once 'app/Mage.php';
        
umask(0);
        
Mage::app('default');
        
        
/**** CONFIGURATION ****/
        
$domain "http://www.francis-birch.co.uk/";
        
$media_path "media/catalog/product";
        
/***********************/
        
        
function addQuotes($text{
            
return('"'.$text.'"');
        
}
        
function cleanForCSV($text{
            $text 
str_replace('"'""$text);
            
$text str_replace("\r\n"" "$text);
            
$text str_replace("\t"""$text);
            return 
$text;
        
}
        
        $products 
Mage::getModel('catalog/product')->getCollection();
        
$products->addAttributeToFilter('status'1);
        
$products->addAttributeToFilter('visibility'4);
        
$products->addAttributeToSelect('*');
        
$products->load();
        
        
$fields = array('id','title','description','link','image_link','price','brand');
        echo 
implode("\t"$fields)."\r\n";
        
        foreach(
$products as $_product{
            $data 
$_product->getData();
            
$attributes $_product->getAttributes();
            
            
$brand $attributes['brand']->getFrontend()->getValue($_product);
            
            
$csv = array($data['sku'],
                                     
$data['name'],
                                     
$data['description'],
                                     
$domain.$data['url_path'],
                                     
$domain.$media_path.$data['image'],
                                     
$data['price'],
                                     
$brand);
            
$csv array_map("cleanForCSV"$csv);
            
$csv array_map("addQuotes"$csv);
            
            echo(
implode("\t"$csv)."\r\n");
        
}
?>

Also, a quick word of caution: if you have a very large database of products it may be necessary to use cron to save the output of the script ready for google’s schedular to pick it up in case google times out waiting for the script to complete.

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

Hi,

Am I right in thinking all you have to do is copy the code you have posted, but it in a file under the root server and when you call it using a web browser you should get a CSV file. (obviously after changing domain name to my domain)

if so its not working for me :(

the file is here http://www.crickethaven.co.uk/shop/googlebase.php

The file contains the code you have posted…

 
Magento Community Magento Community
Magento Community
Magento Community
 
[db] DigitalBlueprint
Member
 
Avatar
Total Posts:  37
Joined:  2007-10-11
Eastbourne, UK
 

Hi speedyss, sorry it’s not working for you.

As I said, this was just a very quick hack to get a minimal google base feed working for a simple shop setup so it hasn’t been tested much. I’d be interested in working out what’s wrong tho - do your products have “Catalog, Search” set for visibility? Also, do you have a multiple store setup or anything out of the ordinary with your store?

Update: Just realised that ‘brand’ is probably a custom attribute in the store i developed the script for. Does the first version of the script run ok?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 42