Customers / Users attributes and extra fields
Login

New to DJ-Extensions?

Customers / Users attributes and extra fields

In version 3.9 of DJ-Catalog2, we have introduced a system that allows you to control customer attributes more flexibly and also create custom fields.
You will find core attributes that had already been present in previous versions, which are usually needed to create user profiles or conduct purchases, for example, address, phone, email. Those fields are created by default and should rather not be removed from the system. There is also the possibility to add your own fields and you can select from the following types:
  1. Text - single-line text field
  2. Textarea - multi-line text field
  3. Calendar / Date - date picker
  4. Select - drop-down list
  5. Radio - single choice list of radio buttons
  6. Checkbox - multiple-choice list of checkboxes
  7. Boolean - checkbox [true/false]
  8. File upload 
  9. HTML
  10. Spacer - more information
  11. Note - more information
As you can see you can also select in which predefined set of form fields should the attribute appear. You can choose from:
  • Basic / Billing details
  • Statements and Agreements
And finally, you can make the field optional, required, or hidden per each of the available forms, that is:
  • User registration (standard Joomla! registration page)
  • User profile edit form (standard Joomla! user profile page)
  • Checkout - when customer user makes a new order,
  • Query - when a customer inquires about products in the cart.

Important: Because of the backward compatibility that had to be maintained, the default fields use the labels that can be translated in the language file or language overrides. This is why you might notice field labels such as COM_DJCATALOG2_UP_FIRSTNAME instead of "First name" or COM_DJCATALOG2_UP_ADDRESS instead of "Address".

Customization required: depending on your Joomla! version or layout overrides that are created in your template, you might need to create an override of the following layout file:

/components/com_users/views/profile/tmpl/edit.php
If you haven't created an override for that file, please copy it to your template directory, to the following path:
/templates/[your-template]/html/com_users/profile/edit.php
Then replace the following contents (lines no. 72-88)
<div class="control-group">
<div class="control-label">
<?php echo $field->label; ?>
<?php if (!$field->required && $field->type !== 'Spacer') : ?>
<span class="optional">
<?php echo JText::_('COM_USERS_OPTIONAL'); ?>
</span>
<?php endif; ?>
</div>
<div class="controls">
<?php if ($field->fieldname === 'password1') : ?>
<?php // Disables autocomplete ?>
<input type="password" style="display:none">
<?php endif; ?>
<?php echo $field->input; ?>
</div>
</div>

with:

<?php if ($field->fieldname === 'password1') : ?>
<div class="control-group">
<div class="control-label">
<?php echo $field->label; ?>
<?php if (!$field->required && $field->type !== 'Spacer') : ?>
<span class="optional">
<?php echo JText::_('COM_USERS_OPTIONAL'); ?>
</span>
<?php endif; ?>
</div>
<div class="controls">
<?php if ($field->fieldname === 'password1') : ?>
<?php // Disables autocomplete ?>
<input type="password" style="display:none">
<?php endif; ?>
<?php echo $field->input; ?>
</div>
</div>
<?php else :?>
<?php echo $field->renderField();?>
<?php endif; ?>

© 2023 DJ-Extensions.com. All rights reserved.