News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

User field (fieldset) delimiter issue

Started by monkeybutt, June 15, 2012, 18:29:17 PM

Previous topic - Next topic

monkeybutt

Using Joomla 2.5 and VM 2.0.6

I have the "Create Account" section and the "Add/Edit Billing" sections in the user registration form (that were part of the installed data).

I need to create a third section ("Parent/Guardian Information"). I created a new user field, selected "Fieldset Delimiter" and wanted it to be a separator for the third section, functioning and displaying similarly to the above two.

However, it shows up as a blank fieldset below each of the two other sections and my new input field shows at the bottom of the form.

Screen shot set up for back and front end

I looked at edit_address_userfields.php (/com_virtuemart/views/user/tmpl/) but can't figure out if this is what i should work with (to set up override)

[attachment cleanup by admin]

nicole2292

I;m tearing my hair out. I have the same problem above. This is a huge bug!

Why on earth are the delimiters showing up multiple times?

Can someone please tell exactly what I need to edit in the following file to fix this?

components\com_virtuemart\views\user\tmpl\edit_address_userfields.php

I have tried editing this area of code and no luck fixing the problem...

if ($_field['type'] == 'delimiter') {
       if ($_set) {
      // We're in Fieldset. Close this one and start a new
      if ($_table) {
          echo '   </table>' . "\n";
          $_table = false;
      }
      echo '</fieldset>' . "\n";
       }
       $_set = true;
       echo '<fieldset>' . "\n";
       echo '   <legend>' . "\n";
       echo '      ' . $_field['title'];
       echo '   </legend>' . "\n";
       continue;
   }

Urgent help is needed...

nicole2292

Ok so I have had a bit more of a play with components\com_virtuemart\views\user\tmpl\edit_address_userfields.php and I have managed to hack together a solution which sort of works for me.

I have first commented out the part I mentioned previously as shown below:

/*if ($_field['type'] == 'delimiter') {
    if ($_set) {
// We're in Fieldset. Close this one and start a new
if ($_table) {
    echo ' </table>' . "\n";
    $_table = false;
}
echo '</fieldset>' . "\n";
    }
    $_set = true;
    echo '' . "\n";
    echo ' <legend>' . "\n";
    echo ' ' . $_field['title'];
    echo ' </legend>' . "\n";
    continue;
}*/// comment out to stop repeating elements


This stops the repeating elements and makes the delimiters at least show up the correct location.

Now I have just added an if statement into to the section below to make the delimiters behave as expected:


echo ' <table  class="adminForm user-details">' . "\n";
$_table = true;
    }
if ( $_field['type'] == 'delimiter') {
echo '</table>';
echo '<span class="userfields_info">' . $_field['title'] . '</span>';
echo '<table  class="adminForm user-details">';
} else {
echo ' <tr>' . "\n";
echo ' <td class="key">' . "\n";
echo ' <label class="' . $_field['name'] . '" for="' . $_field['name'] . '_field">' . "\n";
echo ' ' . $_field['title'] . ($_field['required'] ? ' *' : '') . "\n";
echo ' </label>' . "\n";
echo ' </td>' . "\n";
echo ' <td>' . "\n";
echo ' ' . $_field['formcode'] . "\n";
echo ' </td>' . "\n";
echo ' </tr>' . "\n";
}

dzséti

I am using 2.0.10 and have had similar problems (which may have been fixed in a later version).

The main problem is that there is no information attached to the delimiter field that identifies it as belonging to either to corefields or to billto - so it comes up twice. To correct this:

1) add "&& $typefield == 'billto'" to the "if" codeif ( $_field['type'] == 'delimiter' && $typefield == 'billto') {

2) to stop a repeat of the billto title a table also needs to be started - so at the end of the "if" code just before the "continue" add: echo ' <table  class="adminForm user-details">' . "\n";
$_table = true;


I have also made these changes (partly personal taste):
1) To ensure that there is always a fieldset I have added this to the start of the foreach loop (changing the false to true)echo '<fieldset>' . "\n";
$_set = true;


2) And I have put the delimiter into a <span> not <legend> tag - this puts the delimiter title on the same level as the titles for the two main groups: corefields and billto
echo '<span class="userfields_info">' . $_field['title'] . '</span>';

Hope this helps others ...

moustik_3

#4
I have the same problem... repeating delimiters twice (1 blank and 1 correct) + the .userfields_info stand inside the delimiter i just created (and shouldn't be). I tried to edit the code in edit_address_userfields.php as mentioned earlier in this post but didn't work for now... kinda need some help here :)

[attachment cleanup by admin]

Foothill Web Design

Thanks for directing me here. I am having the same problem. Is this a known bug yet? All I need to do is add a third group and some custom fields at the bottom of the registration field. My other thread was locked and I was directed here so a response from VM Team would be muchly appreciated. :)

Milbo

