I had to take out the Price > price mapping in Google Base > Manage Attributes.
Then delete the items from Google Base, and re \’Add to Google Base\’ them.
I added this code to app/code/local/Mage/GoogleBase/Model/Service/Item.php
// If Special Price is set, add to array if($object->getSpecialPrice() > 0) { $min_values[] = $object->getSpecialPrice(); }
// Get Catalog Price Rule Price $write = Mage::getSingleton(\'core/resource\')->getConnection(\'core_write\'); $readresult=$write->query(\"SELECT rule_price FROM catalogrule_product_price WHERE product_id = \".$object->getId().\" ORDER BY rule_product_price_id DESC LIMIT 1 \"); // If a result is returned, add to array while ($row = $readresult->fetch() ) { $min_values[] = $row[\'rule_price\']; }
// Set price for GoogleBase to minimum of 3 prices $price = min($min_values); }
Has anyone successfully used this code in Magento 1.5.1.0?
After I do the following:
1. Delete all items from Google Base “Manage Items”.
2. Map Manage Attribute “Condition” to “condition”. No other attribute mapping is necessary in 1.5.
2. Clear Magento cache.
3. Add code to app/code/local/Mage/GoogleBase/Model/Service/Item.php (I assume that the code is pasted at the end of the core code and the updated file placed in this local folder.)
4. Clear Magento cache.
Then I go to “Manage Items”, the following error message is displayed on the “Manage Items” menu:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING in /home/user/mysite.com/app/code/local/Mage/GoogleBase/Model/Service/Item.php on line 332
Perhaps, my Item.php file is not complete. My Item.php file is attached.
Would someone mind sharing their Item.php file for Magento 1.5.1.0?
Thank you mgarratt and benh777 for sharing your code, seems to be working perfectly for me on Magento 1.5.1.0.
@r2rsquared Your code has included some backslashes that this forum sometimes adds to published code. I’ve attached my Item.php that is working for me, try this one instead.
Just completed a very flexible module for Magento version 1.6 (may work on previous versions, but is untested at this time) that will create an XML file to be submitted to Google Merchant Center that will be compatible with the changes on Sept. 22nd. It has reporting to check products before they are added to your feed. It uses a JavaScript taxonomy checker to get the Google Product Category for your product (no more cut and paste from Google to your product and create a custom attribute). It allow for custom mapping for certain attributes. It accounts for up to 10 additional images per product (per Google specification). Uses Magento Cron to schedule file generation.
Check out the user guide at: http://fancyfiber.com/studios/products/en/buy/google_merchant_center_feed_user_guide
Buy it for $20 at: http://fancyfiber.com/studios/products/en/buy/magento-modules/google-merchant-center-feed.html
Features at a glance:
JavaScript selector for Google Product Taxonomy (required by Google as of Sept 22, 2011)
Automatic selection of store category for inclusion in file
Automatic inclusion of special price and dates
Ability to create custom attribute mapping to your product attributes
Cron scheduled creation of XML file
Works with multiple stores
Select products by attribute set and ability to exclude specific products
Reports to verify the majority of the most common errors with Feed files (include troublesome apparel products)
Able to override most attributes sent to Google so they don’t have to match store values exactly (I use this to fix long store titles)
Support for configurable products - item group id sent for the configurable parent.
Separate feed files per store - can disable feeds per store view
And more…