+1-888-365-2779
Try Now
More in this section

Forums / Ecommerce / Change the url of the department filter widget

Change the url of the department filter widget

7 posts, 1 answered
  1. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    09 Feb 2012
    Link to this post
    Hi all,

    I'd like to change the url, when using the Departments widget.
    Now I can filter on departments and the URL becomes like this:

    http://mysite/products/-in-department/Departments/books/

    I want to have it like this:
    http://mysite/products/books/

    How can I achieve this?

    Regards,
    Daniel



  2. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    10 Feb 2012
    Link to this post
    Hey Daniel,

    For products this is easy to do (Administration>>Catalog>>Providers>>OpenAccessProvider>>Parameters and then add a 'urlFormat' key and a value).

    For departments (which is a hierarchical taxonomy) you'd think adding the same parameter (under Administration>>Taxonomy>>Providers>>OpenAccessDataProvider>>... ) would do the same trick, but unfortunately not. Under Data>>URL Evaluators>>Taxonomy there's also a parameter section, but that's unfortunately undocumented - I did a blond attempt to verify, but no success.

    So it seems only a Custom Provider (as described in Slavo Ingilizov's post) might do the trick. However, this approach seems to clash with the standard pager control which results into PITS Issue #9577. (Update from Lubomir Velkov on Feb 2 2012: probl not make it for v5.0 release)

    I could be wrong because I've not created and tested the custom provider myself but for now it seems a no go all around.

    ---
    TIP FOR DUMMIES LIKE ME:
    If you're going to do some coding, be aware of OpenAccessProvider vs OpenAccessDataProvider - has cost me a few hours in the past already :)
    ---

    Jochem.
  3. OC
    OC avatar
    129 posts
    Registered:
    17 Nov 2004
    16 Nov 2012 in reply to Jochem Bökkers
    Link to this post
    Hi there. I manged to do this by using IIS UrlRewrite 2.0. Added the following rule:
    <rule name="DepartmetnsRewrite" stopProcessing="true">
        <match url="^products/([^$]+)" />
        <action type="Rewrite" url="products/-in-Department/Departments/{R:1}" />
    </rule>
     And off course you have to do an outbound rule or change the navigation widgets to make the right urls for the client to click.

    See it in action here: http://www.hobbyeurope.com 

    OC
    Answered
  4. Patrick Dunn
    Patrick Dunn avatar
    237 posts
    Registered:
    03 Nov 2014
    20 Nov 2012
    Link to this post
    Hello,

     The URL rewrite method is the preferred method to accomplish this task provided by Ole Christian Synnes and has been marked as the answer.

    Kind regards,
    Patrick Dunn
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Peter
    Peter avatar
    42 posts
    Registered:
    22 Aug 2011
    25 Mar 2013 in reply to OC
    Link to this post
    Hi OC,

    your rewrite rule is working fine, thanks! I was wondering how you changed the URL's behind the departments widget. It's still pointing to the "-in-department/departments" url (off course).

    Regards,
    Peter
  6. OC
    OC avatar
    129 posts
    Registered:
    17 Nov 2004
    25 Mar 2013 in reply to Peter
    Link to this post
    Peter,
    I'm not using the Department widget at all. I have made my own from scratch.
    But I guess it would be just as easy to make an url-rewrite outbound rule that does it the other way around, as the inbound rule I pointed out above.
    OC
  7. Peter
    Peter avatar
    42 posts
    Registered:
    22 Aug 2011
    25 Mar 2013 in reply to OC
    Link to this post
    Hi OC,

    thanks, that explains it. I will see what solutions I will use.

    Regards,
    Peter
7 posts, 1 answered