Telephone in Address

  • Posts: 459
  • Thank you received: 17
  • Hikashop Multisite
10 months 3 weeks ago #319330

-- 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.

<?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.

  • Posts: 72525
  • Thank you received: 11030
  • MODERATOR
10 months 3 weeks ago #319339

Hi,

Yes. You want to do it like that:

<?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.

  • Posts: 459
  • Thank you received: 17
  • Hikashop Multisite
2 weeks 1 day ago #331325

Hi Nicolas,

I saw that you changed the code in version 4.4.0 from:

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

to
<?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 ;-) ?
<?php $address = $this->params->get('address');
if(!empty($address->address_vat)) {
 echo JText::sprintf('VAT_IN_ADDRESS','{address_vat}');
} ?>


Kind regards,
Lumiga
Last edit: 2 weeks 1 day ago by Lumiga.

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

  • Posts: 72525
  • Thank you received: 11030
  • MODERATOR
2 weeks 1 day ago #331327

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.

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

Time to create page: 0.257 seconds
Powered by Kunena Forum