2

I need to add latitude and longitude to Contact Component. In administrator\components\com_contact\contact.xml I added this two lines.

<field name="latitude" type="text"size="30"/>          
<field name="longitude" type="text"size="30"/>     

administrator\templates\isis\html\com_contact\contact

<?php echo $this->form->renderField('latitude'); ?>
<?php echo $this->form->renderField('longitude'); ?>

When I save the form with values, the values are not saved?

1
  • Ha ha. Perhaps for the same GMaps plugin as I use.
    – kokbira
    Commented Sep 5, 2017 at 17:01

2 Answers 2

1

You need also add columns to table in DB

and may be you'll need to add code that will accept you field values and store then.

1

The first problem is the path, you need override the component from: your_site/components/com_contact not your_site/administrator/components/com_contact

Also the code for the template must be in: your_site/templates/your_template

Here you have an example:
https://stackoverflow.com/questions/20586581/adding-fields-to-joomla-3-x-contact-component

Other possible solution is via plugin, find more info here: https://docs.joomla.org/Adding_custom_fields_to_core_components_using_a_plugin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.