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

asked Sep 28, 2016 at 8:55
1

1 Answer 1

0

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

answered Nov 16, 2016 at 7:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.