Question:

How to restrict add to cart for GENERAL group

Jack: 2 weeks ago

I have restricted add to cart for not logged customer, but need also funcionality to restrict it for General group. How to do it? Part off my code

<!--moj kod usun add to cart-->
                <?php if (Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
                    <div class="add-to-box">
                          <?php if($_product->isSaleable()): ?>
                            <?php echo $this->getChildHtml('addtocart') ?>
                        <?php endif; ?>
                        <?php //echo $this->getChildHtml('addto') ?>
                    </div>
                    <?php } ?>
                    <!--koniec mojego kodu-->

Answer:
Amir: 2 weeks ago

Another option would be to create a module with an observer that is listening to the event catalog_product_is_salable_after.

Then in your observer you could do the following:

$salable = $oObserver->getEvent()->getSalable();
if (user is not logged in OR user is part of group general) {
    $salable->setIsSalable(false);
}

This way you would not have to update an template files and it should be fairly upgrade safe.

Note: That this simply hides the button and if the user guesses the url correctly they can still add the product to the cart for that I would recommend listening to catalog_product_type_prepare_full_options as well