- Posts: 91
- Thank you received: 5
Customization of address data in My account, Email and Receipt
-- Joomla version -- : 3.9.23
-- PHP version -- : 7.3.24
-- Browser(s) name and version -- : Chrome 87
Hello,
I edited address template in
/templates/my_template/html/com_hikashop/address/address_template.php
and I see it applies to frontend, like My Account page.
I also edited it in
/administrator/templates/isis/html/com_hikashop/order/address_template.php
and it applies to Email sent to customer or admin.
How can I make a difference for Payment address and Shipment address?
For example my Payment address would be
Thanks
Please Log in or Create an account to join the conversation.
Well, you can restrict the custom address fields to only shipping and only billing via the Display>Custom fields menu.
So if you do that, then you can just do like this:
Now if you want to keep the fields in each type of address but only change the display, it will require some PHP coding.
Please Log in or Create an account to join the conversation.
Typo: one closing bracket too many.
Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Please Log in or Create an account to join the conversation.
Thanks, it helped me a lot.
Now I want to customize addresses in My account user panel.
1) In short address (one-line) I would like to have different fields for shipment and payment address. Tax number is important for payment, but not fir shipment. Is it possible?
2) How can I add phone to be visible in the Shipment long address (multi-line)? In my Hika settings I set phone only as a shipment field.
3) When I edit shipment address, I can't save it because it tells me I should fill in Phone, but the field is not visible there (see attachment). And tax number should not be displayed here (in Hika settings it's only for payment address).
Please help.
Please Log in or Create an account to join the conversation.
1. The mini format doesn't support PHP code. So you can't have different tags for different types of address in it.
I would recommend just not adding the tags for these fields. The goal of this address format is to have a small preview of the address for the customer when he chooses an address so you don't necessarily need all the information of the address in it.
2. The code I provided and lousyfool corrected will only display the address telephone for the shipping address. So this should already answer your question.
3. Could you provide a screenshot of the settings of both of these custom fields please ?
Please Log in or Create an account to join the conversation.
Thanks for your answer.
1) OK, I will tell it to the shop owner.
2) The code you provided works fine for HTML order summary in the front end for the customer
(URL: order/show/cid-18/cancel_url-aHR0cHM6Ly9zdGFsc2hvcC5wbC9tb2plLWtvbnRv), but not in the multi-line version address ready to be edited (URL: address)
My current code is
3) I attach the settings.
Please Log in or Create an account to join the conversation.
2.
Change the code:
3.
Change the line:
Please report back on this so that we can confirm the patches and add them for the next version.
Please Log in or Create an account to join the conversation.
Thanks for great support.
I applied the changes
2) Tax field already appears in the Payment address, but Telephone is not visible in Shipment address, and empty NIP (tax field) is there. I attach a screenshot.
3) It helped, thanks once again.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Thanks, this issue has been already resolved.
Now I would like to have the phone visible before editing the shipment address. I attach a screenshot.
Please Log in or Create an account to join the conversation.
I read the whole thread and so far, hard to tell what's didn't work after all this customization.
Provide via our Contact us form some backend references (with full access), and don't forget to add an Url link to this topic in your message.
Awaiting your references to progress.
Regards
Please Log in or Create an account to join the conversation.
Did you receive my backend references? I sent them on Friday evening via www.hikashop.com/support/contact-us.html
Please Log in or Create an account to join the conversation.
Well, the problem is with your custom code in the "address format" setting.
You had a check $this->address->address_type=='shipment' in there but there is no such address_type in HikaShop.
I've fixed up your code and simplified it:
monosnap.com/file/pwm9mRooR74UiCx2VyhAVzskiYdeYl
Please Log in or Create an account to join the conversation.
How can I fix it?
Just to know: are such thing like address type checks described somewhere in the documentation or I should ask here in the forum about the syntax?
Please Log in or Create an account to join the conversation.
I had a look at it and there was a problem with the caching of the address template which prevented the display of different address formats on that view.
I've added a patch to fix that on your website and we'll also add it on our end for the next version of HikaShop.
There is no documentation for advanced address format customization like what you're trying to do.
For simple customization, the documentation of the "address format" setting on the configuration documentation page is enough:
www.hikashop.com/support/documentation/5...ml#checkout_shipping
Please Log in or Create an account to join the conversation.
OK, so I will always ask here on a forum when starting some advanced customization.
Happy Christmas Time!
Please Log in or Create an account to join the conversation.