Double email field

Please post your issues and questions about One Page Checkout for Virtuemart 2 to this forum.

Double email field

Postby neil_portas@.....com » Mon Aug 06, 2012 5:34 pm

Hi,

The Double Email field in the Registration tab of OPC as it states "Generate another email field for extra validation. (usually used when selling digital products)" Does this mean that the customer confirms their same email address for extra validation if so can the field be renamed from "Email2"to "Confirm Email Address" like it does with the password field.
neil_portas@.....com
 
Posts: 6
Joined: Sat Jul 21, 2012 2:19 pm

Re: Double email field

Postby admin » Fri Aug 10, 2012 2:21 pm

Hello, yes, the double email field is used for validation of the email input and it has to be the same as the first email. The checkout will not continue if the two emails are not equal. You can change the text of the second email label "Email2" in the label editing part of OPC - at language editor tab, select:
- com_onepage.ini
- translate from en-GB
- translate to your frontend language
- click proceed to language editor
- the Email2 label is called "COM_ONEPAGE_EMAIL2" and is the second from the bottom

Best Regards,
Stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Re: Double email field

Postby neil_portas@.....com » Mon Aug 13, 2012 1:38 pm

Hi,

Thanks for that it worked great :)

One other thing on the back of this, is there a way of re-ordering the fields as it shows up as:

Email
Username
Confirm Email

Where it would be better to be either:

Email
Confirm Email
Username

or

Username
Email
Confirm Email
neil_portas@.....com
 
Posts: 6
Joined: Sat Jul 21, 2012 2:19 pm

Re: Double email field

Postby admin » Mon Aug 20, 2012 4:15 pm

Hello, we are going to fix the order right now. It should always be under the email.
Best Regards,
Stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Re: Double email field

Postby neil_portas@.....com » Wed Aug 29, 2012 1:01 pm

Hi,

I have just downloaded the most up to date version of OPC (2.0.82) and the email2 (Confirm email) still shows in the wrong place as the post above.
neil_portas@.....com
 
Posts: 6
Joined: Sat Jul 21, 2012 2:19 pm

Re: Double email field

Postby admin » Mon Sep 03, 2012 6:45 pm

hello neil, i just modified the file and the fix will be available in 2.0.83 version. As far as you display the email in the registration, i attached whole function here within this file:
\components\com_onepage\helpers\loader.php

