1

I have a unique requirement where If a product has been added to the shopping basket and it belongs to a specific category let's say category "K", add to cart buttons for all products that don't belong to category K should be disabled (on category pages). If on the other hand product in the cart belongs to any category other than category K, all products of category K should not show add to cart button.

Any ideas?

1 Answer 1

1

If it is only a handful of products, I would think about adding a new attribute to do this. Attributes are just by hand and you can load them together with the quoteItems, so it is easy to check what status currently is. This logic can easily be implemented in an observer for isSalable() via catalog_product_is_salable_after.

If you need more different categories, you should think about something on the quote to save the different states and allows, by using checkout_cart_product_add_after, and then do the same by implementing a second observer on catalog_product_is_salable_after

1
  • Hi and welcome to Mageoverflow! Please don't post thank comments, but instead upvote. So the comments don't get littered but can easily be read with on topic stuff :) Commented Feb 2, 2016 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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