It is possible to have two nodes with different parents?

Sep 23, 2009 at 10:24 PM

I have the situation that for example for the browsing by categories I display a list of products and for a search, I display the the same list of products. In this list, I can select a product to display the details.

I already have the sitemap for categories:

Home -> Sports -> Product X

What I want, is the same but for the search results; or to omit the "Categories" node.

Home -> Search by: 'Jackets' -> Jacket Y

or

Home -> Jacket Y

The problem is that in if I use the MVCSiteMapAttribute, I have to specify the parent node.

And I cant do:

sitemapnode categories  controller="search" action="searchByCat"
                    sitemapnode prodDetail controllerr= "prroduct"action="details"

sitemapnode categories  controller="search" action="searchByQuery"
                    sitemapnode prodDetail controllerr= "prroduct"action="details"

because they urls need to be unique.

 

Any suggestion?

 

Coordinator
Sep 24, 2009 at 6:53 AM

Try setting MvcSIteMapNodeAttribute's Url property (using latest sources).

Sep 24, 2009 at 4:48 PM

Thanks a lot, it works for me.

Now I have another problem:

<mvcSiteMapNode title="Store" controller="Store" action="Index" isDynamic="true" dynamicParameters="*" visibility="Full">    
    <mvcSiteMapNode title="Searchs" controller="Search" action="Search" isDynamic="true" dynamicParameters="categoryId" visibility="InSiteMapPathOnly" key="AppsBySearchList">
        <mvcSiteMapNode title="Details" controller="ProductDetails" action="Details" isDynamic="true" dynamicParameters="id" visibility="InSiteMapPathOnly" key="SearchDetails" url="/Search/Details"/>
   </mvcSiteMapNode>

    <mvcSiteMapNode title="Category" controller="Search" action="SearchByCategory" isDynamic="true" dynamicParameters="categoryId" visibility="InSiteMapPathOnly" key="AppsByCategoryList">
        <mvcSiteMapNode title="Details" controller="ProductDetails" action="Details" isDynamic="true" dynamicParameters="id" visibility="InSiteMapPathOnly" key="CatDetails" url="/Category/Details"/>
    </mvcSiteMapNode>

    <mvcSiteMapNode title="StaffPicks" controller="StaffPicks" action="Index" isDynamic="true" dynamicParameters="categoryId" visibility="InSiteMapPathOnly" key="StaffPicks">
            <mvcSiteMapNode title="Details" controller="ProductDetails" action="Details" isDynamic="true" dynamicParameters="id" visibility="InSiteMapPathOnly" key="SPDetails" url="/StaffPicks/Details"/>
   </mvcSiteMapNode>
</mvcSiteMapNode>

This is my sitemap, I have three section from where the user can select a product to display its details. The problem is that no matter where I select a product the path always shows Store -> Searchs -> Details.

Is like if a precedence take place, and always select the first details node. If I switch category node with searchs, the path looks Store -> Search -> Details.

Is there any workaround to solve this?

Thank you.

Sep 25, 2009 at 10:21 PM

I find out what happen in this situation. When the sitemap provider returns the current node, it compares the route data with the data defined in the sitemap config file.
It compares the controller, action and action parameters that in the case described above are the same, so it takes the first it finds.

What I can do to select the desired node? Do you have any suggestion?

Thanks