Telephone in Address

  • Posts: 585
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
4 years 6 months 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: 82867
  • Thank you received: 13374
  • MODERATOR
4 years 6 months 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: 585
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
3 years 7 months 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: 3 years 7 months ago by Lumiga.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
3 years 7 months 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.

The following user(s) said Thank You: Lumiga

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

Time to create page: 0.062 seconds
Powered by Kunena Forum