1

I have certain products that I want as in store only, so I added a boolean attribute to them and modified the IsSaleable check to look for that. This works fine in the product view but for the Wishlist and Compare pages the add to cart button still shows up and $product->isSaleable() always returns 1. For the compare page it even lets the customer add the product to the cart (in wishlist it just puts up a red error).

I'm looking at the /template/catalog/product/compare/list.phtml and /template/wishlist/item/column/cart.phtml files and I know they are the right ones since commenting out the button in them works on the site.

3

See Mage_Catalog_Block_Product_Compare_List::getItems method. The boolean value that you added most probably isn't loaded in the collection, and so the isSalable call on the product returns 1 instead of what you expect it to be.

Make sure that the following line ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())

in the getItems method returns your attribute. And if you're using flat products (which you should be doing) that the attribute has got a column in the catalog_product_flag table (by setting the attribute Used in Product Listing to Yes).

Same goes for whishlist. Let me know if that worked

| improve this answer | |
  • That was already in there from default in the compare page. I'm not seeing anything similar in the wishlist group; there is a getProduct() function under block_item_configure but it just calls the catalog_model_product. – Mike Jul 3 '15 at 15:07
  • So to clarify, if you debug $product->isSaleable() on compare and wishlist pages, is your custom boolean attribute loaded? – Erfan Jul 4 '15 at 5:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.