1

I've run into an issue where $product->getDisableAddToCart() is returning bool(true) for some products, but I can't find a declaration of that method, nor can I find an attribute disable_add_to_cart in eav_attributes.

The method is called in

  • app\code\core\Mage\Wishlist\Controller\Abstract.php line 103
  • app\code\core\Enterprise\CatalogPermissions\Model\Observer.php line 323, 380, 540 (Enterprise 1.14.0.1)
  • app\code\core\Enterprise\Checkout\Model\Cart.php line 1021 (Enterprise 1.14.0.1)

Can anyone tell me where this is defined?

2

You can check the event in app/code/core/Enterprise/CatalogPermissions/etc/config.xml

Event: checkout_cart_save_before : enterprise_catalogpermissions

Function name:

  1. checkQuotePermissions()
  2. _initPermissionsOnQuoteItems($quote) - Just can see the line: $item->setDisableAddToCart(true);

Which will reflect to this line: $quote->removeItem($quoteItem->getId());

1

It turns out that this is being set with a Magic Setter, so no actual method or attribute even exists. Just search the codebase for $product->setDisableAddToCart() to find all of the places where it is called.

  • You will notice this behaviour with many of the getter and setter functions in magento, it's actually common. – simonthesorcerer Sep 22 '14 at 21:58

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.