2

I have created one custom cms page on the name of Bulkorders at toplinks at https://www.depoto.com/. I put the need to login to access this bulk orderpage. if anyone place the bulkorders from this page, admin can receive the email with all the details. I gave the form action to get the details. Admin is receiving the bulkorders content to the mail. but how to get the ordered user details through loggedin option? enter image description here In email, admin need to get the logged-in user name and email.

7

Get a logged user details.

if(Mage::getSingleton('customer/session')->isLoggedIn()) {
  $customer = Mage::getSingleton('customer/session')->getCustomer();
    $email = $customer->getEmail();
  }
1

You can not get directly logged in customer detail in cms page but you can get in phtml file for that you can call phtml in cms page and then get user detail in phtml

Call Phtml in cms page write below code

 {{block type="core/template"   template="mytemplate.phtml"}} 

In mytemplate.phtml You can write below code and get Logged in user detail

 <?php 
  $customer = Mage::getSingleton('customer/session')->getCustomer();
  $email = $customer->getEmail();// for email address
  $firstname = $customer->getFirstname();//  For first name
  $lastnam e= $customer->getLastname();// For last name
 ?> 

PLease try and let me know if you have Any quesions. and also you can direcly create form through this phtml file also.

3
  • I am not getting you please can you explain briefly Aug 25 '16 at 11:29
  • Please clear with your question please provide some info with screnshot and all Aug 25 '16 at 11:40
  • You are using these are the thing static You have to put these things on Phtml on the bases of condition you can load these page and send logged in user detail to your client You can call phtml via above syntax in phtml file Aug 25 '16 at 15:05
0

If I am understanding this correctly, you would like to see user details in an email. Email templates contain different methods for accessing data than that of a theme template.

You need to investigate the email templates and how to handle passing objects to them, then accessing the members and data of those objects.


If you are handling emails without using Magento's email methods, then perhaps you need to find out what methods and data are even available at the time the email is compiled for sending.

So this should assist with knowing what information is available:

$customerSession = Mage::getSingleton('customer/session');

if ($customerSession->isLoggedIn()) { 
   $customer = $customerSession->getCustomer();
   Zend_Debug::dump($customer->getData());
   Zend_Debug::dump(get_class_methods($customer));
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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