Page 1 of 1
Product navigation for products in same category
Posted: Mon Mar 24, 2008 5:49 am
by jmestep
This was very nice in 5.5--to show the product navigation on top of product display for all the ones in the same category. Right now, you have to click back in to the category to find the next product in category.
Posted: Mon Mar 24, 2008 7:17 am
by Will
I second this request.
Posted: Mon Mar 24, 2008 9:33 am
by jmestep
If I ever figure it out, I'll post the code.
Posted: Wed Mar 26, 2008 5:59 am
by m_plugables
Edit Admin/Product/ProductMenu.ascx
and append the following html at the very end of the file
Code: Select all
<br />
<asp:Panel ID="MoreProductsPanel" runat="server">
<asp:GridView ID="OtherProductsGrid" runat="server" AutoGenerateColumns="False"
Width="100%" SkinID="PagedList" AllowSorting="false" OnRowCreated="OtherProductsGrid_RowCreated" >
<Columns>
<asp:TemplateField HeaderText="Other Products">
<ItemTemplate>
<asp:HyperLink ID="ProductLink" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Panel>
locate following line of code
and add following lines of code just below it
Code: Select all
private int _CategoryId = 0;
private Category _Category;
Locate following line of code in
protected void Page_Load(object sender, EventArgs e) function
Code: Select all
_Product = ProductDataSource.Load(_ProductId);
and add follwing lines of code udner founded line
Code: Select all
_CategoryId = PageHelper.GetCategoryId();
_Category = CategoryDataSource.Load(_CategoryId);
Add the following line of code inside the if (_Product != null) statement at the end
after modification the if statement will look like
Code: Select all
if (_Product != null)
{
....
....
....
OtherProducts();
}
Now add the following functions
Code: Select all
private void OtherProducts()
{
CatalogNodeCollection catalogItems = CatalogDataSource.LoadForCategory(_CategoryId, false);
CatalogNodeCollection products = new CatalogNodeCollection();
foreach (CatalogNode cni in catalogItems)
{
if (cni.CatalogNodeType == CatalogNodeType.Product)
products.Add(cni);
}
OtherProductsGrid.DataSource = products;
OtherProductsGrid.DataBind();
}
protected void OtherProductsGrid_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
CatalogNode catalognNode = (CatalogNode)e.Row.DataItem;
Control control = e.Row.FindControl("ProductLink");
if (control != null)
{
HyperLink pLink = (HyperLink)control;
pLink.Text = catalognNode.Name;
pLink.NavigateUrl = "~/Admin/Products/EditProduct.aspx?CategoryId=" + catalognNode.CategoryId.ToString() + "&ProductId=" + catalognNode.CatalogNodeId.ToString();
}
}
}
Posted: Wed Mar 26, 2008 10:00 am
by jmestep
Wow, thank you, thank you, thank you. I was dreading trying to do it. I'm still trying to figure C# out.
Posted: Wed Mar 26, 2008 12:03 pm
by jmestep
This works in the admin by creating a menu under the normal left nav menu so it is easy to flip thru the products.
I was looking for something on the product display page of the store. In 5.5, Able had product paging where it would say something link Product 1 of 16 Next >> above the product image and under the breadcrumbs.
Thanks
Posted: Wed Mar 26, 2008 1:26 pm
by jmestep
This works in the admin by creating a menu under the normal left nav menu so it is easy to flip thru the products.
I was looking for something on the product display page of the store. In 5.5, Able had product paging where it would say something link Product 1 of 16 Next >> above the product image and under the breadcrumbs.
Thanks
Posted: Fri Mar 28, 2008 9:09 am
by jmestep
This is really a help to the merchant in the admin. After thinking about it, I might try to use it on the store product pages, only in several columns. The advantage it has over Product 1 of X Next>> is that it shows the product name to the customer.