Sorry for the late reply but I didn’t have notifications for this thread turned on
See attached for a pic of how I submit special prices to base
It will submit the normal price if you have no figures in the special price field for the product and if the special price field is populated it submits that price instead
I would also recommend using the fix in the thread below to stop it submitting special prices for the wrong products
it does not work for products that have a special price set using promotions and price rules, unfortunately.
Make changes to: app/code/core/GoogleBase/Model/Service/Item.php to retrieve the price rule price.
$attributeValues = $this->getAttributeValues();
/// work out special price using rule price here: $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 "); $specialprice = 0; while ($row = $readresult->fetch() ) { $specialprice = $row['rule_price']; }
it does not work for products that have a special price set using promotions and price rules, unfortunately.
Make changes to: app/code/core/GoogleBase/Model/Service/Item.php to retrieve the price rule price.
$attributeValues = $this->getAttributeValues();
/// work out special price using rule price here: $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 "); $specialprice = 0; while ($row = $readresult->fetch() ) { $specialprice = $row['rule_price']; }
Hi can you explain this in a bit more details please. ie to get the special price with the fallback of normal price in the feed do i have to implement just this change? OR do I also need to create some custom mapping in the magento admin
This is not yet tested.! so in theory, the code above should fall back to normal price or mapped price (however you set it up)… it should only use the discount rule price if there is one. I have not built in Special Price, but that would be easy enough to incorporate if your not using the mapped special price. This is meant as a starting point for people to develop a solution. I will post any updates if I make further changes.
/// work out special price using rule price here: $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 "); $specialprice = 0; while ($row = $readresult->fetch() ) { $specialprice = $row['rule_price']; }
I have the same problem , I want to map the special price to the google base product but instead of displaying the special price value it show me the regular price on the google base account. I think from magento code instead of checking for the special price it direcly send the regular price to the google .
Building further on what WebSiteEvo has done I think I have come up with a solution for this.
The first thing I did was copy app/code/core/Mage/GoogleBase/Model/Service/Item.php to app/code/local/Mage/GoogleBase/Model/Service/Item.php so that it is protected from updates.
// 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); }
$this->_setAttributePrice(false, $price);
This starts at line 283.
I have tested with special prices and catalog price rules and it seems to be working. I am using Magento Version 1.4.1.1
Yes this sniplet works perfect. But unfortunatly the synchronisation process doesnt work. If you change the value of an attribute and then press sync the new values are not in sync with GB. I have read in another thread that this whole GB implementation isnt finished.
Be aware: if you have net prices in your shop - you\’ll push net prices to GB.
@ leomoon88…
you\’re totally wrong, in editing the item.php you can send everything you want to google.. i send for example meta_title and short_description and not the name & the description.
@ mgarratt
I tried your sniplet for the price rules but everytime i get a parse error, unexpected T_Variable ... but i don´t see any error, your code appears to be right… andy ideas ?
Can anyone supply me with the latest full script for exporting products to Google Base for Shopping integration. We’ve been struggling for weeks with a way to do this and just need to start over from scratch, so I need a basic file gbase.php file set for Magento back-end. I can then change all the settings for my site and see if it works any better.
We also use the “special_price” for some, but not all, products!
Instead of getPrice
Delete a product in Google Base which has a special price, synchronise Google Base with Magento, then add that single product to Google Base again, it still shows the normal price!
Anyone know why this doesn’t work? Do I need to refresh some kind of core code cache or something?