- Posts: 2
- Thank you received: 0
Display custom address fields on billing address
15 years 6 months ago #11237
by earthship
Replied by earthship on topic Re: Display custom address fields on billing address
excellent. thanks for the help!
Please Log in or Create an account to join the conversation.
15 years 2 months ago - 15 years 2 months ago #22223
by cubefree
Replied by cubefree on topic Re: Display custom address fields on billing address
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?
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: 15 years 2 months ago by nicolas.
Please Log in or Create an account to join the conversation.
15 years 2 months ago #22224
by nicolas
Replied by nicolas on topic Re: Display custom address fields on billing address
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"
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.
15 years 2 months ago #22245
by cubefree
Replied by cubefree on topic Re: Display custom address fields on billing address
Thank you. Sorry I thought I had tried
Yes, it works wonderfully...
Can I also do this with Hika Essential in the email templates?
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.
15 years 2 months ago #22246
by nicolas
Replied by nicolas on topic Re: Display custom address fields on billing address
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.174 seconds