Page 1 of 1
How do I disable the link on the product?
Posted: Wed Nov 26, 2008 9:13 am
by pbhavsar
Is there a way to disable the link on the product?
Right now, in my product list, if I click on the product, the website takes me to the "product detail" page where the product picture and description are shown. We'd like to disable that link. Is there an easy way to it?
Any suggestion is greatly appriciated. Thanks.
Re: How do I disable the link on the product?
Posted: Wed Nov 26, 2008 9:17 am
by mazhar
You need either to remove the link information or to place # sign in href of each link
For example on CategoryGridPage.ascx.cs following code is appending this information. You need to customize it in order to achieve required behavior on the categorygrid page
Code: Select all
//OUTPUT LINKED THUMNAIL
if (!string.IsNullOrEmpty(product.ThumbnailUrl))
{
string thumbnail = string.Format("<a href=\"{0}\"><img src=\"{1}\" alt=\"{2}\" border=\"0\" class=\"Thumbnail\" /></a><br />", productUrl, ResolveUrl(product.ThumbnailUrl), product.ThumbnailAltText);
itemTemplate1.Controls.Add(new LiteralControl(thumbnail));
}
//OUTPUT LINKED NAME
itemTemplate1.Controls.Add(new LiteralControl(string.Format("<a href=\"{0}\" class=\"highlight\">{1}</a><br />", productUrl, product.Name)));
Re: How do I disable the link on the product?
Posted: Wed Nov 26, 2008 9:43 am
by pbhavsar
Thank you for your response. Your suggestion works great.
One more question, do you know where in the code shall I modify if I want to disable the product links in "My Basket"?
Thanks again.
Re: How do I disable the link on the product?
Posted: Wed Nov 26, 2008 10:04 am
by mazhar
In ConLib/Basket.ascx file check the following code
Code: Select all
<ItemTemplate>
<asp:PlaceHolder ID="ProductImagePanel" runat="server" Visible='<%#ShowProductImagePanel(Container.DataItem)%>' EnableViewState="false">
<asp:HyperLink ID="ThumbnailLink" runat="server" NavigateUrl='<%#Eval("Product.NavigateUrl") %>' EnableViewState="false">
<asp:Image ID="Thumbnail" runat="server" AlternateText='<%# Eval("Product.Name") %>' ImageUrl='<%# Eval("Product.ThumbnailUrl") %>' EnableViewState="false" />
</asp:HyperLink>
</asp:PlaceHolder>
</ItemTemplate>
and also check the following code in ConLib/Utiltiy/BasketItemDetails.ascx.cs
Code: Select all
if (this.LinkProducts)
{
//OUTPUT NAME AS LINK
string url = UrlGenerator.GetBrowseUrl(product.ProductId, CatalogNodeType.Product, product.Name);
string link = string.Format("<a href=\"{0}\">{1}</a>", Page.ResolveUrl(url), productName);
phProductName.Controls.Add(new LiteralControl(link));
}