VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: luken on October 26, 2012, 00:42:41 AM

Title: Get user field from session
Post by: luken on October 26, 2012, 00:42:41 AM
Hi.
i have a select list in the user registration.
The values can be 1 or 2.
I did use this code to add a recipient email,
http://forum.virtuemart.net/index.php?topic=102375.msg343686#msg343686

And  i added this lines to select the recipent depending the value selected.
if($vendor){   //this is the mail to the vendor!
               $db = JFactory::getDBO();
       $user = JFactory::getUser();
       $user1 = ($user->get('id'));
    $query = 'SELECT `Zona` ' . ' FROM `#__virtuemart_userinfos` ' . ' WHERE `virtuemart_user_id` =' .$user1 ;
      $db->setQuery($query);
       $result1 = $db->loadResult();
   if ($result1<2) {
$mailer->addRecipient('mymail1@mysite.com');}   
       else {
      $mailer->addRecipient('mymail2@mysite.com');}

Seems to work to registered users.
i will like use it with guests too.
How can i get the values of the select list from session?
Thanks