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

#   Prevent new address from pre-populating Last Name

##

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

Less More

- Posts: 48
- Thank you received: 1
-
-

11 years 9 months ago [\#189084](#189084) by [Llarian](/forum/user/33731-llarian "View Llarian's Profile")  *[Prevent new address from pre-populating Last Name](/forum/33-customers/874695-prevent-new-address-from-pre-populating-last-name#189084 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 2.5.28 -- PHP version -- : 5.4.37  This is actually more of an issue with JFusion/Joomla than Hikashop, but I need to figure out a way to fix it in Hikashop.  We're running an environment where most users were populated by JFusion from a phpBB install. That's changing, but for now, we have a ton of users with only their Username available in the DB. Joomla sticks that in the name field when the user sync is done.  The problem is that when they go to create a new address, Hikashop fills that into the last&#95;name field automatically, so I'm getting users missing that and getting   in their address.  Two ways I could fix it, but I'm not sure how.  One, don't auto-populate anything. This would work, I don't mind forcing my users to fill out their names again. Two, detect if a first name is present in the address form view, and only fill in the last name if first name is already present. I'd prefer this method, but I can't figure out how to go about it.  Any easy way to accomplish either of these?")* was created by *[Llarian](/forum/user/33731-llarian "View Llarian's Profile")*

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 2.5.28
-- PHP version -- : 5.4.37

This is actually more of an issue with JFusion/Joomla than Hikashop, but I need to figure out a way to fix it in Hikashop.

We're running an environment where most users were populated by JFusion from a phpBB install. That's changing, but for now, we have a ton of users with only their Username available in the DB. Joomla sticks that in the name field when the user sync is done.

The problem is that when they go to create a new address, Hikashop fills that into the last_name field automatically, so I'm getting users missing that and getting &lt;First Name&gt; &lt;UserID&gt; in their address.

Two ways I could fix it, but I'm not sure how.

One, don't auto-populate anything. This would work, I don't mind forcing my users to fill out their names again.
Two, detect if a first name is present in the address form view, and only fill in the last name if first name is already present. I'd prefer this method, but I can't figure out how to go about it.

Any easy way to accomplish either of these?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84NzQ2OTUtcHJldmVudC1uZXctYWRkcmVzcy1mcm9tLXByZS1wb3B1bGF0aW5nLWxhc3QtbmFtZT90bXBsPW1hcmtkb3du) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86586
- Thank you received: 14325
-
-

11 years 9 months ago [\#189098](#189098) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Prevent new address from pre-populating Last Name](/forum/33-customers/874695-prevent-new-address-from-pre-populating-last-name#189098 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 2.5.28 -- PHP version -- : 5.4.37  This is actually more of an issue with JFusion/Joomla than Hikashop, but I need to figure out a way to fix it in Hikashop.  We're running an environment where most users were populated by JFusion from a phpBB install. That's changing, but for now, we have a ton of users with only their Username available in the DB. Joomla sticks that in the name field when the user sync is done.  The problem is that when they go to create a new address, Hikashop fills that into the last&#95;name field automatically, so I'm getting users missing that and getting   in their address.  Two ways I could fix it, but I'm not sure how.  One, don't auto-populate anything. This would work, I don't mind forcing my users to fill out their names again. Two, detect if a first name is present in the address form view, and only fill in the last name if first name is already present. I'd prefer this method, but I can't figure out how to go about it.  Any easy way to accomplish either of these?")*

Hi,

Edit the file components/com_hikashop/views/address/view.html.php
and look for the code: Code:

$userCMS = JFactory::getUser(); if(!$userCMS-&gt;guest) { $name = $userCMS-&gt;get('name'); $pos = strpos($name, ' '); if($pos !== false) { $address-&gt;address_firstname = substr($name, 0, $pos); $name = substr($name, $pos + 1); } $address-&gt;address_lastname = $name; }

in both the functions show and form in that file.

If you don't want the last name to be prefilled, just change the line:
$address-&gt;address_lastname = $name;
to:
$address-&gt;address_lastname = '';

It's basically the same change for the firstname if you also don't want to prefill it.

The following user(s) said Thank You: [Llarian](/forum/user/33731-llarian "View Llarian's Profile")

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

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

Less More

- Posts: 48
- Thank you received: 1
-
-

11 years 9 months ago [\#189171](#189171) by [Llarian](/forum/user/33731-llarian "View Llarian's Profile")  Replied by *[Llarian](/forum/user/33731-llarian "View Llarian's Profile")* on topic *[Prevent new address from pre-populating Last Name](/forum/33-customers/874695-prevent-new-address-from-pre-populating-last-name#189171 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 2.5.28 -- PHP version -- : 5.4.37  This is actually more of an issue with JFusion/Joomla than Hikashop, but I need to figure out a way to fix it in Hikashop.  We're running an environment where most users were populated by JFusion from a phpBB install. That's changing, but for now, we have a ton of users with only their Username available in the DB. Joomla sticks that in the name field when the user sync is done.  The problem is that when they go to create a new address, Hikashop fills that into the last&#95;name field automatically, so I'm getting users missing that and getting   in their address.  Two ways I could fix it, but I'm not sure how.  One, don't auto-populate anything. This would work, I don't mind forcing my users to fill out their names again. Two, detect if a first name is present in the address form view, and only fill in the last name if first name is already present. I'd prefer this method, but I can't figure out how to go about it.  Any easy way to accomplish either of these?")*

Perfect, that did it.

Thanks!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84NzQ2OTUtcHJldmVudC1uZXctYWRkcmVzcy1mcm9tLXByZS1wb3B1bGF0aW5nLWxhc3QtbmFtZT90bXBsPW1hcmtkb3du) 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.073 seconds

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