CSV Export of Orders From Hikashop

  • Posts: 90
  • Thank you received: 0
10 years 1 month ago #175504

-- HikaShop version -- : 2.3.2
-- Joomla version -- : 1.5.26

Hi all,
I have set up a mass action that should trigger whenever an order is created. I want it to export a CSV of the order information. The problem I am having is what to set in the 'Export Path'. Should this be a path on my local PC or a URL? Can it be set to an email address? Also, does the mass action page have to be left open for the export to happen? And finally. If I click the 'Process' button at the top of the page to force the mass action to immediately take place it exports a large number of orders from 2010 and 2011 only?!?
Any help is greatly appreciated :)

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

  • Posts: 13201
  • Thank you received: 2322
10 years 1 month ago #175511

Hi,

You have to set a relative path, the path source is the folder "media/com_hikashop_upload" on your server. You can reach it via FTP.
The emails are not yet handled by the mass actions,

Once configured and saved, you can close the mass action. It will be triggered automatically.
It exports only these orders because there is a limit, you should be able to see a "start" and "value" fields to limit the quantity of exported orders.

To have the desired ones, you can add filters, filters on dates, or simply on ordering and ordering direction to only get the latest orders.

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

  • Posts: 112
  • Thank you received: 3
9 years 6 months ago #201803

Hi Xavier,

I looks like you have added the ability to send the report via email now. But, I want to confirm. Also, I am having a difficult time getting the report emailed. I am able to get the report to save to the /logs folder and I am able to put the full path to the \logs folder along with the file name. It looks like this:

c:\inetpub\wwwroot\minicpap.com\DailyOrderReport.xls

The file is saved in the /logs folder, an email is sent to the correct email address with a link that goes to c:/inetpub/wwwroot/minicpap.com/DailyOrderReport.xls which is the remote server address. I need the link to be something that allows for the downloading of the file. What am I doing wrong?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 6 months ago #201915

Hi,

Could you provide a screenshot of the settings of your mass action ?

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

  • Posts: 13201
  • Thank you received: 2322
9 years 6 months ago #202060

Hi,

In the email, we give the link you set in the export path in case you want to get the file directly on the server.
Is it difficult, and sometime impossible to give you a download ling for the file based on this information.
The path is going to a folder which can be not reachable from internet, etc.

That's why you should see in the email a csv file attached directly with the correct content.
Please check in the file "plugins/hikashop/massaction_order/massaction_order.php", function "onProcessOrderMassActionexportCsv" if you have the code:

		if(!empty($email) && !empty($path)){
			$config = hikashop_config();
			$mailClass = hikashop_get('class.mail');
			$content = array('type' => 'csv_export');
			$mail = $mailClass->get('massaction_notification',$content);
			$mail->subject = JText::_('MASS_CSV_EMAIL_SUBJECT');
			$mail->html = '1';
			$csv = new stdClass();
			$csv->name = JText::_('MASS_CSV_EMAIL_FILE_NAME');
			$csv->filename = $path;
			$csv->url = $path;
			$mail->attachments = array($csv);
			$mail->dst_name = '';
			$mail->dst_email = explode(',',$email);
			$mailClass->sendMail($mail);
		}

The name of the csv file is the path indicated in the path field.

If you don't have any file attached, there is maybe an issue with the filename, so please try that code instead of the previous one:
		if(!empty($email) && !empty($path)){
			$config = hikashop_config();
			$mailClass = hikashop_get('class.mail');
			$content = array('type' => 'csv_export');
			$mail = $mailClass->get('massaction_notification',$content);
			$mail->subject = JText::_('MASS_CSV_EMAIL_SUBJECT');
			$mail->html = '1';
			$csv = new stdClass();
			$csv->name = JText::_('MASS_CSV_EMAIL_FILE_NAME');
			$csv->filename = preg_replace('#(.*)/#','',$path);
			$csv->url = $path;
			$mail->attachments = array($csv);
			$mail->dst_name = '';
			$mail->dst_email = explode(',',$email);
			$mailClass->sendMail($mail);
		}

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

  • Posts: 112
  • Thank you received: 3
9 years 6 months ago #202349

I am not having any success with setting the path such that the file is sent correctly in an email. When I set the path to:

c:/inetpub/wwwroot/[website-name]/tmp/orderfile.csv

the order file.csv is correctly placed in the tmp folder. The link in the email is also:

c:/inetpub/wwwroot/minicpap.com/tmp/orderfile.csv

When the email link is clicked, nothing happens. When I copy the link and paste it into the browser, an error "Cannot open Webpage" is given. This is the error

I have tried various changes to the path including one I found from Nicolas that was a few years old. I also tried to put the file into Dropbox and have it pulled from there in the email. But, I could not get that to work either.

Does the email feature work? If so, what am I doing wrong or what do I need to do to get it to work?

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

  • Posts: 13201
  • Thank you received: 2322
9 years 6 months ago #202392

Hi,

So nothing is attached in the email in your case ?
Have you tried to use the code previously given ?

