I would like to generate url keys with '/' of products. I have override the \Enterprise_Catalog_Model_Product_Attribute_Backend_Urlkey::beforeSave
method and generated url key as per requirement.
My before save method is :
public function beforeSave($object)
{
$attributeName = $this->getAttribute()->getName();
if ($object->getIsDuplicate()) {
$object = $this->_generateNextUrlKeySuffix($object);
}
$brandLong = $object->getData('brand_long');
$collection = $object->getData('collection');
$urlKey = $object->formatUrlKey($brandLong).'/'.$object->formatUrlKey($collection).'/'.$object->formatUrlKey($object->getData('sku'));
if (empty($urlKey)) {
$object->setData($attributeName, $object->formatUrlKey($object->getName()));
$object = $this->_generateNextUrlKeySuffix($object);
} elseif (!empty($urlKey) && !$object->getIsDuplicate()) {
$object->setData($attributeName, $urlKey);
}
$this->_validateEntityUrl($object);
return $this;
}
But generated url keys redirecting to 404.Url key is as below
attribute1-value/attribute2/sku
It redirecting to 404