Disable Product Accessories Page

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
vn2479
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Thu Jul 29, 2010 12:43 pm

Disable Product Accessories Page

Post by vn2479 » Fri Sep 24, 2010 1:06 pm

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!

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

Re: Disable Product Accessories Page

Post by mazhar » Sat Sep 25, 2010 8:31 am

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

vn2479
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Thu Jul 29, 2010 12:43 pm

Re: Disable Product Accessories Page

Post by vn2479 » Mon Sep 27, 2010 11:30 am

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!

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

Re: Disable Product Accessories Page

Post by mazhar » Tue Sep 28, 2010 3:55 am

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.

vn2479
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Thu Jul 29, 2010 12:43 pm

Re: Disable Product Accessories Page

Post by vn2479 » Wed Sep 29, 2010 4:56 pm

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!

plugables
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Sat Aug 15, 2009 4:04 am
Contact:

Re: Disable Product Accessories Page

Post by plugables » Thu Sep 30, 2010 4:30 am

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" />

Post Reply