bluevisiontec / GoogleShoppingApi

Magento Module GoogleShoppingApi v2
Open Software License 3.0
69 stars 45 forks source link

Unable to update google_shopping_category normally #34

Closed AQuackenbos closed 9 years ago

AQuackenbos commented 9 years ago

The google_shopping_category attribute, which assigned itself automatically, does not seem to save correctly. Example code:

$product = Mage::getModel('catalog/product')
        ->load(1);
echo 'GSC: '.$product->getGoogleShoppingCategory()."\n"; //"567"
$product->setData('google_shopping_category',5701);
echo 'GSC: '.$product->getGoogleShoppingCategory()."\n"; //"5701"
$product->save();

But after save, it stays at 567. $product->setGoogleShoppingCategory(5701) also failed. Not sure if I'm missing some special properties of the attribute; I know it loads the source data from a flat file, but didn't think that would impact saving the data as it's just an int stored in the EAV tables.

schnere commented 9 years ago

This works for me:

Mage::app()->setCurrentStore($storeId);
$product = Mage::getModel('catalog/product')->load(1)->setStoreId($storeId);
$product->setGoogleShoppingCategory(1234)->save();