Display custom address fields on billing address

  • Posts: 2
  • Thank you received: 0
13 years 1 month ago #11237

excellent. thanks for the help! ;-)

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

  • Posts: 41
  • Thank you received: 0
12 years 9 months ago #22223

Nicolas,

RE: #10395 msg above


I tried adding my custom field which is within the Address area:


<?php
echo JText::sprintf('Delivery Method','{deliverymethod}');
?>



But the view does not seem to recognize my custom field when appended to View: address_template

What am I missing here?

Last edit: 12 years 9 months ago by nicolas.

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

  • Posts: 81677
  • Thank you received: 13100
  • MODERATOR
12 years 9 months ago #22224

The code
echo JText::sprintf('Delivery Method','{deliverymethod}');
will just display "Delivery Method".

I see that you're trying to imitate the code for the phone number:
echo JText::sprintf('TELEPHONE_IN_ADDRESS','{address_telephone}');

However, JText::sprintf is a function to convert translation keys based on translation files.
In your translation file you will find the code:
TELEPHONE_IN_ADDRESS="Telephone: %s"

So basically what that function does is that it replaces TELEPHONE_IN_ADDRESS by Telephone: %s and then %s by {address_telephone} so you end up with: Telephone: {address_telephone}

The goal is to handle translations.

If you don't need translations,
You could just write:
Delivery Method : {deliverymethod}

instead of:
<?php
echo JText::sprintf('Delivery Method','{deliverymethod}');
?>
and that will work.

If you want to handle translations, you should use:
<?php
echo JText::sprintf('DELIVERY_METHOD','{deliverymethod}');
?>

and then, in your translation file override, add the line:
DELIVERY_METHOD="Delivery method : %s"

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

  • Posts: 41
  • Thank you received: 0
12 years 9 months ago #22245

Thank you. Sorry I thought I had tried

Delivery Method : {deliverymethod}


Yes, it works wonderfully...

Can I also do this with Hika Essential in the email templates?

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

  • Posts: 81677
  • Thank you received: 13100
  • MODERATOR
12 years 9 months ago #22246

Sure. The address_template view file is also used for addresses in emails.

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

Time to create page: 0.074 seconds
Powered by Kunena Forum