To download the file, you can't use the server absolute path but you need to use a browser path, in your case I think it is:
[website-name].com/tmp/orderfile.csv

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

  • Posts: 112
  • Thank you received: 3
9 years 6 months ago #202455

I already tried the browser path. But, I tried it again after getting your response and it gives this message:

Warning
JFolder::create: Could not create directory.Path: C:\inetpub\wwwroot\minicpap.com\https:

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

  • Posts: 13201
  • Thank you received: 2322
9 years 6 months ago #202458

Hi,

I just tried the browser path and it is working, the file can be downloaded directly.
http://m______p.com/logs/DailyOrderReport.xls

The thing is that in the mass action you have to set an absolute server path, then in the email you should have an attached file.
If there is no attached file, you can still get the file thanks to the previous link by entering it directly in your browser address bar.

The email content can potentially be edited to set the html link instead of the server one.

Last edit: 9 years 6 months ago by Xavier.

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

  • Posts: 112
  • Thank you received: 3
9 years 5 months ago #202989

Xavier,

The mass action reports are indeed going into the correct folder on the server. But, there is no file in the email and the path used in the link in the email is for the server path. I will use the workaround you provided. Thanks! But, these reports are going to a client. It would be much more professional to be able to send a daily email with the correct link or file. This would allow me to apply the date and time to the files as is described in a separate forum message.

Has any progress been made on getting the order data fields to populate in the CSV file? The data is not populating the report. So, the next section of data which is the customer info is pushed to the left to fill in the missing data. I have already reinstalled the latest HS version.

Is there a way to rearrange the fields for a specific report? This client needs a daily orders report that has the fields in a specific order. They want to use the HS order report to upload into their order processing system and need the fields in a specific order.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 5 months ago #203007

Hi,

As asked in the email, once we will have the FTP access we will be able to debug the email issue in order to attach the csv file to the email directly.

There is no way by default to rearrange the fields for a specific report, this will require custom code, the easiest way will be to create a plugin with a new action for the mass actions based on the current export csv function.

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

  • Posts: 112
  • Thank you received: 3
9 years 5 months ago #203150

Thank you for all your help!

Is there a way in Mass actions to have an automated daily report generated that contains the data from the previous day? For the previous 7 days?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 5 months ago #203166

Hi,

You can create a mass-action which will be processed each day.
So then if you use the time variables in your mass-action, yes you can achieve that.

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.

  • Posts: 112
  • Thank you received: 3
9 years 5 months ago #203269

So, what should the settings be if I want to automatically send a report every day that contains the order data from the previous day. I assume the trigger would be "Every Days". But, I do not see a setting in the triggers or filter for "yesterday" or anything else that would automatically default to the previous days data.

Thanks for your help.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 5 months ago #203290

Hi,

Like I said in my previous message ; you can use "time variable" in the mass-action.
It means that you can have an action triggered every day which will have filters to only look at the orders of the day before.

www.hikashop.com/forum/product-category-...npublish.html#196943
www.hikashop.com/forum/mass-actions/8705...category.html#168545

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.

  • Posts: 112
  • Thank you received: 3
9 years 5 months ago #203345

Hi,

We are getting there slowly but surely...

OK, I did not know anything about the {time} option that was the solution to the initial problem. But, now, I have the triggers set for "Every Minute" and the filter is set to {time} - 186,400 just to capture some data and just to test the process. But, the csv report is not being triggered every minute. I am letting it run in case it takes time to get the Hikashop server to pick up the task. But, after several minutes, it is not working. I have tested the process by running the report manually and everything works fine. It is the trigger element that is not working so far. I am continuing to let it run.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 5 months ago #203357

Hi,

If you use our own cron trigger system, the minimum limit for the cron trigger will be 15 minutes, so even if you configure your mass action to be triggered every minute, the mass action system will only be triggered every 15 minutes.
So maybe it comes from that ?
Is your mass action triggered every 15 minutes ?
Could you do a screenshot of how you configured your mass action ?

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

  • Posts: 112
  • Thank you received: 3
9 years 5 months ago #203374

No, the mass action is not triggered at all except manually.

This is a screen shot of the settings: www.dropbox.com/s/i46b15rt54538aa/Screen...%2009.49.17.jpg?dl=0

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

  • Posts: 13201
  • Thank you received: 2322
9 years 5 months ago #203408

Hi,

You mass action settings are correct, but your issue seems to be more related on the cron.
In HikaShop > Configuration > Cron, we can see that the last cron has been executed on the 6 April 2015.

On our website, under the "my subscriptions" part, do you have set the url of that website with your licence ?
Please check that, and check that you are using the "https" in the url.

The following user(s) said Thank You: tbroderick

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

  • Posts: 112
  • Thank you received: 3
9 years 5 months ago #203457

my subscription shows http://

When I try to update it, it keeps changing back to http://

Other than that, the subscription is correct.

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

Time to create page: 0.099 seconds
Powered by Kunena Forum