Wrong columns in massaction export

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
1 year 10 months ago #349408

-- HikaShop version -- : 4.7.1
-- Joomla version -- : 3.10
-- PHP version -- : 7.3

After update from 4.7.0 to 4.7.1 massaction export have wrong (changed) order of columns.
We use that to import to our accounting app, but now cant import becouse order of columns are changed.

For example if you look at S column. It should be order_product_price. Name of column is ok in both cases. But data in columns are wrong. In new export there is product name in order_product_price column.

Attachments:
Last edit: 1 year 10 months ago by mojweb.

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

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
1 year 10 months ago #349410

Hi,

There is no mechanism to select the order of the columns. The order is basically how they are stored in the mass action data.
The simplest I think would be to edit the data of the mass action in the hikashop_massaction table in your PHPMyAdmin and check the order of the columns in the serialized data.
Ideally, it would be best to not rely on the order of the columns when handling a CSV but rather the name of the columns. That's what we do for the import in HikaShop and how I've seen it anywhere I've had to import CSV files.

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
1 year 10 months ago #349424

Nicolas, look again at screenshots. It is not the order. It is the wrong data in columns.
In column order_product_price is product name and so on.
We need to solve this urgent.

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
1 year 10 months ago #349428

Further investigation shows one more thing.
When I try to create new massaction, in first select is missing order_full_tax.

Attachments:

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

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
1 year 10 months ago #349437

Hi,

Ok, I see what you mean now.
I tried to reproduce the problem on my end but I wasn't able to.
So there must be something specific to your setup which led to this issue.
Could you provide a backend access, a FTP access, the name of the mass action to use for my tests and a link to this thread for reference via our contact form so that I can look into it ?
www.hikashop.com/support/contact-us.html

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
1 year 10 months ago #349438

Thank you. Sent.

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

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
1 year 10 months ago #349450

Thanks. Looking at the situation on your website, I found that you had selected the "order_id" in the order_product selector, not in the "order" selector. And that caused the issue with the XLSX.
I was then able to reproduce the problem on my local test website.
That way I was able to do some debugging and found what was the problem.
I've made a patch and it is now working fine for me.
I've included the patch on our end. To get it on your website, download the latest version install package of HikaShop on our website and install it on yours.

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
1 year 10 months ago #349482

Columns are now proper align but Now I have new issue. See attachment.
Order_id column is duplicated.

If I delete duplicated column in xls my import works.

Attachments:

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

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
1 year 10 months ago #349483

Hi,

Disable the order_id column from the order_product area and activate it in the order area and you'll have only one order_id column.

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
1 year 10 months ago #349520

Then the order of columns is broken. Can in some way be duplicate order_id column in order product area be fixed?

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

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
1 year 10 months ago #349572

Hi,

It's not really a duplication. The first one is the order_id from the hikashop_order table. The second one is the order_id from the hikashop_order_product table.
When you export an order without any products, the first one will have the id of the order while the second one will be empty.

The first one is added to all the export files. I'm not sure why this is done. I suppose it is used in some cases to link the other data of the order with the order itself.
However, removing it doesn't cause any issue in the tests I did. So we probably could remove it. The column was actually added to the export in a wrong way when it was first added, 10 years ago. Recently, I stubbled on that piece of code and saw the code was incorrect and thus I fixed it, which led to the column being in the CSV even if you don't select it.

I suppose it would make sense to not have it since it can be selected anyways and it doesn't cause any issue not having it as far as I can see.
For that, remove the line:

$params->action['order']['order_id'] = 'order_id';
in the file plugins/hikashop/massaction_order/massaction_order.php
I'll look at adding that change for the next version of HikaShop too.

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

Time to create page: 0.078 seconds
Powered by Kunena Forum