Address template $this->address is empty

  • Posts: 52
  • Thank you received: 6
  • Hikashop Business
3 years 9 months ago #328794

-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.24
-- PHP version -- : 7.3.26
-- Browser(s) name and version -- : Firefox

The default code in address is
{address_company}
{address_title} {address_firstname} {address_lastname}
{address_street}
{address_post_code} {address_city} {address_state}
{address_country}
<?php if(!empty($this->address->address_telephone)) echo JText::sprintf('TELEPHONE_IN_ADDRESS','{address_telephone}');?>

The telephone has been set but never gets displayed.
If you use print_r to find out the contents of 'address', it is not set. If you print_r $this, 'address' is defined but with nothing in it.

How do we resolve so the logic works? I wish to use on other address fields.

Thank you
David

Last edit: 3 years 9 months ago by dhusband.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 9 months ago #328798

Hi,

$this->address is actually available on my end. I suppose it depends on where you're looking at it.
I've actually checked a bit the code behind it and I think I know what is going on.
I've added a patch so that it set $this->address in all cases.
Could you please download again the install package of the 4.4.0 on our website and install it again on yours ? It will add the patch which should hopefully fix the problem for you.
Otherwise, we'll need more information on where you're testing your code change

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 6
  • Hikashop Business
3 years 9 months ago #328830

Afternoon
Great that has worked.
Just so you are aware, empty optional address fields use to not show in displayed address. Now they give blank lines.
I have added php logic in my address template to hide empty optional lines, so not a problem to me.

Address view. I use to have two columns of addresses, but now I have one column, with each address saying billing and/or shipping in the bottom right corner. I'm not sure how you set which type it is, as there are no options to set in the edit screen. Have I missed a change or I have I changed a setting for the layout without realising?

Thank you for quick response.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 9 months ago #328832

Hi,

I'm not sure what you're talking about.
The same address format is used for both address types.
In $this->address->address_type you'll find the type of the address if you need to have conditions based on the address type.

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 6
  • Hikashop Business
3 years 9 months ago #328881

Morning
I have had another look this morning after putting the system live over the weekend. The live setup was a copy of the development environment.
In live I got View2. In development I got view1. It does not matter if I go in through the profile cpanel or through an address menu.

I have just tried development again but viewing with the same user as live. I get View2, the same as live. It suggests it is something about the user. But I am not aware I changed anything on the user?

I prefer View2.

Thank you
David

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
3 years 9 months ago #328889

Hello,

We will need to see this issue by ourselves, please.
So provide an Url link, a test user references and a step by step process in order to be able to experience your issue.

Please, use our Contact us form to provide these elements, and don't forget to add an Url link to this topic.
Awaiting your elements to be able to progress on your subject.
Regards

Last edit: 3 years 9 months ago by Philip.

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 6
  • Hikashop Business
3 years 9 months ago #328955

Afternoon

I just went into the account to set the password for you and then viewed the account address to see the issue was still there. However, the address view has returned to the usual two-column layout. So I cannot send you an example at this time, as the account that was providing a different layout, now isn't. Confused as I haven't changed anything other than name and password.

If it comes back, I will send you the link.

Thank you
David

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum