• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

MarcoM
#1 Posted : Monday, October 7, 2013 4:26:36 PM(UTC)
MarcoM

Rank: Member

Joined: 9/25/2013(UTC)
Posts: 4
United States
Location: Winnetka, IL

Thanks: 2 times
I have a category with about 24 Sub-Categories.
I would like the customer to "navigate" each of categories, in the sequence they are listed in the Admin, and therefore move to the next or go back simply using a <<< Back - Next >>> link.

So far I have accomplished this with manually applying html links to a Next and Back .gif, in each of the 24 the category's description area, but (obviously) every time I add a category I have to manually adjust some of these links.
Just wondering if there was an easier (and automated) method to accomplish this.

Thank you.
Marco
MarcoM
Aaron
#2 Posted : Monday, October 7, 2013 8:08:49 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,395
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Marco,

This is possible but will require some light programming. I would probably create a new category template and incorporate the next/previous category links in the template. Then you can assign the template to each of your categories. Since it's a template you could then use this template elsewhere in your site if you wish.

Start by creating a duplicate of a category template (found in /BVModules/CategoryTemplates/). Each folder contains a template and the name of the folder is used as the template name. Edit the Category.aspx page/template in your newly created folder and add the following controls to the page:

Code:

<asp:HyperLink ID="lnkPrev" Text="Previous" runat="server" />
<asp:HyperLink ID="lnkNext" Text="Next" runat="server" />


Next you'll need to add code to the code-behind of the page (Category.aspx.vb). Below is an untested code block that should get you in the vicinity. You can put this in the Page_Load function.

Code:

            Dim allCats As Collection(Of Catalog.Category) = Catalog.Category.FindAll() ' this variable may already exist in your template in which case it can be removed

            Dim cats As Catalog.CategoryPeerSet = Catalog.Category.FindVisibleNeighbors(Me.LocalCategory.Bvin)
            If cats.Peers.Count > 1 Then
                If cats.Peers(0).Bvin = Me.LocalCategory.Bvin Then
                    lnkPrev.Enabled = False
                    lnkNext.NavigateUrl = Utilities.UrlRewriter.BuildUrlForCategory(cats.Peers(1), Me, allCats)
                ElseIf cats.Peers(cats.Peers.Count - 1).Bvin = Me.LocalCategory.Bvin Then
                    lnkNext.Enabled = False
                    lnkPrev.NavigateUrl = Utilities.UrlRewriter.BuildUrlForCategory(cats.Peers(cats.Peers.Count - 2), Me, allCats)
                Else
                    For i As Integer = 0 To cats.Peers.Count - 1
                        If cats.Peers(i).Bvin = Me.LocalCategory.Bvin Then
                            lnkPrev.NavigateUrl = Utilities.UrlRewriter.BuildUrlForCategory(cats.Peers(i - 1), Me, allCats)
                            lnkNext.NavigateUrl = Utilities.UrlRewriter.BuildUrlForCategory(cats.Peers(i + 1), Me, allCats)
                        End If
                    Next
                End If
            Else
                lnkNext.Visible = False
                lnkPrev.Visible = False
            End If
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
 1 user thanked Aaron for this useful post.
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2025 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012