How do I disable the link on the product?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
pbhavsar
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 23
Joined: Wed Jun 25, 2008 12:21 pm

How do I disable the link on the product?

Post by pbhavsar » Wed Nov 26, 2008 9:13 am

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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: How do I disable the link on the product?

Post by mazhar » Wed Nov 26, 2008 9:17 am

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)));

pbhavsar
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 23
Joined: Wed Jun 25, 2008 12:21 pm

Re: How do I disable the link on the product?

Post by pbhavsar » Wed Nov 26, 2008 9:43 am

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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: How do I disable the link on the product?

Post by mazhar » Wed Nov 26, 2008 10:04 am

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));
                }

Post Reply