Product Export Ordering

  • Posts: 9
  • Thank you received: 0
12 years 11 months ago #32930

I'm confused about how the export of products is sorted. I would have assumed that the export would be the same as the import - our client is expoecting a CSV file with the same order/formatting (give or take the extra columns) so they can insert products into a category instead of putting them at the end.

I've looked, and it just seems random. Even the Categories seem messed up when I sort by product_id - I imported everything one category at a time and it's all over the place still. Any ideas? Is there a setting for which column sets the order for export?

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

  • Posts: 82908
  • Thank you received: 13378
  • MODERATOR
12 years 11 months ago #32951

Hi,

It's indeed random. There is no ordering set in the query for the export so the order of the products is whatever mysql feels.
We didn't thought that it would make any difference. And no one told us that it was a problem so far so it's still like that.

If you want to have them ordered by id, you can change the line:
$query = 'SELECT * FROM '.hikashop_table('product').$where.' ORDER BY product_parent_id ASC';
to:
$query = 'SELECT * FROM '.hikashop_table('product').$where.' ORDER BY product_parent_id ASC, product_id ASC';

in the file administrator/components/com_hikashop/classes/product.php

We'll do that change on our end as it makes sense to export the products in the order they were inserted.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum