Page 1 of 1
Disable Product Accessories Page
Posted: Fri Sep 24, 2010 1:06 pm
by vn2479
Hello,
Is there a way to prevent the users from getting to the ProductAccessories.aspx page when they click on the "add to cart" button for items with accessories? Instead of having a separate page for accessories, I want to display all the accessories of a product on the same Product.aspx page under one of the AJAX tabs (Description, Reviews, Accessories, etc). I also want to display next to the accessory items a quantity box and add to cart button. How do I remove the "details" button in this case (I only want "add to cart")?
Not sure where to start. Any help is appreciated. Thanks!
Re: Disable Product Accessories Page
Posted: Sat Sep 25, 2010 8:31 am
by mazhar
You need to make two code changes, first edit your ConLib/BuyProductDialog.ascx.cs file and comment out following code block
Code: Select all
if (basketItem.Product.GetUpsellProducts(basket).Count > 0)
{
//redirect to upsell page
string returnUrl = NavigationHelper.GetEncodedReturnUrl();
Response.Redirect("~/ProductAccessories.aspx?ProductId=" + basketItem.ProductId + "&ReturnUrl=" + returnUrl);
}
then edit your ConLib/AddToCartLink.ascx.cs file and comment out following code block
Code: Select all
if (basketItem.Product.GetUpsellProducts(basket).Count > 0)
{
//redirect to upsell page
string returnUrl = NavigationHelper.GetEncodedReturnUrl();
Response.Redirect("~/ProductAccessories.aspx?ProductId=" + basketItem.ProductId + "&ReturnUrl=" + returnUrl);
}
This should do the trick
Re: Disable Product Accessories Page
Posted: Mon Sep 27, 2010 11:30 am
by vn2479
Thanks Mazhar! I'll give it a try. I do have another question. Why do some products have the "details" button while others have the "add to cart?" Where/how do I control which button shows up with certain products? Thanks for your help!
Re: Disable Product Accessories Page
Posted: Tue Sep 28, 2010 3:55 am
by mazhar
For some products where some details are required upon add to cart you will see the details link instead of add to cart. For example if you have a product that has some product options defined then you can't add this product to cart without choosing product options. This means that you can't do quick add to cart from category page for a product with options. So for product like these you will see details link in your category pages.
Re: Disable Product Accessories Page
Posted: Wed Sep 29, 2010 4:56 pm
by vn2479
So, you're saying I can't remove the details button for products with accessories/options on any page they appear? That seems rigid to me

You can get to the product detail page just by clicking on the image or product name, so I don't need the detail button. Any ideas? Thanks!
Re: Disable Product Accessories Page
Posted: Thu Sep 30, 2010 4:30 am
by plugables
vn2479 wrote:So, you're saying I can't remove the details button for products with accessories/options on any page they appear? That seems rigid to me

You can get to the product detail page just by clicking on the image or product name, so I don't need the detail button. Any ideas? Thanks!
What mazhar meant was that you can't have an 'add-to-cart' button for products which have options... because you can not add such a product to the basket before making selections for the options.
There is nothing preventing you from hiding the add-to-cart button or details button. For hiding the button you will have to make some minor updates to the script. For example if you want to hide the add-to-cart/details button on product accessories, you can change the following line of code in ProductAccessoriesGrid.ascx
Code: Select all
<uc:AddToCartLink ID="Add2Cart" runat="server" Product='<%#Eval("ChildProduct")%>' />
to
Code: Select all
<uc:AddToCartLink ID="Add2Cart" runat="server" Product='<%#Eval("ChildProduct")%>' Visible="false" />