Put Popup On Add to Cart Button and If Add to Cart Button Clicked than First Check Customer is Loggedin or Not? And If not Loggedin Than Login Form should be open in Popup. Can Any One Help me? Any Kind of Help will Appreciate.

2 Answers 2


You can do this many way. I will sugggest you to do this way. ofcourse all peopel have different views and ways.

        $isloggedIn =0;
            // logged in
        $isloggedIn =1;
            // not logged in
         $isloggedIn =0;

Now simply use js function onclick of addtocart button and pass this value as 1 parameter so you can make condition which data will be shown on click. You can use modal or any other Jquery popup its upto you.

Hope this will help.


Here is sample code for this :

<?php if(!Mage::getSingleton('customer/session')->isLoggedIn()){ ?>
 <!-- login button with pop up go here. -->
            <a href="javascript:;" onClick="openLogin()" class="openoppup" >Add to cart</a>
    <?php   }else{ ?>
                 <!-- add to cart button go here -->
    <?php   }   

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.