Hi, I'm trying my first export with cron job.
COMMAND:
/var/www/vhosts/system/MYNAME/administrator/components/com_csvi/helper/cron.php --key="MYKEY" --template_name="MYNAMETEMPLATE"
ERROR BY EMAIL:
/bin/sh: /var/www/vhosts/system/MYNAME/administrator/components/com_csvi/helper/cron.php: No such file or directory
Help me, please.
I'm using CSV 6.4.3, Virtuemart 3.0.12, Joomla 3.4.5.
Hello,
The path to the PHP executable in your cron command is missing. Have a look at the the documentation on setting up the cron job.
Kind regards,
Tharuna
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Hi tharuna thanks !!
NEW COMMAND:
php /var/www/vhosts/system/MYNAME/administrator/components/com_csvi/helper/cron.php --key="MYKEY" --template_id="MYIDTEMPLATE"
Works well !!
But I've another problem.
The output csv file is always rewrited, i need, if it exists, do not delete but append it.
Is it possible ?
Hello,
This is not possible. CSVI always writes a new file. The only way around it is that you create a filename that has a timestamp for example. Have a look at the Customizing the export filename document.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Thanks Roland, I've another two questions:
-
Is it possible to delete the input csv file after an import?
-
How can I set the range of date for export "customers" and "orders" ?
Hello,
Is it possible to delete the input csv file after an import?
This depends. If you are loading the file From Server, and you click on the Advanced button you will see the option to Delete the file after import. Deleting From URL isn't possible and From FTP isn't implemented yet.
How can I set the range of date for export "customers" and "orders" ?
In your template on the Options tab you can set a date range.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Hi Roland, I'm not clear.
I'm using cron job and i try to repeat my questions:
-
How can I delete a csv file after an import using cron job ?
-
Every day I need to export only users or orders created the day befroe. Is there an option or a filter in cron line command ?
Thanks.
Hello,
How can I delete a csv file after an import using cron job ?
Same answer as before. If you want to control it yourself, you will need to create a bash script to do so.
Every day I need to export only users or orders created the day befroe. Is there an option or a filter in cron line command ?
For orders you have the option in your template to export "Since last run", this is usually used to get the last batch of items.
For customers you will need to do it on the command line as this doesn't have the "Since last run" option. The Setting up a cron-job explains how to add command line arguments.
To use a date you will need to use the system functions to generate the date for you. There are quite a few posts about that on the forum but people in general use something like this
--form.orderdatestart=$(date -v-5d +"\%d-\%m-\%Y")
You will need to find out for yourself how it works on your server.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Hi, I don't have the key cron in my template options. I need to set "User modified date" from command line and this --form.orderdatestart=$(date -v-5d +"%d-%m-%Y") don't work.
[root@admin49178387 ~]# php /var/www/vhosts/admin49178387.localhost/MYNAME/administrator/components/com_csvi/helper/cron.php --key="MYKEY" --template_id="1" --form.orderdatestart$(date -v-5d +"%d-%m-%Y")
date: invalid option -- 'v'
Try `date --help' for more information.
Use --help to see the help information
Processing started...
Template ESPORTA CLIENTI
Hello,
I don't have the key cron in my template options.
You don't have CSVI 6 installed? Older CSVI versions are no longer supported, so an update is recommended. Make sure you follow the update guide of CSVI 6.
form.orderdatestart=$(date -v-5d +"%d-%m-%Y") don't work
This was a suggestion, I wasn't implying that this would work just others have used it. This is no longer CSVI code but has to do with your server operating system.
You will need to find out which works for your server, perhaps ask your hosting provider.
Test the code you want to use, since you have SSH access that is the easiest way to do it. The date command should output a date in the format of day-month-year (example: 31-12-2015).
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Hi Roland, now I've installed CSVI 6.5.6 - Joomla 3.5.1 - Virtuemart 3.0.12 and I see the key CRON.
I'm not able to set command line for the date.
When I set the date inside the template it works well.
The problem is that CRON.PHP don't read the date from command line.
Mi server says that date +"%m-%d-%Y" is OK.
This is the last test:
php /var/www/vhosts/admin49178387.localhost/MYNAME/administrator/components/com_csvi/helper/cron.php --key="MYKEY" --template_id="1" --form.userinfomdatestart=$(date +"%m-%d-%Y")
When I see the log of CSV IMPROVED using the template from backoffice the field (for example) is
2016-04-13 09:58:38 0 [DEBUG] userinfomdatestart: 01-01-2016 11:48:12
When I see the log of CSV IMPROVED using CRON.PHP the field userinfomdatestart is empty.
2016-04-13 10:09:57 0 [DEBUG] userinfomdatestart:
Help me, please :(
Hi Roland, another problem.
The option "delete after import" do not work !!.
Hello,
The problem is that CRON.PHP don't read the date from command line.
Well the question is if there is any date actually supplied. Did you check by specifying the date directly into the command line? Like this:
php /var/www/vhosts/admin49178387.localhost/quorestore.it/administrator/components/com_csvi/helper/cron.php --key="mafrat" --template_id="1" --form.userinfomdatestart="01-01-2016"
In your command you are missing the " around the date value.
The option "delete after import" do not work !!.
That is another question for another thread. Supply more information than "It doesn't work", I can't help you if that is all you tell me. Make a new thread and post the information requested under Looking for a useful answer?.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
hi,
I have just launched this command but not work. it is as if this parameter was not read, while if I value this field in the template it work.
Hello,
The debug log tells me something very interesting: PHP version: 5.3.3
CSVI requires a minimum of PHP verison 5.4, so I think you will need to adjust your cron command to use a newer PHP version. Usually this is located in a place like /usr/bin/php but you may need to ask your host for the exact path.
So let's use an up-to-date PHP version first and then see what happens. Although PHP 5.4 is out of support as well by the PHP developers :)
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Thanks Roland, for your great help, I really appreciated it.
With php version 5.4 it works well.
Here is our correct command line:
php /var/www/vhosts/admin49178387.localhost/myname/administrator/components/com_csvi/helper/cron.php --key="mykey" --template_id="1" --form.userinfomdatestart=$(date --date="1 days ago")
I hope, as soon as possible, to have the option to append export csv file and not only to delete it if exists.
What do you think about this ?
Hello,
Thank you for giving your solution.
As for appending the output, I am not sure, this is the first time this has been asked and I don't see the true benefit of it. If you are appending, you may was well change the date from when it needs to be exported. For example, on Monday you export Monday and on Tuesday you export Tuesday but you want this appended to the Monday export. Why not export Monday and Tuesday on Tuesday?
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Hi Roland I try to explain.
Every night there is the export, using CSV IMPROVED, of users and orders and, the
files, are sent by ftp.
After the export there is another software of another company that read and copy the files inside his procedure, if this software works well the files are deleted otherwise, if this software fails or not run, the export files remain good for the next night.
**In this case I need append new data to the existing files to don't lose data.
**
Every night there is the import, using CSV IMPROVED, of products and trackingorders and the files are taked from ftp.
At the end of import i need to delete the files: to do this you told me that CSV IMPROVED is not able to delete by ftp and I wrote a script that runs at the end of schedulation by cron.
All must work well automatically.
Thanks for the help.
Hello,
The software of the other company that pulls the export files from FTP, can it handle multiple files in a single folder? If that is possible, you could have CSVI create unique files per day. That way you could see which files are actually processed and which ones are not. If they failed, they could try again.
As for deleting the file from FTP, that is on our todo list.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Unfortunately the software of the other company that pulls the export files from FTP, cannot handle multiple files in a single folder. :( I had already thought !!
For deleting the file from FTP I'm waiting the next release.
Hello,
So we have to change something because they can't handle it :) You can modify the core file administrator\components\com_csvi\models\exports.php by finding this line
$this->handle = fopen($this->processfile, 'w+');
and change it to
$this->handle = fopen($this->processfile, 'a+');
see if that works for you.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Hi Roland, I tried your patch but nothing appened.
In attachment Log 75 with w+ where the file is created.
Log 76 with a+, with the same input data, where the file is'nt duplicate.
Hello,
The only difference between w and a is that w will always empty the file on export or create it if it doesn't exist and a will always append to the file on export or create it if it doesn't exist.
This means if you want to append, you must specify a filename in your template. That you have done as far as I can see. So the question is if data has been appended or not.
You said nothing happened, that is very little info, so with a+ no file, nothing happens?
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
I mean that if I use w+ or use a+ does not change anything, always work as w +: is it possible for you using my user name and password to try yourself?
In attachment export.php ( .txt is only to attach ).
There is onother fopen w+ in com_csvi\addon\com_virtuemart\model\maintenance.php, I don't know if it is necessary to change in a+.
But, Roland, I'm thinking another way to solve my problem.
When I don't put the name of the file to be exported, "CSV IMPROVED" give to the file the name CSVI_TEMPLATENAME_14-04-2016_18.13.csv.
Can I cut the hour and change the name like this: CSVI_TEMPLATENAME_14-04-2016?
In this case I could tell the other companies to open the export files, every day, with the same "name+date.csv" and do not make more the append.
Hello,
The fopen in maintenance has nothing to do with the export.
To change the filename, have a look at the documentation Customizing the export filename. That will do what you are asking.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Hi Roland, the filename is OK !! But the other company wants the append !!
But in your website the parameter -a works well ?
Hello,
I did not test appending because it won't be in the core. That is why I said you can check if it works for you. By the way it is not the -a parameter, it is a+. I assume you used that.
Every time you export you get a new file? What happens to the content of the file on export?
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Both w+ and a+ works exactly in the same way.
Every time I export I get a new file.
Not according to the PHP documentation.I see I should only ask 1 question at a time.
Every time you export you get a new file?
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Yes, every time I export I get a new file.
Does the file have the same name?
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Yes, the file have the same name.
Ok, so the data in the file is different for the first and second export?
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Yes, the data are the same both in the first that in the second export.
So this gave me another idea. The option w+ or a+ do work differently but CSVI works on a temporary file which is eventually copied to it's final location.
The copy is done with JFile::copy() function. This function has no append option. So if you want to append you may need to rewrite the whole part where this is handled. This is line 1121 in the exports.php file where you made the other change.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Hi Roland, I hope that you aren't tired of me.
I've put in export file name product_export_[Y][m][d].csv, if I save on server it's works well but doesn't work in save on ftp.
SAVE ON SERVER: product_export_2016_04_22.csv
FILE FTP: product_export_[Y][m][d].csv
Hello,
Not tired yet, been doing this for 10 years now :)
That may well be a bug, we will look into this.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Hi Roland, are there any news about this problem ?
Ths.
I've put in export file name product_export_[Y][m][d].csv, if I save on server it's works well but doesn't work in save on ftp.
SAVE ON SERVER: product_export_2016_04_22.csv
FILE FTP: product_export_[Y][m][d].csv
Hello,
This is being worked on for the next release, so in CSVI Pro 6.6.0 the FTP export will also be able to use these placeholders.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Hi Ronald, do you think the next release will be released in this month?
Otherwise I have the problem that, with standard names, the day of the week for the first nine days of the month is created with only one character.
For Example: CSVI_clienti_1-05-2016_22.05.csv
I'd like to have the name: CSVI_clienti_01-05-2016_22.05.csv
Thanks.
Hello,
Apply the patch attached and your FTP filename should be updated as well. Let me know how it goes.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Perfect.:-)
Log in to reply to this topic.