0

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

1

1 Answer 1

0

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 and acknowledge you have read our privacy policy.

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