This is the blog for getting Idea regarding PHP, Magento, jQuery and JavaScript for Customization.

Monday 29 October 2012

Magento : Get logged customers details

There are two type

A) To get Specific Details of customer


<?php

          if(Mage::getSingleton('customer/session')->isLoggedIn())
          {
                   /* If Customer Log In to System */

                   echo $this->_data['welcome'] = $this->__('Welcome, %s!', Mage::getSingleton('customer/session')->getCustomer()->getId());

                  echo $this->_data['welcome'] = $this->__('Welcome, %s!', Mage::getSingleton('customer/session')->getCustomer()->getName());

          } 
          else
         {
                   /* If Customer not Log In to System */
                   echo "Not Log In";
         }

 ?>

B) To get all Session Details of customer


<?php

          if(Mage::getSingleton('customer/session')->isLoggedIn())
          {
                   /* If Customer Log In to System */

                   $customer = Mage::getSingleton('customer/session')->getCustomer();
   print_r($customer);
   echo $taxVat = $customer->getData('taxvat');
          } 
          else
         {
                   /* If Customer not Log In to System */

                   echo "Not Log In";
         }

 ?>

No comments:

Post a Comment