In Magento, is it possible to add the product to cart after login for the selected category.
The selected category products, which can be view for all user while add this product to cart it should check whether the user is login, if the user is login product should be added to cart else it should go to my account page after user login that product should added to cart and the user also redirect to the cart page.
Any Ideas?
Thanks in advance.
Best Answer
You can accomplish this with an extension that uses an observer. You can observer the
controller_action_predispatch_checkout_cart_add
event in this case.and your observer would look something like this. Before the product is added to cart the function checks if the current customer is logged in. If not it redirects to the login page.
[EDIT] - another, little les techincal, option.
An other option would be to hide the add to cart button whenever a customer is not logged in yet. In the file
app/design/frontend/[template]/[package]/template/catalog/product/view/addtocart.phtml
you can wrap the add to cart in an if statement. Your file would look something like this.