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);

        return $this;

But generated url keys redirecting to 404.Url key is as below


It redirecting to 404


Perhaps you can reference something such as this: https://github.com/Flagbit/Magento-FilterUrls

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.