Export User Mass Action not exporting all of the addresses

  • Posts: 75
  • Thank you received: 7
4 years 11 months ago #313949

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.13
-- PHP version -- : 7.2.24
-- Browser(s) name and version -- : Version 78.0.3904.108

Hi all,

I'm trying to get all the user info out into a csv file, but I notice that not all the addresses are being output. I checked and those addresses are definitely there. I can't really tell what's the difference between the entries that work and the ones that don't.This happens if I export users and if I export addresses.

I turned on error reporting, set to maximum and once I did that the mass action did not actually complete. Instead I got a page full of errors, as seen below. Can someone point me in the right direction to clear up this problem?


This message contains confidential information

Last edit: 4 years 11 months ago by nicolas. Reason: removed user information

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
4 years 11 months ago #313957

Hi,

These notice and warning messages comes from another extension:
www.hikashop.com/forum/mass-actions/8983...-strings.html#311235
You can ignore them.
Now regarding the export of users, only the default address will be added to the CSV. If you want a CSV export of all the addresses, then you should select the data "address" and not the data "user" in your mass action.

Please Log in or Create an account to join the conversation.

  • Posts: 75
  • Thank you received: 7
4 years 11 months ago #313969

Hi Nicolas,

alright, I will ignore those errors then.

But I already tried using the Address selection and got the same result.

When I open up my customer, I can see both the default billing address and default shipping address are completely filled out, and yet when I export the csv that same user will inexplicably not have any information in those fields.

This doesn't happen with every user, only some, and I can't figure out what is different about them.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
4 years 11 months ago #313976

Hi,

It could be that those users don't have separate billing and shipping addresses ?
A few versions ago of HikaShop, we added an address_type to the addresses so that shipping addresses and billing addresses can be separated. That way, it makes more sense on the checkout for the customers, and you can also configure custom address fields based on the type of the address.
This also mean that we had to modify the export areas to handle these. But maybe some of your users still have addresses without a type and in that case the addresses can be used both for billing and shipping on the checkout, but maybe the mass action system doesn't handle them properly.
In fact, looking at the code of the mass action export, I think it's probably the issue here.
Edit the file administrator/components/com_hikashop/classes/massaction.php and change the line:

if(!count($element->shipping_address) && $address->address_type == 'shipping') {
to:
if(!count($element->shipping_address) && in_array($address->address_type, array('shipping', '', 'both'))) {
and the line:
if(!count($element->billing_address) && $address->address_type == 'billing') {
to:
if(!count($element->billing_address) && in_array($address->address_type, array('billing', '', 'both'))) {
It should then work better.
Let us know how it goes so that we can include that patch on our end.

Please Log in or Create an account to join the conversation.

  • Posts: 75
  • Thank you received: 7
4 years 11 months ago #314033

Hi Nicolas,

sorry I thought I had replied to this earlier.

The fix did work partially. I found that when I had the action set to 'User' then it worked! I was able to get all of the addresses as I would expect.

Out of curiosity I went back and set the action to 'Address'. This time I got the earlier result, where some addresses were not being downloaded, leaving empty fields in the csv.

So I did get what I needed. If you want me to try anything else for the addresses I can do that, just let me know.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
4 years 11 months ago #314034

Hi,

Yes my patch was only for the "user" data.
I'm not sure why you would have the problem with the "address" data in fact.
For the "user" data, I could understand since the check that I patched was checking the "address_type" in an incomplete maner to generate shipping and billing columns separately.
However, for the address data, there is no such mechanism. If a user has 10 addresses, then you'll get 10 lines in the export so no need to change the columns like we have to do for the user data.
In fact, I checked the export with the "address" type and did get all the addresses on my end so I don't see why that would happen for you.

Please Log in or Create an account to join the conversation.

  • Posts: 75
  • Thank you received: 7
4 years 11 months ago #314061

Hi Nicolas,

I don't know the answer to that, unfortunately. I went back to try again and got the same results.

With your patch, when set to User, the export works fine and I get all the address info, but when set to Address I am missing addresses in some of the users.

It worked well enough to get me through this though.

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.068 seconds
Powered by Kunena Forum