Answer the question
In order to leave comments, you need to log in
Custom fields $field['formcode']?
Good evening! Let's say I created a "Phone number" field in the VM3 settings. It is displayed in the shopping cart and is mandatory, but I do not like its appearance, but the view can be edited using CSS. Then I want the field name to be displayed not to the left of the field itself, but, say, in the placeholder. Here I ran into a problem, because. I can't find the file that generates the custom field.
More precisely, in the default_cartfields.php file at components\com_virtuemart\views\cart\tmpl\ there is the following code:
<?php
// Status Of Delimiter
$closeDelimiter = false;
$openTable = true;
$hiddenFields = '';
if(!empty($this->userFieldsCart['fields'])) {
// Output: Userfields
foreach($this->userFieldsCart['fields'] as $field) {
?>
<fieldset class="vm-fieldset1-<?php echo str_replace('_','-',$field['name']) ?>">
<div class="cart <?php echo str_replace('_','-',$field['name']) ?>" title="<?php echo strip_tags($field['description']) ?>">
<?php
if ($field['hidden'] == true) {
// We collect all hidden fields
// and output them at the end
$hiddenFields .= $field['formcode'] . "\n";
} else { ?>
<?php echo $field['formcode'] . "ss"; ?>
<?php } ?>
</div>
</fieldset>
<?php
}
// Output: Hidden Fields
echo $hiddenFields;
}
?>
<?php
if ($field['hidden'] == true) {
// We collect all hidden fields
// and output them at the end
$hiddenFields .= $field['formcode'] . "\n";
} else { ?>
<?php echo $field['formcode'] . "ss"; ?>
<?php } ?>
<?php echo $field['formcode']; ?>
Answer the question
In order to leave comments, you need to log in
in Virtuemart 3
/administrator/components/com_virtuemart/models/userfields.php
line 929
case 'webaddress':
$_return['fields'][$_fld->name]['formcode'] = '<input type="text" id="'
. $_prefix.$_fld->name . '_field" name="' . $_prefix.$_fld->name.'" size="' . $_fld->size
. '" value="' . $_return['fields'][$_fld->name]['value'] .'" '
. ($_fld->required ? ' class="required"' : '')
. ($_fld->maxlength ? ' maxlength="' . $_fld->maxlength . '"' : '')
. $readonly . ' /> ';
break;
case 'webaddress':
$_return['fields'][$_fld->name]['formcode'] = '<input type="text" id="'
. $_prefix.$_fld->name . '_field" name="' . $_prefix.$_fld->name.'" size="' . $_fld->size
. '" value="' . $_return['fields'][$_fld->name]['value'] .'"
placeholder="'.$_fld->title.($_fld->required ? '*' : '').'"'
. ($_fld->required ? ' class="required"' : '')
. ($_fld->maxlength ? ' maxlength="' . $_fld->maxlength . '"' : '')
. $readonly . ' /> ';
break;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question