Monday, 11 February 2013

Get Product URL with categroy path

    
         $_categories = $product->getCategoryCollection();
               $_category = null;
               foreach($_categories as $_cat){
                   if(is_null($_category) || $_cat->getLevel() > $_category->getLevel()){
                       $_category    = $_cat;
                   }
               }
                   $url123= str_replace('.html','',$_category->getUrl());
                   $_itemUrl = (!is_null($_category)) ? $url123.'/'.basename($product->getProductUrl()) : $product->getProductUrl();
           
           

No comments:

Post a Comment

Note: only a member of this blog may post a comment.