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
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

ok

so when you run from ssh

php -/home/myaccount/public_html/googlefeed.php

it works?

also can you setup the cron job manually from ssh?. I havent used Cpanel in ages.

brendan

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tacgear
Member
 
Total Posts:  52
Joined:  2009-06-14
 

I have contacted my host and requested the addition of ssh access. When they set it up I will see if it runs from the shell.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tacgear
Member
 
Total Posts:  52
Joined:  2009-06-14
 

ok running the script from ssh produces the following error.

Fatal errorUncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' in /home/myaccount/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php:129

Then it gives me a stack trace.

Again… right after trying this through the shell i ran it from the browser with no problems at all.

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

interesting. I dont know the answer. But can you post/attach the base file you have. I can throw it on my machine and see if it runs

brendan

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tacgear
Member
 
Total Posts:  52
Joined:  2009-06-14
 

My host tell me that I need to use 127.0.0.1 instead of ‘localhost’ as the MySQL host name in the script which is retarded of course because the script is using magento’s connection string to get the data and magento is set to use localhost for the mysql host name.

They also say that I cannot connect through MySQL socket in SSH/cron. I guess they have something turned off?

I’m attaching my file. Let me know how it goes I’m at a loss.

Thanks for the help btw (:

File Attachments
googlefeed.php  (File Size: 15KB - Downloads: 220)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Paine
Member
 
Total Posts:  73
Joined:  2010-01-25
 

Some questions regarding the script. I’ve managed to edit it to fit our requirements, except for three;

1) How do I make it send nothing at all if “Brand” is empty? Current it sends “no” if the field is blank.

2) My site does not use sever rewrites, so all the urls include /index.php/. This script does not seem to include that. I *MUST* have that in my urls in order for it to work.

3). I’m an idiot >.<

I’m doing my best to follow the new rules that came into effect Sep 2011: http://www.google.com/support/merchants/bin/answer.py?hl=en&answer;=188494

Edit:
Addtionally, we have about 650 items in our feed, only about 100 of which we actually want in google (a lot of duplicate “variants” of stuff, misc junk and “clearance” items, etc). Is there any way to make this script only pull items that have a specific attribute? For example, the built-in “TheFind” feed has a Yes/No attribute. Could this script be set up for a ‘Include in Google MC” Yes/No attribute? Yes items get included, No items do not?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Paine
Member
 
Total Posts:  73
Joined:  2010-01-25
 

I’ve also modified the price function to check if there is a special price, and use that for the main g:price attribute instead. I know next to nothing about php code or magento, so I hacked this together real quick, and it seems to work in my testing:

if ($product->getSpecialPrice()) {
            $product_d4[
'price']'    <g:price>'.$product->getSpecialPrice().' USD</g:price>';
            
$feed_line .= implode("\t"$product_d4);
            
}
            
else {            
            $product_d4[
'price']'    <g:price>'.$product->getPrice().' USD</g:price>';
            
$feed_line .= implode("\t"$product_d4);
            
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
Paine
Member
 
Total Posts:  73
Joined:  2010-01-25
 

I managed to solve this myself on attribute exclusion, and I’ll share for anyone else that runs across this in the future.
Using Elflings’ script as a starting point in post #557

Around line 72, find:

->addAttributeToFilter('status'1)//enabled

After, add:

->addAttributeToFilter('enable_google_shopping'1//Allowed in google shopping

Where “enable_google_shopping” is the attribute code you set. You will need to make this yourself in Magento and assign it to your attribute sets. This attribute should be a simple Yes/No, not a dropdown or textbox.

Edit: I’ve managed to solve all my prior issues with a lot of trial and error.
Brand/Manufacture reporting “no” if empty.

Find:

$product_d8['manufacturer']='    <g:brand>'.str_replace("GG""G&amp;G"preg_replace("/[^a-z0-9\40\\.\\-\\_\\\\]/i","",$product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($product))).'</g:brand>';
            
$feed_line .= implode("\t"$product_d8);

Replace with:

if ($product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($product) == 'No'{
            }
            
else 
            $product_d8[
'manufacturer']='    <g:brand>'.str_replace("GG""G&amp;G"preg_replace("/[^a-z0-9\40\\.\\-\\_\\\\]/i","",$product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($product))).'</g:brand>';
            
$feed_line .= implode("\t"$product_d8);
            
}

Base url needs “index.php

Find:

$product_d3['link']'    <link>'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).$product->getUrlPath().'</link>';
            
$feed_line .= implode("\t"$product_d3);

Replace with:

$product_d3['link']'    <link>'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).'index.php/'.$product->getUrlPath().'</link>';
            
