1

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

1

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

  <?php 
        $isloggedIn =0;
        if(Mage::getSingleton('customer/session')->isLoggedIn()){
            // logged in
        $isloggedIn =1;
        }else{
            // 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.

1

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 that you have read and understand our privacy policy and code of conduct.

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