It is indeed a bug. I fear it wont be in the 2.0.16 versions. Missing delimiter can be reproduced via layout quite easily. But maybe we fix it today, depends on me and Eugen. Buy us a chocolata. Invite us to the beach with a lot of girls, that should help :-)
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Eugen S.

#7
Max and me were able to fix it today. If you can`t wait for the next release of VirtueMart you can follow this steps.

1. Please open the following file:
administrator/components/com_virtuemart/models/userfields.php

Find the following in Line 467 - 468

//Maybe there is another method to define the skips
$skips = array('delimiter_userinfo', 'delimiter_billto','address_type');


and replace it with:

//Maybe there is another method to define the skips
$skips = array('address_type');


2. Please open the following file:
components/com_virtuemart/views/user/tmpl/edit_address_userfields.php

Replace the whole code in that file with the following:

<?php

/**
 *
 * Modify user form view, User info
 *
 * @package VirtueMart
 * @subpackage User
 * @author Oscar van Eijk, Eugen Stranz
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: edit_address_userfields.php 6349 2012-08-14 16:56:24Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

// Status Of Delimiter
$closeDelimiter false;
$openTable true;
$hiddenFields '';

// Output: Userfields
foreach($this->userFields['fields'] as $field) {

if($field['type'] == 'delimiter') {

// For Every New Delimiter
// We need to close the previous
// table and delimiter
if($closeDelimiter) { ?>

</table>
</fieldset>
<?php
?>


<fieldset>
<span class="userfields_info"><?php echo $field['title'?></span>

<?php
$closeDelimiter true;
$openTable true;

} elseif ($field['hidden'] == true) {

// We collect all hidden fields
// and output them at the end
$hiddenFields .= $field['formcode'] . "\n";

} else {

// If we have a new delimiter
// we have to start a new table
if($openTable) {
$openTable false;
?>


<table  class="adminForm user-details">

<?php
}

// Output: Userfields
?>

<tr>
<td class="key" title="<?php echo $field['description'?>" >
<label class="<?php echo $field['name'?>" for="<?php echo $field['name'?>_field">
<?php echo $field['title'] . ($field['required'] ? ' *' ''?>
</label>
</td>
<td>
<?php echo $field['formcode'?>
</td>
</tr>
<?php
}

}

// At the end we have to close the current
// table and delimiter 
?>


</table>
</fieldset>

<?php // Output: Hidden Fields
echo $hiddenFields
?>




Kind regards
Eugen
Send me a pm ;-)

trifanfan

#8
Sorry to re-open the post that late but I do not agree completly with the fix - I am facing another matter because of it.
I am VirtueMart 2.6.10 and Joomla 2.5.25.
And I need to a fix to have it working properly tanks.

This is the sequence of the end of user info fieldset (delimiter_userinfo) and the begining of bill to (delimiter_billto).
As you can see as first displayed the type fields email, username, password... and then the delimiter_userinfo within the fieldset and uncorrectly as the table is closed within.
The delimiter_billto is correct.

</tr>
               <tr>
               <td class="key" title="" >
                  <label class="agreed" for="agreed_field">
                     J'accepte les Conditions Générales de Vente                  </label>
               </td>
               <td>
                  <input type="checkbox" name="agreed" id="agreed_field" value="1" />               </td>
            </tr>
            <fieldset>
         <span class="userfields_info">Informations client</span>

                  </table>
      </fieldset>
               <fieldset>
         <span class="userfields_info">Informations de facturation</span>

         
         <table  class="adminForm user-details">

                  <tr>
               <td class="key" title="" >
                  <label class="company" for="company_field">
                     Nom de la société                  </label>
               </td>



That comes from the fact that delimiter_userinfo come after the fields email, username, password instead of first like the delimiter_billto.
We can see that displaying the userFields - print_r($this->userFields);
To me the delimiter_userinfo should appear first within the array before email to have it working with your code.

Array ( [fields] => Array ( [email] => Array ( [name] => email [value] => [title] => E-mail [type] => emailaddress [required] => 1 [hidden] => [formcode] => [description] => ) [username] => Array ( [name] => username [value] => [title] => Nom d'utilisateur [type] => text [required] => 0 [hidden] => [formcode] => [description] => ) [name] => Array ( [name] => name [value] => [title] => Nom à afficher [type] => text [required] => 0 [hidden] => [formcode] => [description] => ) [password] => Array ( [name] => password [value] => [title] => Mot de passe [type] => password [required] => 0 [hidden] => [formcode] => [description] => ) [password2] => Array ( [name] => password2 [value] => [title] => Confirmer le mot de passe [type] => password [required] => 0 [hidden] => [formcode] => [description] => ) [agreed] => Array ( [name] => agreed [value] => [title] => J'accepte les Conditions Générales de Vente [type] => checkbox [required] => 0 [hidden] => [formcode] => [description] => ) [delimiter_userinfo] => Array ( [name] => delimiter_userinfo [value] => [title] => Informations client [type] => delimiter [required] => 0 [hidden] => [formcode] => [description] => ) [delimiter_billto] => Array ( [name] => delimiter_billto [value] => [title] => Informations de facturation [type] => delimiter [required] => 0 [hidden] => [formcode] => [description] => ) [company] => Array ( [name] => company [value] => [title] => Nom de la société [type] => text [required] => 0 [hidden] => [formcode] => [description] => ) [title] => Array ( [name] => title [value] => [title] => Civilité [type] => select [required] => 0 [hidden] => [formcode] =>

[description] => ) [first_name] => Array ( [name] => first_name [value] => [title] => Prénom [type] => text [required] => 1 [hidden] => [formcode] => [description] => ) [middle_name] => Array ( [name] => middle_name [value] => [title] => 2ème Prénom [type] => text [required] => 0 [hidden] => [formcode] => [description] => ) [last_name] => Array ( [name] => last_name [value] => [title] => Nom [type] => text [required] => 1 [hidden] => [formcode] => [description] => ) [address_1] => Array ( [name] => address_1 [value] => [title] => Adresse 1 [type] => text [required] => 1 [hidden] => [formcode] => [description] => ) [address_2] => Array ( [name] => address_2 [value] => [title] => Complément d'adresse [type] => text [required] => 0 [hidden] => [formcode] => [description] => ) [zip] => Array ( [name] => zip [value] => [title] => Code postal [type] => text [required] => 1 [hidden] => [formcode] => [description] => ) [city] => Array ( [name] => city [value] => [title] => Ville [type] => text [required] => 1 [hidden] => [formcode] => [description] => ) [virtuemart_country_id] => Array ( [name] => virtuemart_country_id [value] => [title] => Pays [type] => select [required] => 1 [hidden] => [formcode] =>

[description] => [country_2_code] => [country_3_code] => ) [virtuemart_state_id] => Array ( [name] => virtuemart_state_id [value] => [title] => État/Province/Région [type] => select [required] => 1 [hidden] => [formcode] =>

[description] => [state_2_code] => [state_3_code] => ) [phone_1] => Array ( [name] => phone_1 [value] => [title] => Téléphone [type] => text [required] => 0 [hidden] => [formcode] => [description] => ) [phone_2] => Array ( [name] => phone_2 [value] => [title] => Portable [type] => text [required] => 0 [hidden] => [formcode] => [description] => ) [fax] => Array ( [name] => fax [value] => [title] => Fax [type] => text [required] => 0 [hidden] => [formcode] => [description] => ) ) [functions] => Array ( ) [scripts] => Array ( ) [links] => Array ( ) )

VopoloS

Quote from: Eugen S. on January 04, 2013, 13:24:53 PM
Max and me were able to fix it today. If you can`t wait for the next release of VirtueMart you can follow this steps.

