-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.3
-- PHP version -- : 5.5
-- Browser(s) name and version -- : Chrome
-- Error-message(debug-mod must be tuned on) -- : no error message present
I want to add a css class to address labels in the checkout.
It seems that HTML output for these labels are created in administrator/components/com_hikashop/classes/field.php
function getFieldName($field,$requiredDisplay = false){
$app = JFactory::getApplication();
if($app->isAdmin())
return $this->trans($field->field_realname);
$required = '';
if($requiredDisplay && !empty($field->field_required))
$required = '<span class="hikashop_field_required_label">*</span>';
return '<label for="'.$this->prefix.$field->field_namekey.$this->suffix.'">'.$this->trans($field->field_realname).$required.'</label>';
}
should be changed into
function getFieldName($field,$requiredDisplay = false){
$app = JFactory::getApplication();
if($app->isAdmin())
return $this->trans($field->field_realname);
$required = '';
if($requiredDisplay && !empty($field->field_required))
$required = '<span class="hikashop_field_required_label">*</span>';
return '<label for="'.$this->prefix.$field->field_namekey.$this->suffix.'" class="col-sm-2 control-label">'.$this->trans($field->field_realname).$required.'</label>';
}
Next change is in the class hikashopText on line 1522 and further.
class hikashopText extends hikashopItem{
var $type = 'text';
var $class = 'inputbox';
function display($field, $value, $map, $inside, $options = '', $test = false, $allFields = null, $allValues = null){
$size = empty($field->field_options['size']) ? '' : 'size="'.intval($field->field_options['size']).'"';
$size .= empty($field->field_options['maxlength']) ? '' : ' maxlength="'.intval($field->field_options['maxlength']).'"';
$size .= empty($field->field_options['readonly']) ? '' : ' readonly="readonly"';
$size .= empty($field->field_options['placeholder']) ? '' : ' placeholder="'.JText::_($field->field_options['placeholder']).'"';
$js = '';
if($inside && strlen($value) < 1){
$value = addslashes($this->trans($field->field_realname));
$this->excludeValue[$field->field_namekey] = $value;
$js = 'onfocus="if(this.value == \''.$value.'\') this.value = \'\';" onblur="if(this.value==\'\') this.value=\''.$value.'\';"';
}
$buffInput = '<input class="'.$this->class.'" id="'.$this->prefix.@$field->field_namekey.$this->suffix.'" '.$size.' '.$js.' '.$options.' type="'.$this->type.'" name="'.$map.'" value="'.$value.'"';
if(!empty($field->field_required) && !empty($field->registration_page))
$buffInput.=' aria-required="true" required="required" />';
else
$buffInput .= ' />';
return $buffInput;
}
function show(&$field,$value){
if($field->field_table=='address') return $value;
return $this->trans($value);
}
}
should be changed into
class hikashopText extends hikashopItem{
var $type = 'text';
var $class = 'form-control';
function display($field, $value, $map, $inside, $options = '', $test = false, $allFields = null, $allValues = null){
$size = empty($field->field_options['size']) ? '' : 'size="'.intval($field->field_options['size']).'"';
$size .= empty($field->field_options['maxlength']) ? '' : ' maxlength="'.intval($field->field_options['maxlength']).'"';
$size .= empty($field->field_options['readonly']) ? '' : ' readonly="readonly"';
$size .= empty($field->field_options['placeholder']) ? '' : ' placeholder="'.JText::_($field->field_options['placeholder']).'"';
$js = '';
if($inside && strlen($value) < 1){
$value = addslashes($this->trans($field->field_realname));
$this->excludeValue[$field->field_namekey] = $value;
$js = 'onfocus="if(this.value == \''.$value.'\') this.value = \'\';" onblur="if(this.value==\'\') this.value=\''.$value.'\';"';
}
$buffInput = '<input class="'.$this->class.'" id="'.$this->prefix.@$field->field_namekey.$this->suffix.'" '.$size.' '.$js.' '.$options.' type="'.$this->type.'" name="'.$map.'" value="'.$value.'"';
if(!empty($field->field_required) && !empty($field->registration_page))
$buffInput.=' aria-required="true" required="required" />';
else
$buffInput .= ' />';
return $buffInput;
}
function show(&$field,$value){
if($field->field_table=='address') return $value;
return $this->trans($value);
}
}
How can this be done without a core hack?