- 22 Jan 2018, 13:53
#76884
Boa tarde pessoal. Beleza?
Seguinte.
To tendo um problema ao tentar cadastrar um novo endereço ou editar um endereço já cadastrado quando o cliente está logado.
Ao clicar em Cadastrar ou editar aparece o seguinte erro:
Parse error: syntax error, unexpected '?' in C:\wamp64\www\site\catalog\view\theme\felixtheme\template\account\address_form.tpl on line 49
Olhei na linha 49 deste arquivo e está assim:
Valeu.. Até mais..
Seguinte.
To tendo um problema ao tentar cadastrar um novo endereço ou editar um endereço já cadastrado quando o cliente está logado.
Ao clicar em Cadastrar ou editar aparece o seguinte erro:
Parse error: syntax error, unexpected '?' in C:\wamp64\www\site\catalog\view\theme\felixtheme\template\account\address_form.tpl on line 49
Olhei na linha 49 deste arquivo e está assim:
Código: Selecionar todos
Este é o código do arquivo address_form.tpl
<?php if($error_city) { ?
Código: Selecionar todos
Pelo que percebi tem a ver com o campo cidade... O que posso fazer pra corrigir isso pessoal?<?php echo $header;
$theme_options = $registry->get('theme_options');
$config = $registry->get('config');
include('catalog/view/theme/' . $config->get('theme_' . $config->get('config_theme') . '_directory') . '/template/new_elements/wrapper_top.tpl'); ?>
<h2><?php echo $text_address; ?></h2>
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" class="form-horizontal">
<fieldset>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-firstname"><?php echo $entry_firstname; ?></label>
<div class="col-sm-10">
<input type="text" name="firstname" value="<?php echo $firstname; ?>" placeholder="<?php echo $entry_firstname; ?>" id="input-firstname" class="form-control" />
<?php if($error_firstname) { ?>
<div class="text-danger"><?php echo $error_firstname; ?></div>
<?php } ?> </div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-lastname"><?php echo $entry_lastname; ?></label>
<div class="col-sm-10">
<input type="text" name="lastname" value="<?php echo $lastname; ?>" placeholder="<?php echo $entry_lastname; ?>" id="input-lastname" class="form-control" />
<?php if($error_lastname) { ?>
<div class="text-danger"><?php echo $error_lastname; ?></div>
<?php } ?> </div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-company"><?php echo $entry_company; ?></label>
<div class="col-sm-10">
<input type="text" name="company" value="<?php echo $company; ?>" placeholder="<?php echo $entry_company; ?>" id="input-company" class="form-control" />
</div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-address-1"><?php echo $entry_address_1; ?></label>
<div class="col-sm-10">
<input type="text" name="address_1" value="<?php echo $address_1; ?>" placeholder="<?php echo $entry_address_1; ?>" id="input-address-1" class="form-control" />
<?php if($error_address_1) { ?>
<div class="text-danger"><?php echo $error_address_1; ?></div>
<?php } ?> </div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-address-2"><?php echo $entry_address_2; ?></label>
<div class="col-sm-10">
<input type="text" name="address_2" value="<?php echo $address_2; ?>" placeholder="<?php echo $entry_address_2; ?>" id="input-address-2" class="form-control" />
</div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-city"><?php echo $entry_city; ?></label>
<div class="col-sm-10">
<input type="text" name="city" value="<?php echo $city; ?>" placeholder="<?php echo $entry_city; ?>" id="input-city" class="form-control" />
<?php if($error_city) { ?
<div class="text-danger"><?php echo $error_city; ?></div>
<?php } ?> </div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-postcode"><?php echo $entry_postcode; ?></label>
<div class="col-sm-10">
<input type="text" name="postcode" value="<?php echo $postcode; ?>" placeholder="<?php echo $entry_postcode; ?>" id="input-postcode" class="form-control" />
<?php if($error_postcode) { ?>
<div class="text-danger"><?php echo $error_postcode; ?></div>
<?php } ?> </div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-country"><?php echo $entry_country; ?></label>
<div class="col-sm-10">
<select name="country_id" id="input-country" class="form-control">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($countries as $country) { ?>
<?php if($country['country_id'] == $country_id) { ?>
<option value="<?php echo $country['country_id']; ?>" selected="selected"><?php echo $country['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option>
<?php } ?>
<?php } ?>
</select>
<?php if($error_country) { ?>
<div class="text-danger"><?php echo $error_country; ?></div>
<?php } ?> </div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-zone"><?php echo $entry_zone; ?></label>
<div class="col-sm-10">
<select name="zone_id" id="input-zone" class="form-control">
</select>
<?php if($error_zone) { ?>
<div class="text-danger"><?php echo $error_zone; ?></div>
<?php } ?> </div>
</div>
<?php foreach ($custom_fields as $custom_field) { ?>
<?php if($custom_field['type'] == 'select') { ?>
<div class="form-group<?php if($custom_field['required']) { ?> required <?php } ?> custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
<label class="col-sm-2 control-label" for="input-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
<div class="col-sm-10">
<select name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" id="input-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?>
<?php $test = $custom_field['custom_field_id'];
if(!isset($address_custom_field[$test])) { $address_custom_field[$test] = false; } if($address_custom_field[$test] && $custom_field_value['custom_field_value_id'] == $address_custom_field[$test]) { ?>
<option value="<?php echo $custom_field_value['custom_field_value_id']; ?>" selected="selected"><?php echo $custom_field_value['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $custom_field_value['custom_field_value_id']; ?>"><?php echo $custom_field_value['name']; ?></option>
<?php } ?>
<?php } ?>
</select>
<?php if(!isset($error_custom_field[$test])) { $error_custom_field[$test] = false; } if($error_custom_field[$test]) { ?>
<div class="text-danger"><?php echo $error_custom_field[$test]; ?></div>
<?php } ?></div>
</div>
<?php } ?>
<?php if($custom_field['type'] == 'radio') { ?>
<div class="form-group<?php if($custom_field['required']) { ?> required <?php } ?> custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
<label class="col-sm-2 control-label"><?php echo $custom_field['name']; ?></label>
<div class="col-sm-10">
<div> <?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?>
<div class="radio">
<?php $test = $custom_field['custom_field_id'];
if(!isset($address_custom_field[$test])) { $address_custom_field[$test] = false; } if($address_custom_field[$test] && $custom_field_value['custom_field_value_id'] == $address_custom_field[$test]) { ?>
<label>
<input type="radio" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" checked="checked" />
<?php echo $custom_field_value['name']; ?></label>
<?php } else { ?>
<label>
<input type="radio" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" />
<?php echo $custom_field_value['name']; ?></label>
<?php } ?> </div>
<?php } ?></div>
<?php if(!isset($error_custom_field[$test])) { $error_custom_field[$test] = false; } if($error_custom_field[$test]) { ?>
<div class="text-danger"><?php echo $error_custom_field[$test]; ?></div>
<?php } ?> </div>
</div>
<?php } ?>
<?php if($custom_field['type'] == 'checkbox') { ?>
<div class="form-group<?php if($custom_field['required']) { ?> required <?php } ?> custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
<label class="col-sm-2 control-label"><?php echo $custom_field['name']; ?></label>
<div class="col-sm-10">
<div> <?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?>
<div class="checkbox"> <?php $test = $custom_field['custom_field_id'];
if(!isset($address_custom_field[$test])) { $address_custom_field[$test] = false; } if($address_custom_field[$test] && $custom_field_value['custom_field_value_id'] == $address_custom_field[$test]) { ?>
<label>
<input type="checkbox" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>][]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" checked="checked" />
<?php echo $custom_field_value['name']; ?></label>
<?php } else { ?>
<label>
<input type="checkbox" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>][]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" />
<?php echo $custom_field_value['name']; ?></label>
<?php } ?> </div>
<?php } ?> </div>
<?php if(!isset($error_custom_field[$test])) { $error_custom_field[$test] = false; } if($error_custom_field[$test]) { ?>
<div class="text-danger"><?php echo $error_custom_field[$test]; ?></div>
<?php } ?> </div>
</div>
<?php } ?>
<?php if($custom_field['type'] == 'text') { ?>
<div class="form-group<?php if($custom_field['required']) { ?> required <?php } ?> custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
<label class="col-sm-2 control-label" for="input-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
<div class="col-sm-10">
<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php $test = $custom_field['custom_field_id']; if(!isset($address_custom_field[$test])) { $address_custom_field[$test] = false; } if($address_custom_field[$test]) { ?><?php echo $address_custom_field[$test]; ?><?php } else { ?><?php echo $custom_field['value']; ?><?php } ?>" placeholder="<?php echo $custom_field['name']; ?>" id="input-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
<?php if(!isset($error_custom_field[$test])) { $error_custom_field[$test] = false; } if($error_custom_field[$test]) { ?>
<div class="text-danger"><?php echo $error_custom_field[$test]; ?></div>
<?php } ?> </div>
</div>
<?php } ?>
<?php if($custom_field['type'] == 'textarea') { ?>
<div class="form-group<?php if($custom_field['required']) { ?> required <?php } ?> custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
<label class="col-sm-2 control-label" for="input-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
<div class="col-sm-10">
<textarea name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" rows="5" placeholder="<?php echo $custom_field['name']; ?>" id="input-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control"><?php $test = $custom_field['custom_field_id']; if(!isset($address_custom_field[$test])) { $address_custom_field[$test] = false; } if($address_custom_field[$test]) { ?><?php echo $address_custom_field[$test]; ?><?php } else { ?><?php echo $custom_field['value']; ?><?php } ?></textarea>
<?php if(!isset($error_custom_field[$test])) { $error_custom_field[$test] = false; } if($error_custom_field[$test]) { ?>
<div class="text-danger"><?php echo $error_custom_field[$test]; ?></div>
<?php } ?> </div>
</div>
<?php } ?>
<?php if($custom_field['type'] == 'file') { ?>
<div class="form-group<?php if($custom_field['required']) { ?> required <?php } ?> custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
<label class="col-sm-2 control-label"><?php echo $custom_field['name']; ?></label>
<div class="col-sm-10">
<button type="button" id="button-custom-field<?php echo $custom_field['custom_field_id']; ?>" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-default"><i class="fa fa-upload"></i> <?php echo $button_upload; ?></button>
<input type="hidden" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php $test = $custom_field['custom_field_id']; if(!isset($address_custom_field[$test])) { $address_custom_field[$test] = false; } if($address_custom_field[$test]) { ?> <?php echo $address_custom_field[$test]; ?> <?php } ?>" />
<?php if(!isset($error_custom_field[$test])) { $error_custom_field[$test] = false; } if($error_custom_field[$test]) { ?>
<div class="text-danger"><?php echo $error_custom_field[$test]; ?></div>
<?php } ?> </div>
</div>
<?php } ?>
<?php if($custom_field['type'] == 'date') { ?>
<div class="form-group<?php if($custom_field['required']) { ?> required <?php } ?> custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
<label class="col-sm-2 control-label" for="input-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
<div class="col-sm-10">
<div class="input-group date">
<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php $test = $custom_field['custom_field_id']; if(!isset($address_custom_field[$test])) { $address_custom_field[$test] = false; } if($address_custom_field[$test]) { ?><?php echo $address_custom_field[$test]; ?><?php } else { ?><?php echo $custom_field['value']; ?><?php } ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="YYYY-MM-DD" id="input-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
<span class="input-group-btn">
<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
</span></div>
<?php if(!isset($error_custom_field[$test])) { $error_custom_field[$test] = false; } if($error_custom_field[$test]) { ?>
<div class="text-danger"><?php echo $error_custom_field[$test]; ?></div>
<?php } ?> </div>
</div>
<?php } ?>
<?php if($custom_field['type'] == 'time') { ?>
<div class="form-group<?php if($custom_field['required']) { ?> required <?php } ?> custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
<label class="col-sm-2 control-label" for="input-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
<div class="col-sm-10">
<div class="input-group time">
<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php $test = $custom_field['custom_field_id']; if(!isset($address_custom_field[$test])) { $address_custom_field[$test] = false; } if($address_custom_field[$test]) { ?><?php echo $address_custom_field[$test]; ?><?php } else { ?><?php echo $custom_field['value']; ?><?php } ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="HH:mm" id="input-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
<span class="input-group-btn">
<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
</span></div>
<?php if(!isset($error_custom_field[$test])) { $error_custom_field[$test] = false; } if($error_custom_field[$test]) { ?>
<div class="text-danger"><?php echo $error_custom_field[$test]; ?></div>
<?php } ?> </div>
</div>
<?php } ?>
<?php if($custom_field['type'] == 'time') { ?>
<div class="form-group<?php if($custom_field['required']) { ?> required <?php } ?> custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
<label class="col-sm-2 control-label" for="input-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
<div class="col-sm-10">
<div class="input-group datetime">
<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php $test = $custom_field['custom_field_id']; if(!isset($address_custom_field[$test])) { $address_custom_field[$test] = false; } if($address_custom_field[$test]) { ?><?php echo $address_custom_field[$test]; ?><?php } else { ?><?php echo $custom_field['value']; ?><?php } ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="HH:mm" id="input-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
<span class="input-group-btn">
<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
</span></div>
<?php if(!isset($error_custom_field[$test])) { $error_custom_field[$test] = false; } if($error_custom_field[$test]) { ?>
<div class="text-danger"><?php echo $error_custom_field[$test]; ?></div>
<?php } ?> </div>
</div>
<?php } ?>
<?php } ?>
<div class="form-group">
<label class="col-sm-2 control-label"><?php echo $entry_default; ?></label>
<div class="col-sm-10"> <?php if($default) { ?>
<label class="radio-inline">
<input type="radio" name="default" value="1" checked="checked" />
<?php echo $text_yes; ?></label>
<label class="radio-inline">
<input type="radio" name="default" value="0" />
<?php echo $text_no; ?></label>
<?php } else { ?>
<label class="radio-inline">
<input type="radio" name="default" value="1" />
<?php echo $text_yes; ?></label>
<label class="radio-inline">
<input type="radio" name="default" value="0" checked="checked" />
<?php echo $text_no; ?></label>
<?php } ?> </div>
</div>
</fieldset>
<div class="buttons clearfix">
<div class="pull-left"><a href="<?php echo $back; ?>" class="btn btn-default"><?php echo $button_back; ?></a></div>
<div class="pull-right">
<input type="submit" value="<?php echo $button_continue; ?>" class="btn btn-primary" />
</div>
</div>
</form>
<script type="text/javascript"><!--
// Sort the custom fields
$('.form-group[data-sort]').detach().each(function() {
if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('.form-group').length-2) {
$('.form-group').eq(parseInt($(this).attr('data-sort'))+2).before(this);
}
if ($(this).attr('data-sort') > $('.form-group').length-2) {
$('.form-group:last').after(this);
}
if ($(this).attr('data-sort') == $('.form-group').length-2) {
$('.form-group:last').after(this);
}
if ($(this).attr('data-sort') < -$('.form-group').length-2) {
$('.form-group:first').before(this);
}
});
//--></script>
<script type="text/javascript"><!--
$('button[id^=\'button-custom-field\']').on('click', function() {
var element = this;
$('#form-upload').remove();
$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');
$('#form-upload input[name=\'file\']').trigger('click');
if (typeof timer != 'undefined') {
clearInterval(timer);
}
timer = setInterval(function() {
if ($('#form-upload input[name=\'file\']').val() != '') {
clearInterval(timer);
$.ajax({
url: 'index.php?route=tool/upload',
type: 'post',
dataType: 'json',
data: new FormData($('#form-upload')[0]),
cache: false,
contentType: false,
processData: false,
beforeSend: function() {
$(element).button('loading');
},
complete: function() {
$(element).button('reset');
},
success: function(json) {
$(element).parent().find('.text-danger').remove();
if (json['error']) {
$(element).parent().find('input').after('<div class="text-danger">' + json['error'] + '</div>');
}
if (json['success']) {
alert(json['success']);
$(element).parent().find('input').val(json['code']);
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}
}, 500);
});
//--></script>
<script type="text/javascript"><!--
$('.date').datetimepicker({
language: '<?php echo $datepicker; ?>',
pickTime: false
});
$('.datetime').datetimepicker({
language: '<?php echo $datepicker; ?>',
pickDate: true,
pickTime: true
});
$('.time').datetimepicker({
language: '<?php echo $datepicker; ?>',
pickDate: false
});
//--></script>
<script type="text/javascript"><!--
$('select[name=\'country_id\']').on('change', function() {
$.ajax({
url: 'index.php?route=account/account/country&country_id=' + this.value,
dataType: 'json',
beforeSend: function() {
$('select[name=\'country_id\']').prop('disabled', true);
},
complete: function() {
$('select[name=\'country_id\']').prop('disabled', false);
},
success: function(json) {
if (json['postcode_required'] == '1') {
$('input[name=\'postcode\']').parent().parent().addClass('required');
} else {
$('input[name=\'postcode\']').parent().parent().removeClass('required');
}
html = '<option value=""><?php echo $text_select; ?></option>';
if (json['zone'] && json['zone'] != '') {
for (i = 0; i < json['zone'].length; i++) {
html += '<option value="' + json['zone'][i]['zone_id'] + '"';
if (json['zone'][i]['zone_id'] == '<?php echo $zone_id; ?>') {
html += ' selected="selected"';
}
html += '>' + json['zone'][i]['name'] + '</option>';
}
} else {
html += '<option value="0" selected="selected"><?php echo $text_none; ?></option>';
}
$('select[name=\'zone_id\']').html(html);
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});
$('select[name=\'country_id\']').trigger('change');
//--></script>
<?php include('catalog/view/theme/' . $config->get('theme_' . $config->get('config_theme') . '_directory') . '/template/new_elements/wrapper_bottom.tpl'); ?>
<?php echo $footer; ?>
Valeu.. Até mais..