$product->getDisableAddToCart() magic method questions
-
12-12-2019 - |
Question
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 103app\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?
Solution 2
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.
OTHER TIPS
You can check the event in app/code/core/Enterprise/CatalogPermissions/etc/config.xml
Event: checkout_cart_save_before
: enterprise_catalogpermissions
Function name:
checkQuotePermissions()
_initPermissionsOnQuoteItems($quote)
- Just can see the line:$item->setDisableAddToCart(true);
Which will reflect to this line: $quote->removeItem($quoteItem->getId());