Hi all,
after many try i've found a solutions to add a field to the feeder (I needed the GTIN code as well as MPN code).
1. First of all You need to add the filed to your database, in my case i added "products_gtin" to the "products" table.
2. You need to modify the \..\classes\google_base.php adding a statement to add the field to the XML file as follow:
- Around line 393 find:
PHP Code:
if ($products->fields['products_model'] != '') {
$mpn = $dom->createElement('g:mpn');
$mpn->appendChild($dom->createCDATASection($this->google_base_xml_sanitizer($products->fields['products_model'])));
$item->appendChild($mpn);
}
-immediaty after add the following code:
PHP Code:
if ($products->fields['products_gtin'] != '') {
$gtin = $dom->createElement('g:gtin');
$gtin->appendChild($dom->createCDATASection($this->google_base_xml_sanitizer($products->fields['products_gtin'])));
$item->appendChild($gtin);
}
3. Modify the "googlefroogle.php" file addiing the definition of your new field:
-Line 152 add the fields you create to the query:
PHP Code:
$products_query = "SELECT distinct(pd.products_name), p.products_id, p.products_model, p.products_gtin,...
-Line 227 add a "case":
PHP Code:
case 'gtin':
if ($products->fields['products_gtin']) {
$id = $google_base->google_base_xml_sanitizer($products->fields['products_gtin']);
break;
}
Now you should have a new field added to the feed :-)
Bookmarks