Skip to main content

Telephone in Address

More
6 years 4 months ago #319330 by Lumiga
Telephone in Address was created by Lumiga
-- HikaShop version -- : 4.3.0

Hi Hikashop,

Is it possible to change this code in the address format so that it wil only used when a telephone number has been provided by the customer.
Because we don't have this field required.
Code:
<?php echo JText::sprintf('TELEPHONE_IN_ADDRESS','{address_telephone}');?>

Kind regards,
Lumiga

Kind regards,
Lumiga

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

More
6 years 4 months ago #319339 by nicolas
Replied by nicolas on topic Telephone in Address
Hi,

Yes. You want to do it like that:
Code:
<?php $address = $this->params->get('address'); if(!empty($address->address_telephone)) { echo JText::sprintf('TELEPHONE_IN_ADDRESS','{address_telephone}'); } ?>
The following user(s) said Thank You: Lumiga

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

More
5 years 6 months ago - 5 years 6 months ago #331325 by Lumiga
Replied by Lumiga on topic Telephone in Address
Hi Nicolas,

I saw that you changed the code in version 4.4.0 from:
Code:
<?php $address = $this->params->get('address'); if(!empty($address->address_telephone)) { echo JText::sprintf('TELEPHONE_IN_ADDRESS','{address_telephone}'); } ?>

to
Code:
<?php if(!empty($this->address->address_telephone)) echo JText::sprintf('TELEPHONE_IN_ADDRESS','{address_telephone}');?>

Do you recommend using the new code or should the old one still work?

I have also create a code for the VAT in the address, maybe a good idea for a next version ;-) ?
Code:
<?php $address = $this->params->get('address'); if(!empty($address->address_vat)) { echo JText::sprintf('VAT_IN_ADDRESS','{address_vat}'); } ?>

Kind regards,
Lumiga
Last edit: 5 years 6 months ago by Lumiga.

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

More
5 years 5 months ago #331327 by nicolas
Replied by nicolas on topic Telephone in Address
Hi,

The old code will still work. We've just set $this->address with the value of $this->params->get('address') so that you can directly tap into the address without a line of code to get the variable.
But yes, we could add the VAT number by default if filled in. That would simplify things for merchants using that custom field.
The following user(s) said Thank You: Lumiga

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

Time to create page: 0.269 seconds
Powered by Kunena Forum