Code: Select all
function getRegistrationHhtml($obj)
{
    if (!empty($no_login_in_template)) return "";
  include(JPATH_ROOT.DS.'components'.DS.'com_onepage'.DS.'config'.DS.'onepage.cfg.php');
    if (!class_exists('VirtueMartCart'))
    require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
   
   if (!empty($obj->cart))
   $cart =& $obj->cart;
   else
   $cart =& VirtueMartCart::getCart();
   
 
   
   
    $type = 'BT';
   $this->address_type = 'BT';
   // for unlogged
   $virtuemart_userinfo_id = 0;
   $this->$virtuemart_userinfo_id = 0;
   $new = 1;
   $fieldtype = $type . 'address';
   $cart->prepareAddressDataInCart($type, $new);
   if (!class_exists('VirtuemartModelUser'))
       require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'user.php');

   $this->setRegType();       

   
   if(!class_exists('VirtuemartModelUserfields')) require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'userfields.php');
   $corefields = VirtueMartModelUserfields::getCoreFields();
   $userFields = $cart->$fieldtype;

   $this->_model = new VirtuemartModelUser();
    $layout = 'default';
   //$registration_html;
   $fields['fields'] = array();
   foreach ($corefields as $f)
   foreach ($userFields['fields'] as $key=>$uf)   
   {
    if (!empty($opc_email_in_bt))
    {
      if ($uf['name'] == 'email') continue;
    }
   
    if (!empty($op_no_display_name))
    if ($uf['name'] == 'name')
     {
       continue;
     }
   
     if (!empty($op_usernameisemail) && ($uf['name'] == 'username'))
    {
    continue;
    }
   
    if (($uf['name'] == 'email') && (!empty($op_usernameisemail)))
    {
      
    }
   
     if ($f == $uf['name'] && ($uf['name'] != 'agreed'))
    {
     $l = $userFields['fields'][$key];
     if ($key != 'email')
     {
     $l['formcode'] = str_replace('/>', ' autocomplete="off" />', $l['formcode']);
     }
     else
     {
      
       $user = JFactory::getUser();
      // special case in j1.7 - guest login (activation pending)
         if (!empty($currentUser->guest) && ($currentUser->guest == '1'))
      {
        // we have a guest login here, therefore we will not let the user to change his email
        $l['formcode'] = str_replace('/>', ' readonly="readonly" />', $l['formcode']);
      }
      else
      {
      $uid = $user->get('id');
      // user is logged, but does not have a VM account
      if ((!$this->logged($cart)) && (!empty($uid)))
      {
        // the user is logged in only in joomla, but does not have an account with virtuemart
        $l['formcode'] = str_replace('/>', ' readonly="readonly" />', $l['formcode']);
      }
      }
     }
     if ($key == 'password')
      {
        $userFields['fields']['opc_password'] = $userFields['fields'][$key];
       $userFields['fields']['opc_password']['formcode'] = str_replace('password', 'opc_password', $userFields['fields']['opc_password']['formcode']);
       $userFields['fields']['opc_password']['formcode'] = str_replace('type="opc_password"', 'type="password" autocomplete="off" ', $userFields['fields']['opc_password']['formcode']);
       $userFields['fields']['opc_password']['name'] = 'opc_password';
       //unset($userFields['fields'][$key]);
       $l = $userFields['fields']['opc_password'];
      
      }
   
   if ($key == 'email')
    {
     $l['formcode'] = str_replace('class="required', 'class="required email ', $userFields['fields']['email']['formcode']);
    
   }
   
    $fields['fields'][$key]  = $l;
     }
   }
   
    if (empty($opc_email_in_bt) && (!empty($double_email)))
     {
       // email is in BT, let's check for double mail
      $email2 = $fields['fields']['email'];
      $email2['name'] = 'email2';
      $title = JText::_('COM_ONEPAGE_EMAIL2');
      if ($title != 'COM_ONEPAGE_EMAIL2')
      $email2['title'] = $title;
      $email2['formcode'] = str_replace('"email', '"email2', $email2['formcode']);
      $email2['formcode'] = str_replace('id=', ' onblur="javascript: doublemail_checkMail();" id=', $email2['formcode']);
      
      $h = '<span style="display: none; position: relative; color: red; font-size: 10px; background: none; border: none; padding: 0; margin: 0;" id="email2_info" class="email2_class">';
      $emailerr = JText::_('COM_ONEPAGE_EMAIL_DONT_MATCH');
      if ($emailerr != 'COM_ONEPAGE_EMAIL_DONT_MATCH')
      $h .= $emailerr;
      else $h .= "Emails don't match!";
      $h .= '</span>';
      $email2['formcode'] .= $h;
      
      
     }
   
   
    if (count($fields['fields'])===0)
   {
    // no fields found
    return '';
   }
   
   $fields2 = array();
   // lets move email to the top
   $copy = array();
      // we will reorder the fields, so the email is first
      
      /* uncomment this to have the email as the first field
      if (!empty($fields['fields']['email']))
       {
          $copy[] = $fields['fields']['email'];
          //var_dump($rowFields);
      
        foreach ($fields['fields'] as $k=>$f)
        {
          if ($k != 'email')
          $copy[] = $f;
        }
      }
      if (!empty($copy)) $fields['fields'] = $copy;
                // END uncomment this to have the email as the first field
      */
   if (empty($opc_email_in_bt) && (!empty($double_email)))
   $this->insertAfter($fields['fields'], 'email', $email2, 'email2');
   
   
   $vars = array('rowFields' => $fields,
             'cart', $obj, );
   $html = $this->fetch($this, 'list_user_fields.tpl', $vars);
   
   $html = str_replace("'password'", "'opc_password'", $html);
   return $html;
   
}
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm


Return to One Page Checkout for Virtuemart 2