1. Please open the following file:
administrator/components/com_virtuemart/models/userfields.php

Find the following in Line 467 - 468

//Maybe there is another method to define the skips
$skips = array('delimiter_userinfo', 'delimiter_billto','address_type');


and replace it with:

//Maybe there is another method to define the skips
$skips = array('address_type');


2. Please open the following file:
components/com_virtuemart/views/user/tmpl/edit_address_userfields.php

Replace the whole code in that file with the following:

<?php

/**
 *
 * Modify user form view, User info
 *
 * @package VirtueMart
 * @subpackage User
 * @author Oscar van Eijk, Eugen Stranz
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: edit_address_userfields.php 6349 2012-08-14 16:56:24Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

// Status Of Delimiter
$closeDelimiter false;
$openTable true;
$hiddenFields '';

// Output: Userfields
foreach($this->userFields['fields'] as $field) {

if($field['type'] == 'delimiter') {

// For Every New Delimiter
// We need to close the previous
// table and delimiter
if($closeDelimiter) { ?>

</table>
</fieldset>
<?php
?>


<fieldset>
<span class="userfields_info"><?php echo $field['title'?></span>

<?php
$closeDelimiter true;
$openTable true;

} elseif ($field['hidden'] == true) {

// We collect all hidden fields
// and output them at the end
$hiddenFields .= $field['formcode'] . "\n";

} else {

// If we have a new delimiter
// we have to start a new table
if($openTable) {
$openTable false;
?>


<table  class="adminForm user-details">

<?php
}

// Output: Userfields
?>

<tr>
<td class="key" title="<?php echo $field['description'?>" >
<label class="<?php echo $field['name'?>" for="<?php echo $field['name'?>_field">
<?php echo $field['title'] . ($field['required'] ? ' *' ''?>
</label>
</td>
<td>
<?php echo $field['formcode'?>
</td>
</tr>
<?php
}

}

// At the end we have to close the current
// table and delimiter 
?>


</table>
</fieldset>

<?php // Output: Hidden Fields
echo $hiddenFields
?>




Kind regards
Eugen

No valid...
===================
</tr>
<fieldset>
<span class="userfields_info">Text</span>

</fieldset>
</table>

================