You are here:  » Restrict import

Support Forum



Restrict import

Submitted by philstone on Mon, 2007-03-05 17:19 in

Hi Dave

Is there anyway that import can be prevented if the file has nothing in it? One of my merchants over the weekend had a problem with the feed, this meant that for the weekend there were 0 products on my site, if there was something to stop feeds being imported when they are below like 40kb or when there are no records in the feed. is this possible or am i in dreamworld?

Regards

Phil

Submitted by support on Mon, 2007-03-05 17:25

Hi Phil,

How are you automating the process?

If you have written a PHP script to do your automation then you could quite easily use PHP's filesize() function to test the size of the download before importing, for example:

<?php
  fetch
("http://www.example.com/feed.xml","merchant1.xml");
  if (
filesize("merchant1.xml") > 40000)
  {
    
exec("php ../scripts/import.php merchant1.xml");
  }
?>

If you're not sure how to do this in your situation post a snippet of your automation script and i'll take a look for you. It would also be possible to do this in the script itself, but it is best handled in your automation script if possible...

Cheers,
David.