[Skip to main content](#vessel-content)

#   Adding default Billing Address to User Listing

##

- **[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")**
- [![Bobwales's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/30257-bobwales "View Bobwales's Profile") Topic Author
- [ Offline](/forum/user/30257-bobwales)

Less More

- Posts: 127
- Thank you received: 6
-
-

7 years 10 months ago [\#301441](#301441) by [Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")  *[Adding default Billing Address to User Listing](/forum/31-development/896420-adding-default-billing-address-to-user-listing#301441 "-- HikaShop version -- : 4.01 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  To help identify customers when they call us it would be useful to see Post Codes (or some part of their address) on our back-end User Listing. We could then more quickly find which &quot;Mr Smith&quot; (who has forgotten their username or email address) for instance.  To do this I guess I need to adapt the file listing.php in view user. Is there any simple way to show the default billing post code for a user?  Something as easy as user&#95;email; ?&gt; but for Town, City or Post Code instead?  That would be really helpful, but I bet not quite that simple...")* was created by *[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")*

-- HikaShop version -- : 4.01
-- Joomla version -- : 3.6.5
-- PHP version -- : 7

To help identify customers when they call us it would be useful to see Post Codes (or some part of their address) on our back-end User Listing. We could then more quickly find which "Mr Smith" (who has forgotten their username or email address) for instance.

To do this I guess I need to adapt the file listing.php in view user.
Is there any simple way to show the default billing post code for a user?

Something as easy as &lt;?php echo $row-&gt;user_email; ?&gt; but for Town, City or Post Code instead?

That would be really helpful, but I bet not quite that simple...

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg5NjQyMC1hZGRpbmctZGVmYXVsdC1iaWxsaW5nLWFkZHJlc3MtdG8tdXNlci1saXN0aW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86315
- Thank you received: 14276
-
-

7 years 10 months ago [\#301442](#301442) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Adding default Billing Address to User Listing](/forum/31-development/896420-adding-default-billing-address-to-user-listing#301442 "-- HikaShop version -- : 4.01 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  To help identify customers when they call us it would be useful to see Post Codes (or some part of their address) on our back-end User Listing. We could then more quickly find which &quot;Mr Smith&quot; (who has forgotten their username or email address) for instance.  To do this I guess I need to adapt the file listing.php in view user. Is there any simple way to show the default billing post code for a user?  Something as easy as user&#95;email; ?&gt; but for Town, City or Post Code instead?  That would be really helpful, but I bet not quite that simple...")*

Hi,

The users' address is not loaded on the users listing.
You you would have to do something like that: Code:

$addressClass = hikashop_get('class.address'); $addresses = $addressClass-&gt;get($row-&gt;user_id); echo reset($addresses)-&gt;address_city;

The following user(s) said Thank You: [Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg5NjQyMC1hZGRpbmctZGVmYXVsdC1iaWxsaW5nLWFkZHJlc3MtdG8tdXNlci1saXN0aW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")**
- [![Bobwales's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/30257-bobwales "View Bobwales's Profile") Topic Author
- [ Offline](/forum/user/30257-bobwales)

Less More

- Posts: 127
- Thank you received: 6
-
-

7 years 10 months ago -  7 years 10 months ago [\#301470](#301470) by [Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")  Replied by *[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")* on topic *[Adding default Billing Address to User Listing](/forum/31-development/896420-adding-default-billing-address-to-user-listing#301470 "-- HikaShop version -- : 4.01 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  To help identify customers when they call us it would be useful to see Post Codes (or some part of their address) on our back-end User Listing. We could then more quickly find which &quot;Mr Smith&quot; (who has forgotten their username or email address) for instance.  To do this I guess I need to adapt the file listing.php in view user. Is there any simple way to show the default billing post code for a user?  Something as easy as user&#95;email; ?&gt; but for Town, City or Post Code instead?  That would be really helpful, but I bet not quite that simple...")*

That's a big help Nicolas, Thank you.

I squeezed in an extra column (etc) and added...
&lt;td&gt;&lt;?php
$addressClass = hikashop_get('class.address');
$addresses = $addressClass-&gt;get($row-&gt;user_id);
echo $addresses-&gt;address_post_code;
?&gt;
&lt;/td&gt;
Not sure why reset() was suggested - I did need to remove that for anything to show.
But the postcodes shown are not those of each user - often a postcode of the previous user shows instead.

If you have a little time attached is my complete file - I can't see where the loop doesn't pick up the correct user...

Last edit: 7 years 10 months ago by [Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg5NjQyMC1hZGRpbmctZGVmYXVsdC1iaWxsaW5nLWFkZHJlc3MtdG8tdXNlci1saXN0aW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86315
- Thank you received: 14276
-
-

7 years 10 months ago [\#301474](#301474) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Adding default Billing Address to User Listing](/forum/31-development/896420-adding-default-billing-address-to-user-listing#301474 "-- HikaShop version -- : 4.01 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  To help identify customers when they call us it would be useful to see Post Codes (or some part of their address) on our back-end User Listing. We could then more quickly find which &quot;Mr Smith&quot; (who has forgotten their username or email address) for instance.  To do this I guess I need to adapt the file listing.php in view user. Is there any simple way to show the default billing post code for a user?  Something as easy as user&#95;email; ?&gt; but for Town, City or Post Code instead?  That would be really helpful, but I bet not quite that simple...")*

Hi,

What you did won't work.
What you did will load the address with its address_id equal to the user_id of the user.
So while you're still loading an address, you're not loading the address of the customer you're looking at, unless you'll lucky and the id is the same, which should be quite uncommon.

However, I can see I made a mistake in the code I gave you. It should by "getByUser" instead of "get". I suppose that's why you got confused. Sorry.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg5NjQyMC1hZGRpbmctZGVmYXVsdC1iaWxsaW5nLWFkZHJlc3MtdG8tdXNlci1saXN0aW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")**
- [![Bobwales's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/30257-bobwales "View Bobwales's Profile") Topic Author
- [ Offline](/forum/user/30257-bobwales)

Less More

- Posts: 127
- Thank you received: 6
-
-

7 years 10 months ago [\#301517](#301517) by [Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")  Replied by *[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")* on topic *[Adding default Billing Address to User Listing](/forum/31-development/896420-adding-default-billing-address-to-user-listing#301517 "-- HikaShop version -- : 4.01 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  To help identify customers when they call us it would be useful to see Post Codes (or some part of their address) on our back-end User Listing. We could then more quickly find which &quot;Mr Smith&quot; (who has forgotten their username or email address) for instance.  To do this I guess I need to adapt the file listing.php in view user. Is there any simple way to show the default billing post code for a user?  Something as easy as user&#95;email; ?&gt; but for Town, City or Post Code instead?  That would be really helpful, but I bet not quite that simple...")*

Appreciated Nicolas - do you mean like this?

$addressClass = hikashop_get('class.address');
$addresses = $addressClass-&gt;getByUser($row-&gt;user_id);
echo $addresses-&gt;address_post_code;

Unfortunately that doesn't work.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg5NjQyMC1hZGRpbmctZGVmYXVsdC1iaWxsaW5nLWFkZHJlc3MtdG8tdXNlci1saXN0aW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86315
- Thank you received: 14276
-
-

7 years 10 months ago -  7 years 10 months ago [\#301527](#301527) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Adding default Billing Address to User Listing](/forum/31-development/896420-adding-default-billing-address-to-user-listing#301527 "-- HikaShop version -- : 4.01 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  To help identify customers when they call us it would be useful to see Post Codes (or some part of their address) on our back-end User Listing. We could then more quickly find which &quot;Mr Smith&quot; (who has forgotten their username or email address) for instance.  To do this I guess I need to adapt the file listing.php in view user. Is there any simple way to show the default billing post code for a user?  Something as easy as user&#95;email; ?&gt; but for Town, City or Post Code instead?  That would be really helpful, but I bet not quite that simple...")*

No, I meant this: Code:

$addressClass = hikashop_get('class.address'); $addresses = $addressClass-&gt;getByUser($row-&gt;user_id); echo reset($addresses)-&gt;address_city;

It won't work without the reset.

Last edit: 7 years 10 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg5NjQyMC1hZGRpbmctZGVmYXVsdC1iaWxsaW5nLWFkZHJlc3MtdG8tdXNlci1saXN0aW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")**
- [![Bobwales's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/30257-bobwales "View Bobwales's Profile") Topic Author
- [ Offline](/forum/user/30257-bobwales)

Less More

- Posts: 127
- Thank you received: 6
-
-

7 years 10 months ago [\#301545](#301545) by [Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")  Replied by *[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")* on topic *[Adding default Billing Address to User Listing](/forum/31-development/896420-adding-default-billing-address-to-user-listing#301545 "-- HikaShop version -- : 4.01 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  To help identify customers when they call us it would be useful to see Post Codes (or some part of their address) on our back-end User Listing. We could then more quickly find which &quot;Mr Smith&quot; (who has forgotten their username or email address) for instance.  To do this I guess I need to adapt the file listing.php in view user. Is there any simple way to show the default billing post code for a user?  Something as easy as user&#95;email; ?&gt; but for Town, City or Post Code instead?  That would be really helpful, but I bet not quite that simple...")*

Thank you so much Nicolas!
Once again, superb support and tolerance of an idiot at this end.
Much appreciated and much learned! ![:)](/media/kunena/emoticons/8.png ":)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg5NjQyMC1hZGRpbmctZGVmYXVsdC1iaWxsaW5nLWFkZHJlc3MtdG8tdXNlci1saXN0aW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")**
- [![Bobwales's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/30257-bobwales "View Bobwales's Profile") Topic Author
- [ Offline](/forum/user/30257-bobwales)

Less More

- Posts: 127
- Thank you received: 6
-
-

7 years 10 months ago [\#301655](#301655) by [Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")  Replied by *[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")* on topic *[Adding default Billing Address to User Listing](/forum/31-development/896420-adding-default-billing-address-to-user-listing#301655 "-- HikaShop version -- : 4.01 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  To help identify customers when they call us it would be useful to see Post Codes (or some part of their address) on our back-end User Listing. We could then more quickly find which &quot;Mr Smith&quot; (who has forgotten their username or email address) for instance.  To do this I guess I need to adapt the file listing.php in view user. Is there any simple way to show the default billing post code for a user?  Something as easy as user&#95;email; ?&gt; but for Town, City or Post Code instead?  That would be really helpful, but I bet not quite that simple...")*

It would be even more useful to add this extra address column to the array for search, on this override. But I am unsure how to do that.

To search include the address_post_code would be very useful.

At the moment for that table cell the code is: Code:

&lt;td&gt;&lt;?php $addressClass = hikashop_get('class.address'); $addresses = $addressClass-&gt;getByUser($row-&gt;user_id); echo reset($addresses)-&gt;address_post_code; ?&gt; &lt;/td&gt;

How can I add that to the search?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg5NjQyMC1hZGRpbmctZGVmYXVsdC1iaWxsaW5nLWFkZHJlc3MtdG8tdXNlci1saXN0aW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

7 years 10 months ago [\#301664](#301664) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Adding default Billing Address to User Listing](/forum/31-development/896420-adding-default-billing-address-to-user-listing#301664 "-- HikaShop version -- : 4.01 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  To help identify customers when they call us it would be useful to see Post Codes (or some part of their address) on our back-end User Listing. We could then more quickly find which &quot;Mr Smith&quot; (who has forgotten their username or email address) for instance.  To do this I guess I need to adapt the file listing.php in view user. Is there any simple way to show the default billing post code for a user?  Something as easy as user&#95;email; ?&gt; but for Town, City or Post Code instead?  That would be really helpful, but I bet not quite that simple...")*

Hello,

To add it to the search, best would require the modification of core files.
Unfortunately that is not recommended because you will loose your modification by updating HikaShop.
Another solution would be to copy a part of the code in the "view.html.php" into the listing view in order to re-perform the loading of the user list with extra elements for the search fields (and an extra loaded table in the main query).
It would require some time and development ; it is not something we can do within few minutes and paste few lines in the forum.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg5NjQyMC1hZGRpbmctZGVmYXVsdC1iaWxsaW5nLWFkZHJlc3MtdG8tdXNlci1saXN0aW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")**
- [![Bobwales's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/30257-bobwales "View Bobwales's Profile") Topic Author
- [ Offline](/forum/user/30257-bobwales)

Less More

- Posts: 127
- Thank you received: 6
-
-

7 years 10 months ago -  7 years 10 months ago [\#301759](#301759) by [Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")  Replied by *[Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile")* on topic *[Adding default Billing Address to User Listing](/forum/31-development/896420-adding-default-billing-address-to-user-listing#301759 "-- HikaShop version -- : 4.01 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  To help identify customers when they call us it would be useful to see Post Codes (or some part of their address) on our back-end User Listing. We could then more quickly find which &quot;Mr Smith&quot; (who has forgotten their username or email address) for instance.  To do this I guess I need to adapt the file listing.php in view user. Is there any simple way to show the default billing post code for a user?  Something as easy as user&#95;email; ?&gt; but for Town, City or Post Code instead?  That would be really helpful, but I bet not quite that simple...")*

Merci Jerome
That looks beyond me, unless I find a darkened room for a couple of days!

I had hoped that adding strings for search happens on the Table Header rows during $this-&gt;pageinfo-&gt;filter-&gt;...etc statement.
But I recognise my naivety. Thanks for looking.
Code:

..... &lt;th class="title"&gt;&lt;?php echo JHTML::_('grid.sort', JText::_('HIKA_EMAIL'), 'huser.user_email', $this-&gt;pageInfo-&gt;filter-&gt;order-&gt;dir, $this-&gt;pageInfo-&gt;filter-&gt;order-&gt;value); ?&gt;&lt;/th&gt; &lt;?php // extra info added BW Dec 18 ?&gt; &lt;th class="title"&gt;&lt;?php echo JHTML::_('grid.sort', 'Postcode', '', $this-&gt;pageInfo-&gt;filter-&gt;order-&gt;dir, $this-&gt;pageInfo-&gt;filter-&gt;order-&gt;value); ?&gt;&lt;/th&gt;

I will try to find some time as it would be a useful feature for us at Juicy Bikes - thanks for your pointer.
KR
Bob

Last edit: 7 years 10 months ago by [Bobwales](/forum/user/30257-bobwales "View Bobwales's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg5NjQyMC1hZGRpbmctZGVmYXVsdC1iaWxsaW5nLWFkZHJlc3MtdG8tdXNlci1saXN0aW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.125 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
