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

#   Remove unnecessary columns from CSV

##

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

Less More

- Posts: 41
- Thank you received: 9
-
-

12 years 10 months ago -  12 years 2 weeks ago [\#138750](#138750) by [Savickis](/forum/user/26490-savickis "View Savickis's Profile")  *[Remove unnecessary columns from CSV](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#138750 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")* was created by *[Savickis](/forum/user/26490-savickis "View Savickis's Profile")*

-- HikaShop version -- : 2.2.3 Business
-- Joomla version -- : 2.5.17

Hi!
**How to to remove some columns when exporting csv file "Orders &gt; Export" ?**

When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user_params, user_partner_id, user_created_ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found "administrator\components\com_hikashop\classes\widget.php" but it doesn't conrain column IDs? :huh:

[ ![h5b75893.jpg](/forum/attachment/14551) ](/forum/attachment/14551 "h5b75893.jpg")

Thank you in advance for advice.
Best regards!

- [ ![h5b75893.jpg](/forum/attachment/14551) ](/forum/attachment/14551 "h5b75893.jpg") [ ](/forum/attachment/14551?download=1 "h5b75893.jpg")

Last edit: 12 years 2 weeks ago by [Xavier](/forum/user/4105-xavier "View Xavier's Profile").

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

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

12 years 10 months ago [\#138772](#138772) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Remove columns from orders export CSV](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#138772 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

Hi,
The solution will be to edit the code of the file "export" of the view "order" of your back-end template through "Hikashop-&gt;Display-&gt;Views", but note that some development skills will be required to do that.
Also, you'll probably find some information through this [ thread ](http://www.hikashop.com/forum/import-export-csv-xls/861919-export-custom-csv.html#123446):

> All the code which generate the CSV file is in the view " backend \| your\_backend\_template \| order \| export ".
> You can edit the view in order to change how the export is made. Removing or adding new columns.
>
> The first part of the view create the first line with the column title and after, there is a loop (a "foreach") on every selected orders to export their content.

The following user(s) said Thank You: [Odda](/forum/user/6543-odda "View Odda's Profile"), [Savickis](/forum/user/26490-savickis "View Savickis's Profile")

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

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

Less More

- Posts: 41
- Thank you received: 9
-
-

12 years 10 months ago -  12 years 10 months ago [\#138853](#138853) by [Savickis](/forum/user/26490-savickis "View Savickis's Profile")  Replied by *[Savickis](/forum/user/26490-savickis "View Savickis's Profile")* on topic *[Remove columns from orders export CSV](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#138853 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

Hi, and thanks for pointing direction. However a bit additional help is needed -

By default it seems that "foreach" loop exports ALL fields available in order. As I actaully need to only show few of the columns, how to rewrite following part to only include, for example, just columns "user_email, order_id, order_full_price"?

Code:

if($maxProd &amp;&amp; !empty($productFields)) { $first = array(); $o = reset($this-&gt;orders); foreach($o as $key =&gt; $val) { if(is_array($val)) continue; $first[] = $key; } $o = null; for($i=1;$i&lt;=$maxProd;$i++){ foreach($productFields as $field){ $first[] = 'item'.$i.'_'.$field; } } } else { $first = array_keys(get_object_vars(reset($this-&gt;orders))); } $export-&gt;writeLine($first);

Last edit: 12 years 10 months ago by [Savickis](/forum/user/26490-savickis "View Savickis's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84NjQ3OTktcmVtb3ZlLXVubmVjZXNzYXJ5LWNvbHVtbnMtZnJvbS1jc3Y/dG1wbD1tYXJrZG93bg==) 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: 86359
- Thank you received: 14296
-
-

12 years 10 months ago [\#138921](#138921) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Remove columns from orders export CSV](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#138921 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

You can change the line: Code:

$first[] = $key;

to something like: Code:

if(in_array($key,array('user_email','order_id','order_full_price'))) $first[] = $key;

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

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

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

Less More

- Posts: 41
- Thank you received: 9
-
-

12 years 10 months ago -  12 years 10 months ago [\#139002](#139002) by [Savickis](/forum/user/26490-savickis "View Savickis's Profile")  Replied by *[Savickis](/forum/user/26490-savickis "View Savickis's Profile")* on topic *[Remove columns from orders export CSV](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#139002 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

Hello, and thanks for help.

This is the final working code, if somebody else is interested.\
As an example, it returns only three of all columns (defined in "key, array" row):
Code:

if(!empty($this-&gt;orders)){ $maxProd = 0; $productFields = null; foreach($this-&gt;orders as $order){ $nbProd = count($order-&gt;products); if($maxProd &lt; $nbProd){ $maxProd = $nbProd; if(empty($productFields)){ $productFields = array_keys(get_object_vars(reset($order-&gt;products))); } } } if($maxProd &amp;&amp; !empty($productFields)) { $first = array(); $o = reset($this-&gt;orders); foreach($o as $key =&gt; $val) { if(is_array($val)) continue; if(in_array($key,array('order_number','user_created','user_email'))) $first[] = $key; } $o = null; for($i=1;$i&lt;=$maxProd;$i++){ foreach($productFields as $field){ $first[] = 'item'.$i.'_'.$field; } } } else { $first = array_keys(get_object_vars(reset($this-&gt;orders))); } $export-&gt;writeLine($first); foreach($this-&gt;orders as $row){ if(!empty($row-&gt;user_created)) $row-&gt;user_created = hikashop_getDate($row-&gt;user_created,'%Y-%m-%d %H:%M:%S'); if(!empty($row-&gt;order_created)) $row-&gt;order_created = hikashop_getDate($row-&gt;order_created,'%Y-%m-%d %H:%M:%S'); if(!empty($row-&gt;order_modified)) $row-&gt;order_modified = hikashop_getDate($row-&gt;order_modified,'%Y-%m-%d %H:%M:%S'); $new_row = array(); foreach ($row as $key =&gt; $value) { if(in_array($key,array('order_number','user_created','user_email'))) $new_row[$key] = $value; } if($maxProd &amp;&amp; !empty($productFields)){ for($i=1;$i&lt;=$maxProd;$i++){ $prod =&amp; $row-&gt;products[$i-1]; foreach($productFields as $field){ $n = 'item_'.$i.'_'.$field; $row-&gt;$n = @$prod-&gt;$field; } } } $export-&gt;writeLine($new_row); } }

Last edit: 12 years 10 months ago by [Savickis](/forum/user/26490-savickis "View Savickis's Profile").

The following user(s) said Thank You: [tanyatanya](/forum/user/513-tanyatanya "View tanyatanya's Profile"), [vaclav](/forum/user/6663-vaclav "View vaclav's Profile"), [mahtar](/forum/user/30329-mahtar "View mahtar's Profile"), [pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile"), [jonathan.lee](/forum/user/33479-jonathan-lee "View jonathan.lee's Profile")

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

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

Less More

- Posts: 90
- Thank you received: 0
-
-

12 years 1 month ago [\#174952](#174952) by [tanyatanya](/forum/user/513-tanyatanya "View tanyatanya's Profile")  Replied by *[tanyatanya](/forum/user/513-tanyatanya "View tanyatanya's Profile")* on topic *[Remove columns from orders export CSV](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#174952 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

Hi,

I've used the code you posted to customise my order export and it has all worked well with one exception. I'm only getting the order info and none of the purchased products info. Any ideas what I'm doing wrong?

Thanks

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

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

Less More

- Posts: 95
- Thank you received: 1
-
-
-

12 years 3 weeks ago [\#176331](#176331) by [vaclav](/forum/user/6663-vaclav "View vaclav's Profile")  Replied by *[vaclav](/forum/user/6663-vaclav "View vaclav's Profile")* on topic *[Add product code and qty to the edited export file](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#176331 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

Hello Nicolas,

thanks for this help.

I am trying to do the same - it works as I need for these columns:

**order\_number','order\_full\_price','order\_payment\_method','shipping\_address\_firstname','shipping\_address\_lastname','shipping\_address\_street','shipping\_address\_post\_code','shipping\_address\_city','shipping\_address\_country'**

I would need to add these columns to the columns above but working as in original order view file (making a column for each product in exported order but only for these two columns - like: 'item1_order_product_quantity','item1_order_product_code','item2_order_product_quantity','item2_order_product_code','item3_order_product_quantity','item3_order_product_code'..........):

**'item\_order\_product\_quantity','item\_order\_product\_code'** (to make columns for all product in each order)

How can I do this?

Thanks
Vaclav

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84NjQ3OTktcmVtb3ZlLXVubmVjZXNzYXJ5LWNvbHVtbnMtZnJvbS1jc3Y/dG1wbD1tYXJrZG93bg==) 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: 86359
- Thank you received: 14296
-
-

12 years 2 weeks ago [\#176337](#176337) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add product code and qty to the edited export file](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#176337 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

Hi,

for the product columns, you can change the code: Code:

$first[] = 'item'.$i.'_'.$field;

to: Code:

if(in_array($field,array('order_product_code','order_product_quantity'))) $first[] = 'item'.$i.'_'.$field;

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

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

Less More

- Posts: 95
- Thank you received: 1
-
-
-

12 years 2 weeks ago -  12 years 2 weeks ago [\#176763](#176763) by [vaclav](/forum/user/6663-vaclav "View vaclav's Profile")  Replied by *[vaclav](/forum/user/6663-vaclav "View vaclav's Profile")* on topic *[Add product code and qty to the edited export file](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#176763 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

Hello Nicolas,

thanks for your reply. It is not working. It only changed the column names to the columns I need to be exported but there are no data for any product in the exported file.

See attached file for reference - export file and my edited order export view file.

Thanks
Vaclav

Last edit: 12 years 2 weeks ago by [Xavier](/forum/user/4105-xavier "View Xavier's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84NjQ3OTktcmVtb3ZlLXVubmVjZXNzYXJ5LWNvbHVtbnMtZnJvbS1jc3Y/dG1wbD1tYXJrZG93bg==) 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: 86359
- Thank you received: 14296
-
-

12 years 2 weeks ago [\#176913](#176913) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add product code and qty to the edited export file](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#176913 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

Hi,

Ok, try instead to change the line: Code:

$productFields = array_keys(get_object_vars(reset($order-&gt;products)));

to: Code:

$productFields = array('order_product_code','order_product_quantity');

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

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

Less More

- Posts: 10
- Thank you received: 0
-
-

12 years 1 week ago [\#177984](#177984) by [radisnoir](/forum/user/31293-radisnoir "View radisnoir's Profile")  Replied by *[radisnoir](/forum/user/31293-radisnoir "View radisnoir's Profile")* on topic *[Add product code and qty to the edited export file](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#177984 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

Hello I have the same problem.
I tried what you say in this discussion and I get a very satisfactory result, except for the products.

I tried

> $ productFields = array ('order\_product\_code', 'order\_product\_quantity');

But it does not work for me.

Can you help me?

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

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

Less More

- Posts: 95
- Thank you received: 1
-
-
-

12 years 1 week ago [\#177996](#177996) by [vaclav](/forum/user/6663-vaclav "View vaclav's Profile")  Replied by *[vaclav](/forum/user/6663-vaclav "View vaclav's Profile")* on topic *[Add product code and qty to the edited export file](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#177996 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

Hello Nicolas,

thanks for your reply.

This solution does not work. All is as I need except products - it just shows the column names but any data.

Any other idea?

Thanks
Vaclabv

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84NjQ3OTktcmVtb3ZlLXVubmVjZXNzYXJ5LWNvbHVtbnMtZnJvbS1jc3Y/dG1wbD1tYXJrZG93bg==) 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: 86359
- Thank you received: 14296
-
-

12 years 1 week ago [\#178033](#178033) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add product code and qty to the edited export file](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#178033 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

Hi,

We're already way beyond user support here. I already gave several potential solutions but without proper development and debug I can't say exactly. This would require proper development to get the desired format.
I invite you to contact our partners for a quote on such customization: [ www.hikashop.com/home/our-partners.html](http://www.hikashop.com/home/our-partners.html)

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

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

Less More

- Posts: 10
- Thank you received: 0
-
-

12 years 1 week ago [\#178096](#178096) by [radisnoir](/forum/user/31293-radisnoir "View radisnoir's Profile")  Replied by *[radisnoir](/forum/user/31293-radisnoir "View radisnoir's Profile")* on topic *[Add product code and qty to the edited export file](/forum/37-import-export-csv-xls/864799-remove-unnecessary-columns-from-csv#178096 "-- HikaShop version -- : 2.2.3 Business -- Joomla version -- : 2.5.17  Hi! How to to remove some columns when exporting csv file &quot;Orders &gt; Export&quot; ?  When I export orders list as CSV, there are lot of columns that are unecessary for our accountant (e.g. user&#95;params, user&#95;partner&#95;id, user&#95;created&#95;ip, etc.). Which file must be edited and overrided, so I can get rid of these columns? I found &quot;administrator&#92;components&#92;com&#95;hikashop&#92;classes&#92;widget.php&quot; but it doesn't conrain column IDs? :huh:  Thank you in advance for advice. Best regards!")*

I finally managed to do what I wanted. Info command + products.
Thanks to you.

Here is my code:

Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 2.3.2 * @author hikashop.com * @copyright (C) 2010-2014 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt;&lt;?php while(ob_get_level() &gt; 1) ob_end_clean(); $config =&amp; hikashop_config(); $format = $config-&gt;get('export_format','csv'); $separator = $config-&gt;get('csv_separator',';'); $force_quote = $config-&gt;get('csv_force_quote',1); $export = hikashop_get('helper.spreadsheet'); $export-&gt;init($format, 'hikashop_export', $separator, $force_quote); if(!empty($this-&gt;orders)){ $maxProd = 0; $productFields = null; foreach($this-&gt;orders as $order){ $nbProd = count($order-&gt;products); if($maxProd &lt; $nbProd){ $maxProd = $nbProd; if(empty($productFields)){ $productFields = array('order_product_code','order_product_quantity'); } } } if($maxProd &amp;&amp; !empty($productFields)) { $first = array(); $o = reset($this-&gt;orders); foreach($o as $key =&gt; $val) { if(is_array($val)) continue; if(in_array($key,array('order_number','user_created','user_email','order_status','order_payment_method','order_full_price','order_discount_price','shipping_address_title','shipping_address_firstname','shipping_address_lastname','shipping_address_street','shipping_address_street2','shipping_address_post_code','shipping_address_post_code','shipping_address_city','shipping_address_telephone','shipping_address_state','shipping_address_country' ))) $first[] = $key; } $o = null; for($i=1;$i&lt;=$maxProd;$i++){ foreach($productFields as $field){ if(in_array($field,array('order_product_code','order_product_quantity'))) $first[] = 'item'.$i.'_'.$field; } } } else { $first = array_keys(get_object_vars(reset($this-&gt;orders))); } $export-&gt;writeLine($first); foreach($this-&gt;orders as $row){ if(!empty($row-&gt;user_created)) $row-&gt;user_created = hikashop_getDate($row-&gt;user_created,'%Y-%m-%d %H:%M:%S'); if(!empty($row-&gt;order_created)) $row-&gt;order_created = hikashop_getDate($row-&gt;order_created,'%Y-%m-%d %H:%M:%S'); if(!empty($row-&gt;order_modified)) $row-&gt;order_modified = hikashop_getDate($row-&gt;order_modified,'%Y-%m-%d %H:%M:%S'); $new_row = array(); foreach ($row as $key =&gt; $value) { if(in_array($key,array('order_number','user_created','user_email','order_status','order_payment_method','order_full_price','order_discount_price','shipping_address_title','shipping_address_firstname','shipping_address_lastname','shipping_address_street','shipping_address_street2','shipping_address_post_code','shipping_address_post_code','shipping_address_city','shipping_address_telephone','shipping_address_state','shipping_address_country' ))) $new_row[$key] = $value; } if($maxProd &amp;&amp; !empty($productFields)){ for($i=1;$i&lt;=$maxProd;$i++){ $prod =&amp; $row-&gt;products[$i-1]; foreach($productFields as $field){ $n = 'item_'.$i.'_'.$field; $new_row[$n] = @$prod-&gt;$field; } } } $export-&gt;writeLine($new_row); } } $export-&gt;send(); exit;

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

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