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

#   #\_\_hikashop\_address keeps growing?

##

- **[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")**
- [![lousyfool's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar28604.jpg)](/forum/user/28604-lousyfool "View lousyfool's Profile") Topic Author
- [ Offline](/forum/user/28604-lousyfool)

Less More

- Posts: 2143
- Thank you received: 746
-
- [](http://www.inphase.one)
-

11 years 2 months ago -  11 years 2 months ago [\#213949](#213949) by [lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")  *[\#\_\_hikashop\_address keeps growing?](/forum/33-customers/879236-hikashop-address-keeps-growing#213949 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 Starter -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: &quot;Ask address on registration&quot; = yes, published are only 1st &amp; last names, country &amp; state, &quot;Use the same address as for billing&quot; is checked for shipping address.  These dummy users order something, and then I'm deleting them to start all over again. Deletion goes &quot;by the book&quot;, supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the &quot;issue&quot; goes. BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.  Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #&#95;&#95;hikashop&#95;address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use. Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for address&#95;id (= auto&#95;increment number maintained) address&#95;user&#95;id (= 0) address&#95;published (= 1) address&#95;default (= 1)  What is preventing from proper housekeeping?  I have no problem deleting those rows now with no user other than admin around, but my concern is the future: Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.  So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.  Thanks again!  P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ;)")* was created by *[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")*

-- url of the page with the problem -- : local
-- HikaShop version -- : 2.5.0 Starter
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.5.3

Hi,

I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: "Ask address on registration" = yes, published are only 1st &amp; last names, country &amp; state, "Use the same address as for billing" is checked for shipping address.

These dummy users order something, and then I'm deleting them to start all over again. Deletion goes "by the book", supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the "issue" goes.
BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.

Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #__hikashop_address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use.
Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for
address_id (= auto_increment number maintained)
address_user_id (= 0)
address_published (= 1)
address_default (= 1)

What is preventing from proper housekeeping?

I have no problem deleting those rows now with no user other than admin around, but my concern is the future:
Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.

So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.

Thanks again!

P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ![;)](/media/kunena/emoticons/24.png ";)")

---

Need help with customisations of layouts, style or other site development? [ PM me!](/component/uddeim/?task=new)
(Don't forget to turn on [ "E-mail notification of new messages"](/component/uddeim/?task=settings))

Last edit: 11 years 2 months ago by [lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile").

The following user(s) said Thank You: [nyanginator](/forum/user/50337-nyanginator "View nyanginator's Profile")

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

- **[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")**
- [![lousyfool's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar28604.jpg)](/forum/user/28604-lousyfool "View lousyfool's Profile") Topic Author
- [ Offline](/forum/user/28604-lousyfool)

Less More

- Posts: 2143
- Thank you received: 746
-
- [](http://www.inphase.one)
-

11 years 2 months ago [\#214242](#214242) by [lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")  Replied by *[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")* on topic *[\#\_\_hikashop\_address keeps growing?](/forum/33-customers/879236-hikashop-address-keeps-growing#214242 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 Starter -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: &quot;Ask address on registration&quot; = yes, published are only 1st &amp; last names, country &amp; state, &quot;Use the same address as for billing&quot; is checked for shipping address.  These dummy users order something, and then I'm deleting them to start all over again. Deletion goes &quot;by the book&quot;, supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the &quot;issue&quot; goes. BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.  Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #&#95;&#95;hikashop&#95;address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use. Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for address&#95;id (= auto&#95;increment number maintained) address&#95;user&#95;id (= 0) address&#95;published (= 1) address&#95;default (= 1)  What is preventing from proper housekeeping?  I have no problem deleting those rows now with no user other than admin around, but my concern is the future: Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.  So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.  Thanks again!  P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ;)")*

Friendly "bump"...

Maybe it takes a bit longer to dig into this, or maybe my post only fell off the edge of the world. No stress, but would be nice hearing something. Thanks!

---

Need help with customisations of layouts, style or other site development? [ PM me!](/component/uddeim/?task=new)
(Don't forget to turn on [ "E-mail notification of new messages"](/component/uddeim/?task=settings))

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84NzkyMzYtaGlrYXNob3AtYWRkcmVzcy1rZWVwcy1ncm93aW5nP3RtcGw9bWFya2Rvd24=) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 2 months ago [\#214260](#214260) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[\#\_\_hikashop\_address keeps growing?](/forum/33-customers/879236-hikashop-address-keeps-growing#214260 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 Starter -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: &quot;Ask address on registration&quot; = yes, published are only 1st &amp; last names, country &amp; state, &quot;Use the same address as for billing&quot; is checked for shipping address.  These dummy users order something, and then I'm deleting them to start all over again. Deletion goes &quot;by the book&quot;, supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the &quot;issue&quot; goes. BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.  Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #&#95;&#95;hikashop&#95;address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use. Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for address&#95;id (= auto&#95;increment number maintained) address&#95;user&#95;id (= 0) address&#95;published (= 1) address&#95;default (= 1)  What is preventing from proper housekeeping?  I have no problem deleting those rows now with no user other than admin around, but my concern is the future: Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.  So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.  Thanks again!  P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ;)")*

Hi,

I'm sorry but we didn't had the time to look at that.
It's not a priority as it doesn't causes any problem and it's not going to be easy to debug.
We'll add that to the todo list as a low priority issue.
If you want to look at it yourself, it should be in either in the delete function of the administrator/components/com_hikashop/classes/user.php or administrator/components/com_hikashop/classes/address.php
Even with a few tens of thousands of entries like that, it shouldn't slow down the website. And it's easy to remove them if necessary with a SQL query that you can run on your phpmyadmin like that:
DELETE FROM #__hikashop_address WHERE address_country=NULL;
(the country should never be null in an address as you cannot not select a country when you edit/create an address)

The following user(s) said Thank You: [lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")

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

- **[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")**
- [![lousyfool's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar28604.jpg)](/forum/user/28604-lousyfool "View lousyfool's Profile") Topic Author
- [ Offline](/forum/user/28604-lousyfool)

Less More

- Posts: 2143
- Thank you received: 746
-
- [](http://www.inphase.one)
-

11 years 2 months ago [\#214346](#214346) by [lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")  Replied by *[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")* on topic *[\#\_\_hikashop\_address keeps growing?](/forum/33-customers/879236-hikashop-address-keeps-growing#214346 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 Starter -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: &quot;Ask address on registration&quot; = yes, published are only 1st &amp; last names, country &amp; state, &quot;Use the same address as for billing&quot; is checked for shipping address.  These dummy users order something, and then I'm deleting them to start all over again. Deletion goes &quot;by the book&quot;, supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the &quot;issue&quot; goes. BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.  Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #&#95;&#95;hikashop&#95;address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use. Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for address&#95;id (= auto&#95;increment number maintained) address&#95;user&#95;id (= 0) address&#95;published (= 1) address&#95;default (= 1)  What is preventing from proper housekeeping?  I have no problem deleting those rows now with no user other than admin around, but my concern is the future: Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.  So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.  Thanks again!  P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ;)")*

Hi again,

I understand it's not a priority - as I said, it's only a small issue, obviously, and there are more important things to do.
Was just wondering because usually no question here goes without reply within a few hours unless the OP answers it himself.

Anyway, glad you took the time to answer, and thanks for the hints on function and SQL query. That'll do!

---

Need help with customisations of layouts, style or other site development? [ PM me!](/component/uddeim/?task=new)
(Don't forget to turn on [ "E-mail notification of new messages"](/component/uddeim/?task=settings))

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

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

Less More

- Posts: 31
- Thank you received: 1
-
-

9 years 6 months ago [\#270057](#270057) by [nyanginator](/forum/user/50337-nyanginator "View nyanginator's Profile")  Replied by *[nyanginator](/forum/user/50337-nyanginator "View nyanginator's Profile")* on topic *[\#\_\_hikashop\_address keeps growing?](/forum/33-customers/879236-hikashop-address-keeps-growing#270057 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 Starter -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: &quot;Ask address on registration&quot; = yes, published are only 1st &amp; last names, country &amp; state, &quot;Use the same address as for billing&quot; is checked for shipping address.  These dummy users order something, and then I'm deleting them to start all over again. Deletion goes &quot;by the book&quot;, supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the &quot;issue&quot; goes. BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.  Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #&#95;&#95;hikashop&#95;address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use. Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for address&#95;id (= auto&#95;increment number maintained) address&#95;user&#95;id (= 0) address&#95;published (= 1) address&#95;default (= 1)  What is preventing from proper housekeeping?  I have no problem deleting those rows now with no user other than admin around, but my concern is the future: Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.  So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.  Thanks again!  P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ;)")*

Following the previous posts, adding the following at the end of the **delete()** function in **/administrator/components/com\_hikashop/classes/address.php** seems to do the trick:

Code:

$db = JFactory::getDbo(); $query = $db-&gt;getQuery(true); $conditions = array( $db-&gt;quoteName('address_country') . ' IS NULL' ); $query-&gt;delete($db-&gt;quoteName('#__hikashop_address')); $query-&gt;where($conditions); $db-&gt;setQuery($query); $result = $db-&gt;execute();

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84NzkyMzYtaGlrYXNob3AtYWRkcmVzcy1rZWVwcy1ncm93aW5nP3RtcGw9bWFya2Rvd24=) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

9 years 6 months ago [\#270074](#270074) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[\#\_\_hikashop\_address keeps growing?](/forum/33-customers/879236-hikashop-address-keeps-growing#270074 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 Starter -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: &quot;Ask address on registration&quot; = yes, published are only 1st &amp; last names, country &amp; state, &quot;Use the same address as for billing&quot; is checked for shipping address.  These dummy users order something, and then I'm deleting them to start all over again. Deletion goes &quot;by the book&quot;, supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the &quot;issue&quot; goes. BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.  Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #&#95;&#95;hikashop&#95;address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use. Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for address&#95;id (= auto&#95;increment number maintained) address&#95;user&#95;id (= 0) address&#95;published (= 1) address&#95;default (= 1)  What is preventing from proper housekeeping?  I have no problem deleting those rows now with no user other than admin around, but my concern is the future: Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.  So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.  Thanks again!  P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ;)")*

Hi,

Note however that this can't be a generic solution since the address_country field can actually really be empty when the address_country field is disabled in the menu Display&gt;Custom fields, and that often happens when you sell your goods in only one country.

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

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

Less More

- Posts: 31
- Thank you received: 1
-
-

9 years 6 months ago [\#270096](#270096) by [nyanginator](/forum/user/50337-nyanginator "View nyanginator's Profile")  Replied by *[nyanginator](/forum/user/50337-nyanginator "View nyanginator's Profile")* on topic *[\#\_\_hikashop\_address keeps growing?](/forum/33-customers/879236-hikashop-address-keeps-growing#270096 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 Starter -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: &quot;Ask address on registration&quot; = yes, published are only 1st &amp; last names, country &amp; state, &quot;Use the same address as for billing&quot; is checked for shipping address.  These dummy users order something, and then I'm deleting them to start all over again. Deletion goes &quot;by the book&quot;, supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the &quot;issue&quot; goes. BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.  Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #&#95;&#95;hikashop&#95;address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use. Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for address&#95;id (= auto&#95;increment number maintained) address&#95;user&#95;id (= 0) address&#95;published (= 1) address&#95;default (= 1)  What is preventing from proper housekeeping?  I have no problem deleting those rows now with no user other than admin around, but my concern is the future: Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.  So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.  Thanks again!  P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ;)")*

Thanks for the input. Would it be better to delete records where address_user_id=0 then? I noticed that was another common value in deleted users.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84NzkyMzYtaGlrYXNob3AtYWRkcmVzcy1rZWVwcy1ncm93aW5nP3RtcGw9bWFya2Rvd24=) 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: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

9 years 6 months ago [\#270097](#270097) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[\#\_\_hikashop\_address keeps growing?](/forum/33-customers/879236-hikashop-address-keeps-growing#270097 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 Starter -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: &quot;Ask address on registration&quot; = yes, published are only 1st &amp; last names, country &amp; state, &quot;Use the same address as for billing&quot; is checked for shipping address.  These dummy users order something, and then I'm deleting them to start all over again. Deletion goes &quot;by the book&quot;, supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the &quot;issue&quot; goes. BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.  Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #&#95;&#95;hikashop&#95;address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use. Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for address&#95;id (= auto&#95;increment number maintained) address&#95;user&#95;id (= 0) address&#95;published (= 1) address&#95;default (= 1)  What is preventing from proper housekeeping?  I have no problem deleting those rows now with no user other than admin around, but my concern is the future: Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.  So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.  Thanks again!  P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ;)")*

Hello,

An address with address_user_id set with 0 is not attach to a user ; so it can be deleted.
Afterwards, that's not the case you're talking about ; because when you delete a user, his addresses are still using his ID. So the idea would be more to delete addresses with non corresponding ID in the HikaShop user table.

Regards,

---

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

The following user(s) said Thank You: [nyanginator](/forum/user/50337-nyanginator "View nyanginator's Profile")

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

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

Less More

- Posts: 31
- Thank you received: 1
-
-

9 years 6 months ago [\#270210](#270210) by [nyanginator](/forum/user/50337-nyanginator "View nyanginator's Profile")  Replied by *[nyanginator](/forum/user/50337-nyanginator "View nyanginator's Profile")* on topic *[\#\_\_hikashop\_address keeps growing?](/forum/33-customers/879236-hikashop-address-keeps-growing#270210 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 Starter -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: &quot;Ask address on registration&quot; = yes, published are only 1st &amp; last names, country &amp; state, &quot;Use the same address as for billing&quot; is checked for shipping address.  These dummy users order something, and then I'm deleting them to start all over again. Deletion goes &quot;by the book&quot;, supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the &quot;issue&quot; goes. BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.  Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #&#95;&#95;hikashop&#95;address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use. Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for address&#95;id (= auto&#95;increment number maintained) address&#95;user&#95;id (= 0) address&#95;published (= 1) address&#95;default (= 1)  What is preventing from proper housekeeping?  I have no problem deleting those rows now with no user other than admin around, but my concern is the future: Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.  So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.  Thanks again!  P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ;)")*

It seems like the deleted users are having their address_user_id fields properly zeroed out (and other fields also become NULL). Using address_user_id=0 has been working in my tests so far.

Is there a case where an address would be in the #__hikashop_address table with the ID of a user who's already been deleted?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84NzkyMzYtaGlrYXNob3AtYWRkcmVzcy1rZWVwcy1ncm93aW5nP3RtcGw9bWFya2Rvd24=) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

9 years 6 months ago [\#270228](#270228) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[\#\_\_hikashop\_address keeps growing?](/forum/33-customers/879236-hikashop-address-keeps-growing#270228 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 Starter -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: &quot;Ask address on registration&quot; = yes, published are only 1st &amp; last names, country &amp; state, &quot;Use the same address as for billing&quot; is checked for shipping address.  These dummy users order something, and then I'm deleting them to start all over again. Deletion goes &quot;by the book&quot;, supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the &quot;issue&quot; goes. BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.  Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #&#95;&#95;hikashop&#95;address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use. Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for address&#95;id (= auto&#95;increment number maintained) address&#95;user&#95;id (= 0) address&#95;published (= 1) address&#95;default (= 1)  What is preventing from proper housekeeping?  I have no problem deleting those rows now with no user other than admin around, but my concern is the future: Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.  So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.  Thanks again!  P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ;)")*

Hi,

No, normally, when you delete a Joomla user account, the user entry in HikaShop is kept and the addresses of th user entry in HikaShop too. So an address with an address_user_id equal to 0 shouldn't happen normally.
But there is always the possibility after an import from a third party ecommerce solution where the import system would be able to import the orders (and the addresses attached to them) without importing the users of these orders, even though that should not happen in most cases.

The following user(s) said Thank You: [nyanginator](/forum/user/50337-nyanginator "View nyanginator's Profile")

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

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

Less More

- Posts: 31
- Thank you received: 1
-
-

9 years 6 months ago [\#270278](#270278) by [nyanginator](/forum/user/50337-nyanginator "View nyanginator's Profile")  Replied by *[nyanginator](/forum/user/50337-nyanginator "View nyanginator's Profile")* on topic *[\#\_\_hikashop\_address keeps growing?](/forum/33-customers/879236-hikashop-address-keeps-growing#270278 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 Starter -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I'm presently in dev mode and playing with 3-5 users who I register in checkout with minimal address details: &quot;Ask address on registration&quot; = yes, published are only 1st &amp; last names, country &amp; state, &quot;Use the same address as for billing&quot; is checked for shipping address.  These dummy users order something, and then I'm deleting them to start all over again. Deletion goes &quot;by the book&quot;, supposedly: in the backend only, first orders, then J users. I have also tried deleting shop users after the orders, then J users, but it's all the same as far as the &quot;issue&quot; goes. BTW, Emerald is involved, but no extra action, subscription are deleted without a trace upon J user deletion.  Upon checking the database just to verify that all goes by the infamous book, indeed all is good and clean. With the exception of the table #&#95;&#95;hikashop&#95;address. And that's the issue: after a few cycles I'm left with some 20 rows there. Most fields are NULL, also the aforementioned ones which had been in use. Further testing shows that it keeps going this way: address details are being stored in a new row, but upon user deletion the row stays - mostly NULL except for address&#95;id (= auto&#95;increment number maintained) address&#95;user&#95;id (= 0) address&#95;published (= 1) address&#95;default (= 1)  What is preventing from proper housekeeping?  I have no problem deleting those rows now with no user other than admin around, but my concern is the future: Upon launch, the database will hold &gt;10k addresses, hopefully growing, but with a certain fluctuation including deletions. At some point housekeeping might become a big mess, or this table will just keep growing... who knows to what size.  So, it'd be great if you could take a look at what is yet a small issue. Should be easily reproducible, otherwise it must be uniquely my problem, and I'll take any hint and get you what you need to find the culprit.  Thanks again!  P.S.: I should maybe add that it's really only J!3.4.4, HikaShop and Emerald, and not one file modded, even still Protostar ;)")*

I think it's much clearer now. When I was testing before, I forgot to put in some orders. That's why I didn't come across the case where Hikashop users were kept when Joomla users were deleted :oops:

My adjusted SQL statement:
Code:

$db = JFactory::getDbo(); $sql = 'DELETE FROM #__hikashop_address WHERE address_user_id NOT IN (SELECT user_id FROM #__hikashop_user)'; $db-&gt;setQuery($sql); $result = $db-&gt;execute();

I am still new to Hikashop but am impressed with it very much already. Thanks very much for your time and all the hard work.

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

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