- Posts: 16
- Thank you received: 0
csv Export path (Order)
- Thunder1001
-
Topic Author
- Offline
I try to use the hikashop.
But i want to auto export the order after creation.
I found the "Mass Actions" option.
There i select the a action after creation of a order for export a csv file.
If i leave the path empty the browser will push the csv as download file.
But i want to save it on serverside in a map with unique name so i can make a rotation with my erp packed to pickup and process that csv file.
How i define the path?
I tried with: c:\temp and c:\temp\ but i don't see any file.
Tom
Please Log in or Create an account to join the conversation.
You need to provide the full path of the CSV file that you want.
So for example:
c:\temp\my_export.csv
Please Log in or Create an account to join the conversation.
- Thunder1001
-
Topic Author
- Offline
- Posts: 16
- Thank you received: 0
So you need to use a fixed name for the file?
But then the file wil be override every time?
Is there any option that the system generate a randon filename, like ordernumber or customername or somthing?
Cause i want to make a import that check the directory every ... minutes for new files to import direct into our erp system.
Please Log in or Create an account to join the conversation.
There is no such "dynamic" option for the csv path.
Please Log in or Create an account to join the conversation.
- Thunder1001
-
Topic Author
- Offline
- Posts: 16
- Thank you received: 0
Is it not possible to edit the php code that you put a fixed path and user the hour/minute/second string .csv as filename?
Please Log in or Create an account to join the conversation.
You can potentially use this kind of code:
Please Log in or Create an account to join the conversation.
- Thunder1001
-
Topic Author
- Offline
- Posts: 16
- Thank you received: 0
Thx allot, that's what i need
But a little fix for other people who need it.
use this one
Please Log in or Create an account to join the conversation.
I am also interested to get a csv file with another name everytime I export via massaction.
After finding this solution I looked in the classes directory in the file massaction.php, but I can't find the function you are talking about.
Hope to hear from you,
Kind regards,
Wilfried
Thunder1001 wrote: Hi,
Thx allot, that's what i need
But a little fix for other people who need it.
use this oneinstead ofCode:$path = str_replace('.csv','-'.date('y-m-d H-m-s').'.csv',$path);Cause you cannot have " : " in your filenameCode:$path = str_replace('.csv','-'.date('y-m-d H:m:s').'.csv',$path);
Please Log in or Create an account to join the conversation.
replace
with
Please Log in or Create an account to join the conversation.
What should I fill in at the "export path" field?
I tried several combinations but I can't get a csv with such a filename into the directory.
Kind regards, Wilfried
Please Log in or Create an account to join the conversation.
For example /var/www/public_html/media/com_hikashop/upload/safe/orders.csv
where /var/www/public_html is absolute path to your site.
To find your absolute path, take a look in Global Configuration, tab System. There is "Path to Log Folder ". It's absolute path to logs folder.
Please Log in or Create an account to join the conversation.
So it works now.
Thanks!!!.
Kind regards, Wilfried
Please Log in or Create an account to join the conversation.
korzo wrote: For Hikashop 2.3.5 in file plugins\hikashop\massaction_order\massaction_order.php on line 302
replaceCode:$params->path = $path;
with
Code:$params->path = str_replace('.csv','-'.date('y-m-d H-m-s').'.csv',$path);
This works, but there is only one mistake. The second m that is supposed to stand for minutes should be an i
$params->path = str_replace('.csv','-'.date('y-m-d H-i-s').'.csv',$path);
Please Log in or Create an account to join the conversation.
I have one question, is it possible to include the order_number in the filename? I've tried modifying the str_replace to include the order_number variable to no avail!
Thanks
Lee
Please Log in or Create an account to join the conversation.
We will add this feature in a future version of HikaShop
To have the order number in the file name you need something like:
Please Log in or Create an account to join the conversation.
and is it also possible to get joomla username to the CSV filename?
Thanks in advance.
Denis
Please Log in or Create an account to join the conversation.
In the same way that you can set the order number in the CSV file name ; you can put the username too.
But you have first to catch the Joomla username (which will be code more related to Joomla, even if you can use the function hikashop_loadUser to get the current logged user object).
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.
not sure if I follow you correctly.
I'm using mass action export CSV after order creation, where I have order_number, username, order_product_code, order_product_quantity. So the question is if it's possible to get username from mentioned fields to use it in filename.
Can you please point me closer on some piece of code I can start with?
Thanks in advance.
Denis
Please Log in or Create an account to join the conversation.
To have the username in the csv file name, you have to check the "username" checkbox in the mass action settings, then still in the file "plugins\hikashop\massaction_order\massaction_order.php" and function "onProcessOrderMassActionexportCsv()" just find the username which is present in the PHP object $elements.
It should be there: $elements[0]->username so use this in the filename.
Please Log in or Create an account to join the conversation.
I've tried this piece of code
Successfully got order_id, order_number, but username is missing. I have "username" checkbox checked in the mass action settings and I have username inside CSV file.
Denis
Please Log in or Create an account to join the conversation.