0

i'd like to know, how i can remove the most recent category from the URL. The structure looks for example like following: "/parentCategory/subCategory/"

Now, after pressing a button i want to get back to the "parentCategory" and therefore removing the "subCategory" from the URL. Does magento provide something out of the box?

2
  • Are you want functionality same as breadcrumbs ?? If yes then you can get help from hare. blog.chapagain.com.np/…
    – Arunendra
    Sep 29, 2015 at 4:34
  • Hm. I want to have the back-link (which is the same as in the breadcrumbs), but i want to have it in a filter (layer navigation filter).
    – sebastian
    Oct 5, 2015 at 21:05

1 Answer 1

0

You can try this code

<?php
    $string = '/parentCategory/subCategory/';
    $data = explode('/',$string);    
    $data2  = array_filter($data );
    array_pop($data2);
    $FinalUrl = implode('/',$data2);
    print_r($FinalUrl);   
    //output = parentCategory

    ?>                     
1
  • Isn't there a function for magento doing this?
    – sebastian
    Oct 9, 2015 at 16:14

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.