I made a custom conlib user control...
simple page that references the same "using" list as the BuyProductDialog.
Code: Select all
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CommerceBuilder.Catalog;
using CommerceBuilder.Common;
using CommerceBuilder.Products;
(truly not all of those are needed...)
on the .ascx i added the following code:
Code: Select all
<%@ Register Assembly="CommerceBuilder.Web" Namespace="CommerceBuilder.Web.UI.WebControls" TagPrefix="cb" %>
<asp:Literal ID="PreviousNext" runat="server"></asp:Literal>
then in the code behind file i added the following to the Page_Load function
Code: Select all
string prevLink = "<a href='' ><< Prev</a>";
string currentPlace = "<b style=\"font-size:14px;\">Product #</b>";
string nextLink = "<a href='' >Next >></a>";
List<Product> myList = ProductDataSource.NarrowSearch("", PageHelper.GetCategoryId(true), thisProduct.ManufacturerId, 0, 0, 0, 0, "Name DESC");
int currentProdIndex = myList.IndexOf(thisProduct);
if (currentProdIndex == 0)
prevLink = "";
else
prevLink = prevLink.Replace("''", "'" + myList[currentProdIndex - 1].NavigateUrl.Replace("~/", "") + "'");
if (currentProdIndex == (myList.Count - 1))
nextLink = "";
else
nextLink = nextLink.Replace("''", "'" + myList[currentProdIndex + 1].NavigateUrl.Replace("~/", "") + "'");
currentPlace = currentPlace.Replace("#", (currentProdIndex + 1).ToString() + " of " + myList.Count.ToString());
PreviousNext.Text = prevLink + " " + currentPlace + " " + nextLink + "<br />";
i then added this conlib reference to the Show Product1.htm file in the scriptlets/custom/content folder.
Code: Select all
[[ConLib:custom/ProductPreviousNext]]
Two issues i am looking to solve now:
1) i need the SEARCH CRITERIA - the "sort by" and the "keywords" from the category listing page. So in cases where the "sort by" is not "Name DESC", the ordering is not as it was on the category list page.
2) for some reason the categoryId will reference the lowest level of the category for the product - so it seems. for example: if category A has two subcategories A1 and A2 and on the Category A list of products i click a product that is in the A1 subcategory - the "prev-next" list of products becomes only those products in the subcategory A1.
hope this makes sense to you all and might be helpful.