$feed_line .= implode("\t"$product_d3);

If anyone knows a more elegant way of doing this without my clunky if/else statements, please share. But the script as I have it spits out only the items I want.

 
Magento Community Magento Community
Magento Community
Magento Community
 
fka200
Jr. Member
 
Total Posts:  17
Joined:  2011-05-20
 
march109 - 02 August 2011 03:01 AM

elfling - 21 July 2011 11:50 AM
ok a quick run down.

Download google.php from my post above.

Create a directory on your server. (doesn’t matter what)
Create another directory inside the one you just created and call it export and set it to writeable.

Place google.php in your random directory

Run google.php in your browser by going to

http://www.[domain-name]/[randomdirectory]/google.php

An export will be created called googlebase.xml in the export folder.

Then you need to do the rest of the work in Google itself.
Set the Feed name as googlebase.xml and the url of where to get it from.

You will need to modify your file slightly for your needs, however I’ve mostly got it contained now.

Is this really all that needs to be done? Will the google.php work with the new standards as mentioned above? I’m so confused… seems simple, but I’ve been reading of a lot of issues and am somewhat scared to try it out since a lot of the stuff in the thread is so old. Any info is appreciated, and the edits above are great!

Thank you :)

 
Magento Community Magento Community
Magento Community
Magento Community
 
antonyl
Jr. Member
 
Total Posts:  9
Joined:  2010-07-09
 

Can anyone tell me what code I need to get additional_image_links currently using

$product_data['additional_image_link'         $baseMediaUrl $product->getImage_2();]

but the code is not working, any help would be appreciated guys!

Thankyou

 
Magento Community Magento Community
Magento Community
Magento Community
 
xpresent
Jr. Member
 
Total Posts:  13
Joined:  2010-06-09
 

GMC shows you a script, ready for crontab etc to create a new German-Version of GMC-Feed. May you have to change / add attributes to the file.

If it doesnt help you, be so kind to write me an mail via

Regards
Andre

 
Magento Community Magento Community
Magento Community
Magento Community
 
fka200
Jr. Member
 
Total Posts:  17
Joined:  2011-05-20
 

I just realized/learned what a bunch of this mumbo-jumbo in the thread is actually talking about. I figured out how to get the feed, but it seems I am using an outdated script as the new guidelines for Google Base for shoes/apparel require sizing/color.

I have seen mention above, and even downloaded the ‘USgbasexml-tester.php’ that had mention of the size within it, but still could not get it to spit out my products.

Any idea on what to do? I am definitely willing to write a ‘how-to’ after all has been said and done to help people out with this. This is crazy… no resources after searching on Google, too. There’s only 1 extension but it’s $140… I hate to say it, but I can’t afford even the $40 at the moment due to this being a new online store hmmm.

Any help would be greatly appreciated! Trying to get this to work with an online shoe store is just WOW!

 
Magento Community Magento Community
Magento Community
Magento Community
 
moper11
Jr. Member
 
Total Posts:  17
Joined:  2009-07-24
 

please help!!!

i have Magento ver. 1.3.2.4

and got this massage from google
Please fix these issues within 7 days to avoid suspension of all your items.

Account:
Account ID:
Country: US

Missing or Invalid Unique Identifiers

Some or all of the items in your feed are missing unique product
identifiers, such as ‘MPN’, ‘brand’ and ‘GTIN’. These values are very
important for matching users’ queries to your products. It is required to
provide unique product identifiers for most product categories.

i am using the following google.php

File Attachments
google.php  (File Size: 23KB - Downloads: 309)
 
Magento Community Magento Community
Magento Community
Magento Community
 
loeffel
Guru
 
Avatar
Total Posts:  427
Joined:  2009-02-03
 

So now Google is requiring an “available” attribute. I just wish they wouldn’t change it every other month…

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Enthusiast
 
Avatar
Total Posts:  901
Joined:  2008-10-21
 

For special price, a more accurate way of doing it

$tomorrow mktime(000date('m'), date('d'), date('y'));
$tomorrowDate date('m/d/y'$tomorrow);

if ($product->getSpecialPrice() && $product->getspecial_to_date() == NULL || $product->getspecial_to_date() <= $tomorrowDate{
                $product_d45[
'sale_price']'    <g:sale_price>'.$product->getSpecialPrice().'</g:sale_price>';
                   
$feed_line .= implode("\t"$product_d45);
            
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top