how to customize xls-list content (too many columns)

  • Posts: 19
  • Thank you received: 1
  • Hikashop Business
5 years 8 months ago #294931

-- HikaShop version -- : 3.5.0
-- Joomla version -- : 3.6.5
-- PHP version -- : 7.1.18
-- Browser(s) name and version -- : firefox

Hi together

I do need your help again ;) My question is about the Excel-download of customer orders. The download works propper but I would like to specify the xls-list.
Right now the list includes 130 columns with many many informations which is uncomfortable to handle. I tried to find the concerning file on our server – but i was not successful.
Would you be so kind to tell me which file in which folder is responsible for the xls-lists content?

Thank you so much in advance
Frank

Attachments:

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
5 years 8 months ago #294937

Hi,

It's the file "export" of the view "order" that you can edit via the menu Display>Views.
Alternatively, you can create a mass action of the "order" data with an action "export CSV file" which will allow you to select the columns you want in your CSV file.
www.hikashop.com/support/documentation/167-massaction-form.html

The following user(s) said Thank You: rakuzen

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

  • Posts: 30
  • Thank you received: 0
5 years 8 months ago #295478

I have the same question about export customer orders.
Is there any simpler method? to set up the columns that needs to be export, and then just let others press the export button?

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
5 years 8 months ago #295481

Hi,

The mass action solution is quite simple. Just create a mass action with an action "export CSV file" and select the columns you want and save the mass action.
Then, when you want to export, just go in the System>Mass actions menu, click on the mass action, and click on the "process" button in order to get the CSV file.
There is no simpler solution.

The following user(s) said Thank You: rakuzen

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

  • Posts: 30
  • Thank you received: 0
5 years 8 months ago #295682

Thanks for your reply,
If I need to change the CSV columns display of the data by the export button, as the reply above, I need to edit via the menu Display>Views.
Could you please give some basic example for the code?
ex. I just need to export "order_full_price","order_number","username"...

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
5 years 8 months ago #295704

Hi,

If you want to do that for the export button, then you indeed have to change the code of the export view file as explained before.

In that order/export.php view file, you can add such line:

unset($order->XXX);
before the line:
$nbProd = count(@$order->products);
for each column you wish to remove and where XXX is the name of the column.
For the columns of the items, you can just use unset($order->products); to remove them all.

The following user(s) said Thank You: rakuzen

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

  • Posts: 19
  • Thank you received: 1
  • Hikashop Business
5 years 3 months ago #301605

nicolas wrote: Hi,

If you want to do that for the export button, then you indeed have to change the code of the export view file as explained before.

In that order/export.php view file, you can add such line:

unset($order->XXX);
before the line:
$nbProd = count(@$order->products);
for each column you wish to remove and where XXX is the name of the column.
For the columns of the items, you can just use unset($order->products); to remove them all.


Hi!
I changed the export.php as mentioned above. And it works perfectly. :-)

But what do I have to add if I would like to remove columns like item1_order_product_id, item1_order_product_tax, and so on. I failed in modifying the "unset-code" :woohoo:


AND: is it possible to change the language code from "utf-8" to "ISO-8859-1" ?

BR, Frank

Last edit: 5 years 3 months ago by Frank.Oehlen.

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
5 years 3 months ago #301608

Hi,

Well, the instruction I gave is what you should do I think in that case, so I don't know what else to say. If you have an issue with that please provide a copy of what you did and the error that you got.

You have the function mb_convert_encoding in php to change the encoding of each text displayed in the exported file. The coding for that would be quite involved compared to just removing columns. If you're not a developer, I would recommend hiring one for that.

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

  • Posts: 19
  • Thank you received: 1
  • Hikashop Business
5 years 2 months ago #302123

Dear Nicolas,

again - thanks for your support concerning my concern.

unset($order->XXX); helped me to reduce the columns concerning the order data.

I even managed to reduce the product fields by using

for($i=1;$i<=$maxProd;$i++){
			foreach($productFields as $field){
				if (
				$field === 'order_product_quantity'
				|| $field === 'order_product_code' ) {
				$first[] = 'item'.$i.'_'.$field;	
				}
			}
		}
But now I - sorry - do have a last question (hopefully) ;)
At the moment utf-8 coding is used when creating the export-csv file. Would it be possible to switch it to iso-8859-1?

It would be awesome if it might be possible to chance :-)

Looking forward to hearing from you

Frank

Last edit: 5 years 2 months ago by nicolas.

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
5 years 2 months ago #302125

Hi,

There is no "switch". All the text in the database is in UTF8. If you want the CSV file to not be in UTF8 but something else, it will require converting each text to that other encoding when generating the export.
As I said already in my previous message, you'll have to use the mb_convert_encoding function for each text being output in the export.php view file. So it's possible, but it will require a lot more modifications than what you had to do for the removing of the columns even though it might sounds simpler to you. So as I said in my previous message, if you're not a developer, I would recommend hiring one for that.
If you're one, then look at how works the mb_convert_encoding function and use it on all the text variables.

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

Time to create page: 0.081 seconds
Powered by Kunena Forum