Zen Cart Logo
Forums / All Other Contributions/Addons / Automatic upload of Easy Populate data?

Automatic upload of Easy Populate data?

Views: 12,225

Results 1 to 20 of 43
4 Jan 2008, 11:44 PM
#1
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Automatic upload of Easy Populate data?

As one tends to get a bit of tunnel vision after 3 years of Zen Carting, I have no idea whether this sort of thing is even possible....

Receive excel file
convert excel file to fit EasyPopulate excel layout
ftp EP file to website
insert into ZC database

...***all without human intervention.

***Is this doable?

5 Jan 2008, 12:57 AM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Automatic upload of Easy Populate data?

I don't believe so. I believe that the requirement for automation would most likely be failed at every step and that the odds of finding a way to get past them all (without writing custom code) are inconsequential.

5 Jan 2008, 5:28 AM
#3
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

You would probably need to install the "Magic Wand" module but it is not yet available to the Public -- since it hasn't been created. :smartalec:

5 Jan 2008, 9:58 AM
#4
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Automatic upload of Easy Populate data?

Nice one Rob! :laugh:

Thanks kuroi - you confirm my thoughts.

22 Apr 2008, 7:41 PM
#5
martbost avatar

martbost

New Zenner

Join Date:
Mar 2008
Posts:
7
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

I am currently running an automated process with EZPopulate and OSCommerce. It is based on a Perl Script and a CRON job.

It should be no different on Zen Cart as the majority of it is externalized.

To summarize how this works:

I have a Perl Script obtain the updated CSV file (NO EXCEL) from my supplier. It then takes the resulting CSV file and converts to TAB's and then performs an HTTP call to the EZPopulate php file emulating the import process.

I have been running it for about 3 years now with no issues.

I will be more than happy to share it if someone is interested.

24 Apr 2008, 4:41 PM
#6
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Automatic upload of Easy Populate data?

Nice solution. I recant my earlier comments. in principle I see no reason why this wouldn't work equally well for Zen Cart. I'd certainly be interested in seeing the script. Have you considered bundling it up as a contribution.

24 Apr 2008, 7:48 PM
#7
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Automatic upload of Easy Populate data?

I would be very interested - please contact me either via PM or email at your earliest convenience.

28 Apr 2008, 8:51 AM
#8
pgeven avatar

pgeven

New Zenner

Join Date:
Apr 2008
Posts:
5
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

I am also very interested.

Custumors don't like it the way as it is now.
creating .CSV file in their application
going to the zen-cart admin
uploading .CSV file
execute .CSV file

and that everytime when they update their data.

Ideal situation.
Cronjob that execute the .CSV file automaticly
custumors can then adjust the cronjob to wat they want.
2 times a day, every day, once a week etc, etc.

28 Apr 2008, 1:42 PM
#9
martbost avatar

martbost

New Zenner

Join Date:
Mar 2008
Posts:
7
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

I have attached my Perl Script to this post. It has been renamed with a .txt extension, but please ensure that you rename it with a .pl extension before attempting to run it.

Right now, the script that is attached is meant to handle only quantity updates on my website. I have sanitized the script to obfuscate usernames, passwords, directories and domain names, but you will note the comments for instructions on what to change.

There are currently three columns being handled in the script. The first two are v_products_model (required) and v_products_quantity. The last one is to append the EOREOR record terminator for EasyPopulate at the end of each line.

Additional columns can be manipulated in the Perl Script by modifying it to account for them. Remember that all files must have the Model Number and EOREOR record terminator in order for EasyPopulate to process them.

Once you have it functional, just call the Perl script in a CRON job however often you need to.

I also perform custom versions of the script for a fee if others are interested. Please PM me for customizations.
:cool:

28 Apr 2008, 3:46 PM
#10
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Automatic upload of Easy Populate data?

Many thanks for this.

