Zen Cart Logo
Forums / General Questions / Cron Job for Updating QTY

Cron Job for Updating QTY

Locked

Views: 1,311

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
9 Aug 2010, 4:30 AM
#1
ryanb4614 avatar

ryanb4614

Totally Zenned

Join Date:
Feb 2008
Posts:
556
Plugin Contributions:
0

Cron Job for Updating QTY

Hello! My supplier gives my access to a excel file in ftp there they created for me. It has the model number I use and the qty and some more info. They also give me a link to download a tabbed txt file that has the same information. How hard would it be to setup a cron job to update my quantity daily from their info? Where do I even begin? They told me its pretty simple to do, but didnt offer any help :huh:

9 Aug 2010, 4:52 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Cron Job for Updating QTY

How hard would it be to setup a cron job to update my quantity daily from their info
Would not be an automated cron

Get the 3rd party module - -easy populate

Review the wiki article on using it

I recommend that you practice on a second install of your cart versus the live site until you have mastered it

9 Aug 2010, 6:13 AM
#3
ayrscott avatar

ayrscott

New Zenner

Join Date:
Aug 2010
Location:
Fredericksburg, VA
Posts:
3
Plugin Contributions:
0

Re: Cron Job for Updating QTY

This should be fairly straight forward if you want to automate it.

Lookup the man pages for crontab and have it launch a php script. The script can use cURL to download the txt version and then use built in functions to parse the file if you can get a CSV version. Most places use CSV these days as opposed to TSV but if it is TSV a quick google searched turned up a ready to go class to parse it:

http://enarion.net/programming/php/csv-import/

I assume you have a spot in your products table where you are storing their part #? If so simply run an update query against the part # from the file against the part # in your DB (and their vendor # if you have more than one so you don't get product ID collisions).

As a recommendation you may want to ask them what they do with products once they are phased out - I've ran into vendors who entirely remove them from the file and don't bother notifying the end user so you may want to disable any product who's stock wasn't updated. If you go this route you need to do a lot of error/logic checking to make sure you dont' mass disable their products if their feed isn't available, corrupt, fails to parse, etc.