- Posts: 41
- Thank you received: 9
Remove unnecessary columns from CSV
-- Joomla version -- : 2.5.17
Hi!
How to to remove some columns when exporting csv file "Orders > 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:
Thank you in advance for advice.
Best regards!
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
The solution will be to edit the code of the file "export" of the view "order" of your back-end template through "Hikashop->Display->Views", but note that some development skills will be required to do that.
Also, you'll probably find some information through this thread :
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.
Please Log in or Create an account to join the conversation.
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"?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
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):
Please Log in or Create an account to join the conversation.
- Posts: 90
- Thank you received: 0
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 or Create an account to join the conversation.
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 or Create an account to join the conversation.
for the product columns, you can change the code:
Please Log in or Create an account to join the conversation.
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
Please Log in or Create an account to join the conversation.
Ok, try instead to change the line:
Please Log in or Create an account to join the conversation.
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 or Create an account to join the conversation.
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 or Create an account to join the conversation.
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
Please Log in or Create an account to join the conversation.
Thanks to you.
Here is my code:
Please Log in or Create an account to join the conversation.