/** * Refresh product rewrite * * @param Varien_Object $product * @param Varien_Object $category * @return Mage_Catalog_Model_Url */ protected function _refreshProductRewrite(Varien_Object $product, Varien_Object $category) { if ($category->getId() == $category->getPath()) { return $this; } parent::_refreshProductRewrite($product, $category); if ($this->_helper()->isEnabled() && $this->_urlKey && $this->_urlKey != $product->getUrlKey()) { $product->setUrlKey($this->_urlKey); $this->getResource()->saveProductAttribute($product, 'url_key'); } return $this; }