When we create or modify a product -- the
url_key doesn't seem to associate with the
store_id of the product. For example:
$product = Mage::getModel('catalog/product')->load($prodid); $product->setUrlKey('product-url-key') $product->setStoreId(1); $product->save();
But here lies the problem:
I would expect
url_key in the Table
catalog_product_entity_url_key to have a store_id of 1, but it gets set to 0. How else should a product be saved to that the url_key gets the proper store_id?
Background on this problem:
We are writing scripts for updating programs and have been getting a lot of these errors:
Uncaught exception 'Mage_Eav_Model_Entity_Attribute_Exception' with message 'Product with the 'product-url-key-added' url_key attribute already exists.' in /var/www/mage02/app/code/core/Mage/Core/Model/Config.php:1348
Looking further into the code, this problem seems to be created because of how the store_id is getting set. We can make the problem go away by manually updating the store_id.. however, on the re-save -- the store_id for the url_key gets set back to 0.
Magento Version used: 220.127.116.11 (Fresh Install)