Mass Action Documentation

  • Posts: 21
  • Thank you received: 0
9 years 5 months ago #203360

I need more information on the trigger of the mass actions.

I have a mass actions that needs to run at the start of each month. How do I trigger it?

a) Is a cron job necessary to trigger the mass actions? (The documentation on mass action does not mention cron jobs. The documentation on cron jobs does not mention mass actions).
b) When I set trigger to "every months", when will it actually run? How do I ensure it does not run the current month, but only next month?
c) Can I set a timed trigger, e.g. 10 p.m. on May 31st (an accuracy of about one hour +/- would be sufficient)
d) Can I set a date validation, e.g. "do not run before June 1st" in case it is triggered to early?

Thanks for your help (and eventually updating the documentation in this regard).

Best
Gunnar

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
9 years 5 months ago #203364

Hi,

a) yes, the configuration of the cron is necessary if you want to use periodic triggers.

b) If the cron is configured, it will run once a month. In the hikashop_config table there is a namekey massaction_last_trigger_months which will contain a timestamp of the last time the mass actions for "every month" were triggered. Next trigger for them will be a month after that (actually 30 days).

c) There is no such system in place. It would require a custom plugin.

d) There is no such system in place. It would require a custom plugin.


I'll see with Xavier to improve the documentation on the mass actions and see if some of the things you're talking about could make sense in the general system of the mass actions.

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

  • Posts: 21
  • Thank you received: 0
9 years 5 months ago #203440

Thanks for the quick and comprehensive answer.

As my hosting package does not include cron jobs, I could use your service (thank you for that option). That would run at least every hour, hence 24*7*30 = 5040 times instead of once, which would be a bit overkill.

c) and d) could be replaced by a dynamic date functionality, you may consider also:

Filter: product_sale_start >= today (or now).

Currently this is a manually entered date.

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

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

Hi,

Regarding the cron per months, in the mass action settings you can set the trigger on "Months".
Then in the cron settings, you have to enter a value in minutes for the cron period, so in that field you can set "1440" to execute the cron every days.

This way it will be called 30 times instead of once. which is reasonable.

For c) and d) that feature we will see to add that on our Todo list ;)
But at this time if you set the cron on everyday, so you can set a filter in the mass actions to restrict the date interval.
The value to use for this case is: {time}-86400 where "86400" is a value in seconds.

In order to call the cron at a specific hour, you can change the "cron_next" and "cron_last" values in the #__hikashop_config table via phpMyAdmin.

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

  • Posts: 112
  • Thank you received: 3
9 years 1 month ago #218400

For the novices in the crowd, I did not understand that the triggers in Mass actions had to be connected to cron. In the documentation for HikaSHop cron, it says it only activates currency updates:

"For now only the automatic update of rates requires a Cron task. However, the cron task will be used more extensively in the future to provide features like notification of start of sales, orders status automatic changes, etc."

But, I need to have a daily report run automatically. Can you provide specific instructions for how to set this up? Hopefully, it does not involve your users to use PHP to make it work.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 1 month ago #218428

Hi,

In the mass actions, you can set trigger on every days directly.
If you set up the cron in Configuration > Cron so the mass action will be triggered every days.

No need of PHP.

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

  • Posts: 112
  • Thank you received: 3
9 years 1 month ago #218517

I must be doing something wrong and I am also getting an error message. So, let me take you through step by step so you can figure out what I am doing wrong:

Mass Actions:
• I set the mass action to hourly for testing purposes. See mass actions.jpg

cron
• I have set cron to the quickest frequency which is every 15 minutes. When I save this setting, I get an error that I do not understand. See cron setup page 2.
• The first page I see when I go to your cron page is set up as shown in cron page 1.

Please let me know what I am doing wrong.

Tom

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
9 years 4 weeks ago #218519

Hi,

If the action is not launched, so this seems to be due to the cron error you have.

Is the url in the cron settings the one attached to your account on our website ?
hikashop.com/my-account/your-subscriptions.html

