Url friendly string

Url friendly string

If you need to transform some string to url-friendly string in Magento you just need to call method “formatUrlKey” from Mage_Catalog_Model_Product_Url class <?php $urlKey = Mage::getModel(‘catalog/product_url’)->formatUrlKey($string); ?> You can use this new variable $urlKey as url_key field for product or for some other attributes (for example: slug, sku, code etc)