Developer forum

Forum » Templates » Ecom menu in dwnavigation

Ecom menu in dwnavigation

Pól Andrias Larsen
Reply

Hi
When creating a e-commerce menu from properties of a page and under Options->Navigation I've got some problems understanding the context of the menu.

If I use the very same page/menu-point where the ecom menu is attached to, and I use it in the html file with a parenttag or parentid through dwnavigation, nothing is shown. But if I use the parenttag or id of the parent page/menu-point, the menu works fine.

Is it possible to create a page in the navigation and attach a ecom group to it, and use that same page (parenttag) in a dwnavigation in the page template?

The problem with this are 3 things:
1) Unnecessary pages are created in the menu-tree structure
2) The chosen ecom category's name is shown in the menu, and not only the child categories (possible?)
3) The navigation URL is long and not pretty


Replies

 
Mikkel Ricky
Reply

Ecom groups attached to a page does not behave like normal pages in the navigation, and therefore they do not appear if you set parenttag or parentid to the id of a page with ecom groups. You can work around this by adding a custom parameter, ecom-parentid, to your navigation element and render all pages (including ecom groups)

<div class="dwnavigation" id="nav" data-settings="ecom-parentid:42;expandmode:all"></div>

You can then use the custom parameter in your xslt like this

<xsl:template match="/">
    <xsl:variable name="ecom-parentid">
        <xsl:value-of select="/*/Settings/LayoutNavigationSettings/@ecom-parentid"/>
    </xsl:variable>
    <xsl:if test="//Page[@ID = $ecom-parentid]/Page">
        <ul>
            <xsl:apply-templates select="//Page[@ID = $ecom-parentid]/Page"/>
        </ul>
    </xsl:if>
</xsl:template>

This is not a very pretty solution, but it should work and solves no. 1 if I understand you correctly.

Regarding no. 2 and 3: Do you want to hide the top ecom group in the navigation or remove it from the urls generated for subgroups? Or is it the page with ecom groups you want to exclude from the menu and/or urls?

I hope you can use the stuff above and maybe provide further details on 2 and 3 so we can find a solution.

Best regards,
Mikkel

 

 

 

You must be logged in to post in the forum