3

I'm maintaining a Joomla 3.7.3 site which uses the default com_contact module to display a contact page. I'm trying to display some basic information about our business, address, email, phone, etc. What's strange to me is that the address information is correctly saved into the selected contact and both in the contact page and global options I have all the address field settings to show. My com_contact html in the template is unaltered, so I'm really not sure what's going on.

From looking at the html source, it looks like the php performs a check as to whether the contact has an address:

<?php if (($this->params->get('address_check') > 0) &&
        ($this->contact->address || $this->contact->suburb  || $this->contact->state || $this->contact->country || $this->contact->postcode)) : ?>

This should return true, but it doesn't. The address section isn't included in the html loaded into the page, only a html placeholder comment for where the address section should go.

I've tried this with multiple contacts, but I haven't found a combination that works yet. So, 1) the contact has address details saved; 2) Contact Page options are set to show address fields; 3) Global settings are set to show address fields; 4) Default com_contact template is unmodified.

So, why does Joomla not recognize addresses?

UPDATE So, I've experimented a little and it seems to only be the address fields (address, city/suburb, state, postal code, and country). So, I'm beginning to suspect that this is either something messing up internally, either in the template or somewhere else. I suspect that the address_check function is somehow failing, but I don't have the code chops to debug this.

  • Have you checked menu item settings for that contact page? There are also bunch of options in there... – Mikan Jul 17 '17 at 16:00
  • Hi, yeah, the pages settings is the same as the global settings. It just doesn't seem to "see" the address fields. – nizz0k Jul 17 '17 at 16:05
1

Official solution

Actually my initial solution was just a quick work-around. It didn't seem right, as it will check only against the specific show_street_address param.

Joomla probably is doing another check for if the address should be shown or not, and that is with the address_check param - but this is missing, so it always default to false.

This is a reported bug and there is an official fix available that will be included in the coming releases.

In order to fix this:

edit: components/com_contact/views/contact/view.html.php line # 335

from

$this->params      = &$params;

change to:

$this->params      = &$item->params;

Initial Answer

I confirm that there is an issue with the address template.

Try the following and see if it fixes the issue for you.

Create a template override for the com_contact -> contact -> default_address.php template inside your template's html folder.

Create the html and all the folders chain if they do not exist, and copy and paste there the default_address.php file from components/com_contact/views/contact/tmpl/.

Open the copied file and edit at about line #18:

<?php if (($this->params->get('address_check') > 0) &&

change it to:

<?php if (($this->params->get('show_street_address') > 0) &&

Save the file and test.

To confirm that your template override is working, you can add some plain text or html before any php if statements, just above of the (~line #17)

<dl class="contact-address dl-horizontal" itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
  • thanks FFrewin, I will check this out and accept a little later today! – nizz0k Jul 18 '17 at 5:13
  • Just as an addendum to your answer. Implementing this solution also requires switching the function at line 28 to properly show the address icon. – nizz0k Jul 18 '17 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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