I have two questions I was hoping you could help with;
1) I'm using cron to fetch and import multiple feeds (around 80 feeds), I've noticed that a number of my feeds have 0 products.
I have the cron scheduled but I'm assuming the fetch isn't collecting the file successfully every-time; is there a way to retry the fetch if the file is empty or unreturned?
2) The number of products in my site is getting large (~800k); I would like a global filter which does not import products which are less than £2.00, is this done using Drop Record RegExp?
Thanks
Dave
Thats great thanks, I will check out the Price Range Filter.
I'm actually using a fresh install of 14/06A, the only addition to the standard cron file I've added is
chdir(dirname(__FILE__));
set_time_limit(0);
Hi David,
(edit: Updated for 15/09A)
Sure - firstly, make sure that you're using a Min Size Abort setting in any of your Automation Tool job configurations where a good feed is being overwritten - I typically use a value of 1000 which ensures that you've actually got a feed with data rather than say just a header row and no product records!
Then, to set-up a retry mechanism, edit includes/automation.php and look for the following code beginning at line 52:
if ($status == "OK")
{
$tmp = $$directoryVar."tmp";
if (!$automation_handler($job["url"],$tmp))
{
if (file_exists($tmp)) unlink($tmp);
$status = "ERROR - TRANSFER FAILED";
}
}
if ($status == "OK")
{
if ($job["minsize"])
{
if (filesize($tmp) < $job["minsize"])
{
unlink($tmp);
$status = "ERROR - MIN SIZE ABORT";
}
}
}
...and REPLACE with:
if ($status == "OK")
{
$retry = 3;
do {
$retry--;
$status == "OK";
if ($status == "OK")
{
$tmp = $$directoryVar."tmp";
if (!$automation_handler($job["url"],$tmp))
{
if (file_exists($tmp)) unlink($tmp);
$status = "ERROR - TRANSFER FAILED";
}
}
if ($status == "OK")
{
if ($job["minsize"])
{
if (filesize($tmp) < $job["minsize"])
{
unlink($tmp);
$status = "ERROR - MIN SIZE ABORT";
}
}
}
} while( $retry && ($status != "OK"));
}
Simply change the initial value of $retry if required - above code will retry each feed a maximum of 3 times.
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hello Dave,
Re: 1/
I know you've been using the script for several years so probably before the Automation Tool was in place - could you post an example line (I'll remove any URLs before posting) from your cron script that fetches one of your feeds so that I can see the commands being used and I'll check out what options might be available to retry or ignore on error.
Re: 2/
None of the existing filters perform mathematical comparison but check out this thread where you'll find code for a "Price Range" filter which will do exactly what you want!
Cheers,
David.
--
PriceTapestry.com