- Posts: 30
- Thank you received: 1
export csv - change header
- anut_peach
-
Topic Author
- Offline
Less
More
9 years 2 months ago #274826
by anut_peach
export csv - change header was created by anut_peach
Hi,
i would like to export every order to a csv file with the mass action - that already seems to work as it should.
Problem:
the attached system that should import the csv-file needs a specific order of the columns and specific header lines in the csv.
i suppose it should be pretty easy for hikashop to change this details of the csv file?
but i was not able to find the corresponding file or the settings for that.
thanks.
i would like to export every order to a csv file with the mass action - that already seems to work as it should.
Problem:
the attached system that should import the csv-file needs a specific order of the columns and specific header lines in the csv.
i suppose it should be pretty easy for hikashop to change this details of the csv file?
but i was not able to find the corresponding file or the settings for that.
thanks.
Please Log in or Create an account to join the conversation.
9 years 2 months ago #274830
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Replied by Jerome on topic export csv - change header
Hello,
You can use the trigger "onBeforeOrderExport" in order to change dynamically the content during the export :
www.hikashop.com/support/documentation/6...#onBeforeOrderExport
And you can use a view override in order to change other elements during the export.
That's in the view where it will be easier to change the header ; or at least to "translate" the header names.
Regards,
You can use the trigger "onBeforeOrderExport" in order to change dynamically the content during the export :
www.hikashop.com/support/documentation/6...#onBeforeOrderExport
And you can use a view override in order to change other elements during the export.
That's in the view where it will be easier to change the header ; or at least to "translate" the header names.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Please Log in or Create an account to join the conversation.
- anut_peach
-
Topic Author
- Offline
Less
More
- Posts: 30
- Thank you received: 1
9 years 1 month ago #275058
by anut_peach
Replied by anut_peach on topic export csv - change header
thanks for your reply, but its too complicated for me 
the onBeforeOrderExport has something to do with "how to develop a hikashop plugin"!? much too complicated.
the second point sounds good to me, "override" the headers.
this should work fro me: eg. override "item1_order_product_shipping_price" with "shipping price"
but i don't know where to configure the overrides?
the onBeforeOrderExport has something to do with "how to develop a hikashop plugin"!? much too complicated.
the second point sounds good to me, "override" the headers.
this should work fro me: eg. override "item1_order_product_shipping_price" with "shipping price"
but i don't know where to configure the overrides?
Please Log in or Create an account to join the conversation.
9 years 1 month ago #275061
by nicolas
Replied by nicolas on topic export csv - change header
Hi,
You can override view files via the menu Display>Views.
The one you want to edit is the file "export" of the view "order".
You can override view files via the menu Display>Views.
The one you want to edit is the file "export" of the view "order".
Please Log in or Create an account to join the conversation.
- anut_peach
-
Topic Author
- Offline
Less
More
- Posts: 30
- Thank you received: 1
9 years 1 month ago #275093
by anut_peach
Replied by anut_peach on topic export csv - change header
hi nicolas,
i checked the view file orders->export, but i cannot make the overrides there.
that file does only describe the logically behavior of the export process.
but where can i find the text of the header lines to override or change them?
i checked the view file orders->export, but i cannot make the overrides there.
that file does only describe the logically behavior of the export process.
but where can i find the text of the header lines to override or change them?
Please Log in or Create an account to join the conversation.
9 years 1 month ago #275095
by nicolas
Replied by nicolas on topic export csv - change header
Hi,
It's also there.
This code handles the display of the header:
It's also there.
This code handles the display of the header:
Code:
if($maxProd && !empty($productFields)) {
$first = array();
$o = reset($this->orders);
foreach($o as $key => $val) {
if(is_array($val))
continue;
$first[] = $key;
}
$o = null;
for($i=1;$i<=$maxProd;$i++){
foreach($productFields as $field){
$first[] = 'item'.$i.'_'.$field;
}
}
} else {
$first = array_keys(get_object_vars(reset($this->orders)));
}
$export->writeLine($first);
Please Log in or Create an account to join the conversation.
- anut_peach
-
Topic Author
- Offline
Less
More
- Posts: 30
- Thank you received: 1
9 years 1 month ago #275613
by anut_peach
Replied by anut_peach on topic export csv - change header
Hi nicholas,
i am affraid, we are not talking about the same thing!?
for example, i cannot see the text "item1_order_product_name" in your code shown above!?
i am affraid, we are not talking about the same thing!?
for example, i cannot see the text "item1_order_product_name" in your code shown above!?
Please Log in or Create an account to join the conversation.
9 years 1 month ago #275615
by nicolas
Replied by nicolas on topic export csv - change header
Hi,
That's because the column names are generated dynamically.
The display of the item1_order_product_name column is handled by the line of code:
Remove that line from that file and you'll see that it will remove the itemX_YYY column names from the CSV files when you export your orders.
So I do believe that we're talking about the same thing. It's just that it is not as easy to change as you believed.
That's because the column names are generated dynamically.
The display of the item1_order_product_name column is handled by the line of code:
Code:
$first[] = 'item'.$i.'_'.$field;
So I do believe that we're talking about the same thing. It's just that it is not as easy to change as you believed.
Please Log in or Create an account to join the conversation.
- anut_peach
-
Topic Author
- Offline
Less
More
- Posts: 30
- Thank you received: 1
9 years 1 month ago #275676
by anut_peach
Replied by anut_peach on topic export csv - change header
ok, you are right, it is not as easy to change as i believed ..
thanks for your support i will try to get it working.
thanks for your support i will try to get it working.
Please Log in or Create an account to join the conversation.
9 years 1 month ago #275677
by kyratn
Replied by kyratn on topic export csv - change header
Hi,
I suggest you to check component CSVimproved. You will be able to get what you want.
We use it by our selfs to export orders.
Thanks
I suggest you to check component CSVimproved. You will be able to get what you want.
We use it by our selfs to export orders.
Thanks
Please Log in or Create an account to join the conversation.
- anut_peach
-
Topic Author
- Offline
Less
More
- Posts: 30
- Thank you received: 1
9 years 1 month ago #275685
by anut_peach
Replied by anut_peach on topic export csv - change header
thanks.
Please Log in or Create an account to join the conversation.
9 years 1 month ago #275679
by nicolas
Replied by nicolas on topic export csv - change header
Hi,
Thanks for the input. Yes, CSV improved is a great way to import/export data with HikaShop. So if you need more custom things than what HikaShop provides, it can be a life saver.
Thanks for the input. Yes, CSV improved is a great way to import/export data with HikaShop. So if you need more custom things than what HikaShop provides, it can be a life saver.
Please Log in or Create an account to join the conversation.
Time to create page: 0.296 seconds