1

I have a big doubt in forming url for products. Currently url is formed by using the name attribute. I want to change this to sku_id(attribute) of the products. For this where i need to change?

3
  • Which version are you using? Commented Apr 3, 2017 at 9:31
  • I am using Magento ver. 1.9.2.3
    – Rasheed
    Commented Apr 3, 2017 at 9:42
  • it may affect on seo.... Commented Apr 3, 2017 at 12:27

2 Answers 2

2

You can use product sku value in product "URL Key" field.

Or

You can use an extension for custom product URL. Its free and easy to use.

https://www.magentocommerce.com/magento-connect/catalog/product/view/id/30396/s/custom-product-urls-seo/

5
  • Thanks. I am new to magento and i don't know where to set sku_id for url changes. please refer me the file path for this changes.
    – Rasheed
    Commented Apr 3, 2017 at 8:00
  • No changes in any file. You can change from admin panel: admin -> catalog -> manage products -> Edit product or Add new product -> (in General tab ) URL key field. In URL key write "sku" value. Commented Apr 3, 2017 at 9:45
  • I have more than 500 products, and product name as URL key for all products.
    – Rasheed
    Commented Apr 3, 2017 at 9:52
  • You can update all product's URL Key by CSV... Commented Apr 3, 2017 at 9:54
  • Please check and follow like this : stackoverflow.com/questions/23987445/… Commented Apr 3, 2017 at 9:56
0
  • If you want to have the Sku in products url instead of name product, you just have to put your sku in the url key catalog>product manager>add product>url key.

  • If you want to add it in url, you can follow this:

Use an Event Observer catalog_product_save_before

config.xml

    <global>
        <events>
            <catalog_product_save_before>
                <observers>
                    <stockalert>
                        <type>singleton</type>
                        <class>yourmodel/observer</class>
                        <method>autoupdateurlKey</method>
                    </stockalert>
                </observers>
            </catalog_product_save_before>
        </events>
    </global>   

Observer:

    public function autoupdateurlKey($observer)
    {
        $product=$observer->getEvent()->getProduct();
        $oldUrlKey=$product->getOrigData('url_key');

        $Sku=$product->getSku();
        $TypeId=$product->getTypeId();

        // put yourlogic 
        $product->getData('url_key',$YourNewUrl);

         return $this;
    }
1
  • Do you mean setData instead of getData?
    – revo
    Commented Sep 23, 2018 at 9:11

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.