Please check if it is set in "http" or "https".
www.hikashop.com/support/support/documen...ashop-cron-task.html

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

  • Posts: 112
  • Thank you received: 3
9 years 4 weeks ago #218637

You are correct. The subscription in my Hikashop account shows as "http:" I have tried several times to change it to "https:". But, it always reverts back to "http:"

With that said, cron appears to be working now. However, when it triggers the Mass action that should be sending a CSV file, it sends the email notification and not the CSV file that should be included in the email. The CSV file is not created in the /tmp folder.

The action works correctly when I manually "Process" the action. I know the CSV file will not be generated or sent if the data is empty. But, there is data that should be sent in the CSV file. When the action is triggered manually, the CSV file is created in the /tmp folder and it is sent in the email notification.

Last edit: 9 years 4 weeks ago by tbroderick. Reason: added more info

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

  • Posts: 13201
  • Thank you received: 2322
9 years 4 weeks ago #218671

Hi,

Do you have other mass actions which could be interacting with this one ?
I mean other that are triggered at the same time ?

If it is I just edited you massaction class in order to solve this issue.
Please do a test and tell me if that solve the issue.

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 4 weeks ago #218735

I have several I would like to run. But, no, this is the only action running while I test the process. How do I modify my Mass action class?

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

  • Posts: 112
  • Thank you received: 3
9 years 4 weeks ago #218743

No, while the action is triggered and an email is sent saying the css file was sent, the css file is not created and is not sent with the email. This is when cron is used to trigger the task. When the task is activated manually, the entire process works properly and the css file is sent with the email.

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

  • Posts: 112
  • Thank you received: 3
9 years 4 weeks ago #218781

When Cron is used, the CSV file is not sent when the Mass actions are called.

While the action is triggered and an email is sent saying the css file was sent, the css file is not created and is not sent with the email. This is when cron is used to trigger the task. When the task is activated manually, the entire process works properly and the css file is sent with the email.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 4 weeks ago #218811

Hi,

Is that issue happening with the "Export a csv file" action too or only with the custom action "custom_csv_export" ?
I have added a debug in the custom action, so this will write content in the file "/tmp/dbg.txt" to help me to debug.

Could you try too to change the value of the option "embed_files" in Configuration > Main > Emails ?

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

  • Posts: 112
  • Thank you received: 3
9 years 4 weeks ago #218870

I thought you might have hit the answer. The "Embed Attachments" was turned off. I turned it to "yes". But, the css file did not generate or get sent in the email. When it was set to "no", it did not send a link to the file either. At the moment, I have all of the email settings set to "yes" as shown here: www.dropbox.com/s/wr9vquc071bjoul/Screen...%2010.06.42.jpg?dl=0

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

  • Posts: 112
  • Thank you received: 3
9 years 4 weeks ago #218873

It looks like the css file is not being created. This is the standard csv file and not the custom one. But, there is neither the link nor the file in the email.

Last edit: 9 years 4 weeks ago by tbroderick. Reason: update

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

  • Posts: 13201
  • Thank you received: 2322
9 years 3 weeks ago #218883

Hi,

Please give me the name of the action having the issue, I will do a complete debug on your website.
For the moment, I think that the file is not generated so nothing in the email because there is no data get.
No elements to export, so if there is no elements, no reason to create the file.

Now, the question is, why it does not get any elements ? maybe due to the filter based on the {time}...

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

  • Posts: 112
  • Thank you received: 3
9 years 3 weeks ago #218913

The Mass Action is Daily Quickbooks Report (E). There is an action with the word "Test" in it that you can use also.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 3 weeks ago #219143

Hi,

There was an issue based on the generation of the paths, the server and web one, some times there was a missing "/" or "\".
So this should be solved with the new modifications I have done on your website.

Please keep us informed.

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 3 weeks ago #219185

It's working! Thanks!

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

Time to create page: 0.120 seconds
Powered by Kunena Forum