I can follow the logic, but not being familiar with Perl, I have a question - in this piece of code```
print OUTPUTFILE "v_products_model[B]t[/B]v_products_quantity[B]t[/B]EOREOR\n";
@dataArray = split('\r\n', $res->content);
$length = @dataArray;
for($i=1; $i<$length-1; $i++){
$temp = $dataArray[$i];
$temp =~ s/"//g;
@record = split(',', $temp);
print OUTPUTFILE "$record[0][B]t[/B]$record[2][B]t[/B]EOREOR\n";


Does the **t** precede all other columns?
28 Apr 2008, 3:51 PM
#11
martbost avatar

martbost

New Zenner

Join Date:
Mar 2008
Posts:
7
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

The \t that is located between the column names represents the TAB spacing between them as the file is TAB-delimited.

The \n represents the Newline marker. When you see the \r\n is represents CR/LF.

Hopefully this will help.

27 May 2008, 8:55 AM
#12
pgeven avatar

pgeven

New Zenner

Join Date:
Apr 2008
Posts:
5
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

does anyone get it working for zen-cart?

24 Apr 2009, 4:07 PM
#13
zacherynuk avatar

zacherynuk

New Zenner

Join Date:
Apr 2009
Posts:
5
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

Hi,

I have engineered a way to automatically (and securely) envoke Easypopulate using a CRON job for the purpose of updating prices and stock info daily from a distribution source.

Although I can't guarantee my help in doing so would be free, if anybody would like more information, then please PM me and / or add to this ( now old ) thread.

Cheers,

Z

20 May 2009, 2:09 AM
#14
tusharpopat avatar

tusharpopat

New Zenner

Join Date:
Apr 2009
Posts:
2
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

I have tried to submit files to easypopulate.php from Bash script using WGET and from perl using LWP, but somehow I'm not getting there. Everytime I try to reach easypopulate with the wget command, I landup on the login.php page.

The commands I tried were

wget --cookies=on --keep-session-cookies --save-cookies=cookie.txt --http-user=HTACCESSUSER --http-passwd=HTACCESSPASS --post-data="email_address=ADMINEMAIL&password=ADMINPASS" --no-check-certificate https://www.yoursite.com/admin/login.php?action=process

wget --referer=https://www.yoursite.com/admin/login.php?action=process --cookies=on --load-cookies=cookie.txt --keep-session-cookies --save-cookies=cookie.txt --http-user=HTACCESSUSER --http-passwd=HTACCESSPASS --post-data="localfile=EP_Joined.txt&buttoninsert=Insert%20into%20db" --no-check-certificate https://www.yoursite.com/admin/easypopulate.php

any help to resolve this will be greatly appreciated.

Thanks

21 Oct 2009, 4:51 PM
#15
jchoi307 avatar

jchoi307

New Zenner

Join Date:
Sep 2009
Posts:
2
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

anyone get it to work for zen cart?

26 Oct 2009, 4:24 AM
#16
tusharpopat avatar

tusharpopat

New Zenner

Join Date:
Apr 2009
Posts:
2
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

I need to automate easypopulate to import on a regular basis using cron jobs. I tried several ways based on the feedback on this forum, but I have not been able to make it to work.

Any help in this regard will be highly appreciated.

If you know anyone who can automate this for a fee, I'd be glad to get it done.

Thanks

13 Dec 2009, 4:15 PM
#17
donothing avatar

donothing

New Zenner

Join Date:
Nov 2009
Posts:
11
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

Ryk:

As one tends to get a bit of tunnel vision after 3 years of Zen Carting, I have no idea whether this sort of thing is even possible....

Receive excel file
convert excel file to fit EasyPopulate excel layout
ftp EP file to website
insert into ZC database

...***all without human intervention.

***Is this doable?

I have a partial solution which I've not tested.

You can save an excel spreadsheet in CSV format and use, the Easy Populate CSV add on, available here:
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=1240

Ftp the file to /tempEP (the default import directory).
Let's say the file is called import_me.csv

You might be able to automate the above with a batch script.

Then create a script to be called by cron every five minutes say.
The script must first authenticate itself.
see:
http://www.zen-cart.com/forum/showthread.php?t=114279

The script then sets the filename variable to import and runs the easypopulate code.

To authenticate we need to override init_admin_auth.php.
So copy

admin/includes/init_includes/init_admin_auth.php

to
admin/includes/init_includes/overrides/init_admin_auth.php

and add
"""
// to allow cron jobs set CRON_ADMIN_USER_ID
if ($_SERVER['REMOTE_ADDR'] == $_SERVER['SERVER_ADDR']) {
if (!isset($_SESSION['admin_id']) && defined('CRON_ADMIN_USER_ID') && CRON_ADMIN_USER_ID != '') {
$_SESSION['admin_id'] = CRON_ADMIN_USER_ID;
}
}

"""
to just after
"""

if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}

"""

Then we write the script for cron.
Create a file /admin/cron1.php:

<?php
define('CRON_ADMIN_USER_ID', '999'); require ('includes/application_top.php'); $_POST['localfile'] = "import_me.csv"; require ('easypopulate.php');
?>

Then set up the cron job to call the script eg:

/usr/bin/lynx -accept_all_cookies -dump http://localhost/PathTo/admin/cron1.php

Please note I haven't thoroughly tested this.

1 Jan 2010, 12:59 PM
#18
dropbop avatar

dropbop

Zen Follower

Join Date:
Apr 2008
Location:
Athlone, Ireland
Posts:
177
Plugin Contributions:
1

Re: Automatic upload of Easy Populate data?

Hi donothing,

just wondering how you got on with your automation.

I am very interested in haveing something like this work on one of my sites. I have gone over the other suggestions but yours seems to be the best solution to my need so far.

If cant get it working, I am willing to chip in with others to pay someone to create something. lol Lazy way out! hehe

Happy New Year!

5 May 2010, 2:06 PM
#19
hayesb2 avatar

hayesb2

New Zenner

Join Date:
Aug 2007
Posts:
1
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

I am looking for a solution to this, it seems many of us are willing to pay for this to work...anybody???

29 May 2010, 4:13 PM
#20
fireclouddesign avatar

fireclouddesign

New Zenner

Join Date:
May 2010
Location:
Graham, NC
Posts:
2
Plugin Contributions:
0

Re: Automatic upload of Easy Populate data?

Thank you to DoNothing! I've been looking for a way to import products into ZenCart through a CRON job without having to write something myself!

Using DoNothing's instructions, and the EasyPopulate module (free version), I just imported 12,000 products into my ZenCart from the command line without issue.

Now I can move forward with automating the command through cron.

Thanks again! :clap: