jruzafa
10/29/2013 - 6:42 PM

Generate url key for magento #css

Generate url key for magento #css

unction nameToUrlKey($name){
   // Zend_Debug::dump($name);
    $name = Mage::helper('catalog/product_url')->format($name);
  //  Zend_Debug::dump($name);
// replace remaining non-alphanumeric characters
// with dashes
   $name = preg_replace('#[^0-9a-z]+#i', '-', $name);

  //  Zend_Debug::dump($name);
// make it lowercase
   $name = strtolower($name);

//    Zend_Debug::dump($name);
// trim dashes on the left and right
    $name = trim($name, '-');




 //   Zend_Debug::dump($name);

    return $name;
}