The following changes will hide the "Add to cart" button only if the item can't be added to the cart without selecting attributes (it checks other things as well, stock status, availability date, disabled buy button, etc. ) for the ProductsInLines1 and ProductsInGrid category templates (ProductsInLines2 doesn't use buttons). To hide the "Add to cart" at all times, skip to below.
1. For Category Template "ProductsInLines1"
Edit File:
Modules\ProductBox2.ascx.cscomment out line 102:
//btnAddToCart.Visible = (!productVariant.DisableBuyButton);
add the following code:
int productVariantID = 0;
if (ProductManager.DirectAddToCartAllowed(product.ProductID, out productVariantID) == false)
{
btnAddToCart.Visible = false;
}
else
{
btnAddToCart.Visible = (!productVariant.DisableBuyButton);
}
2. For Category Templates "ProductsInLines1" and "ProductsInGrid"
Edit File:
Modules\ProductBox1.ascx.cs (and make the same change at line 106)
---------
If you want to remove the "Add to cart" button entirely, just comment out lines 102 (ProductBox2.ascx.cs) and 106 (ProductBox1.ascx.cs) and set the visibility of the button in the control files (ProductBox1.ascx & ProductBox2.ascx).
<asp:Button runat="server" ID="btnAddToCart" OnCommand="btnAddToCart_Click" Text="<% $NopResources:Products.AddToCart %>"
ValidationGroup="ProductDetails" CommandArgument='<%# Eval("ProductID") %>' SkinID="ProductListAddToCartButton" Visible="false" />
You will need to recompile the solution.
.