Hello,
Is there a filter which allow to fix a limit to the number of imported product for a feed? For example allow only 20 products and skip all the other products of the feed?
Happy New Year David
Is it possible to create a filter that will only import specified groups of products from feeds ie. from product number 20,000 up to number 40,000.
Chris
Hi Chris,
Have a go with this - as above just register a new "Import Range" filter against any field (i.e. Product Name), and then enter the record numbers from and to...
/*************************************************/
/* importRange */
/*************************************************/
$filter_names["importRange"] = "Import Range";
function filter_importRangeConfigure($filter_data)
{
print "From:<br />";
print "<input type='text' size='40' name='from' value='".widget_safe($filter_data["from"])."' />";
widget_errorGet("from");
print "<br />";
print "To:<br />";
print "<input type='text' size='40' name='to' value='".widget_safe($filter_data["to"])."' />";
widget_errorGet("to");
}
function filter_importRangeValidate($filter_data)
{
if (!$filter_data["from"])
{
widget_errorSet("from","required field");
}
if (!$filter_data["to"])
{
widget_errorSet("to","required field");
}
}
function filter_importRangeExec($filter_data,$text)
{
global $filter_importRangeCount;
global $filter_dropRecordFlag;
$filter_importRangeCount++;
$filter_dropRecordFlag =
(
($filter_importRangeCount < $filter_data["from"])
||
($filter_importRangeCount > $filter_data["to"])
);
return $text;
}
Cheers,
David.
Hi,
This should do the trick; add the code below to includes/filter.php, and then add a new Import Limit filter to any field (Product Name will do) for that feed, and enter the maximum number of records you wish to import in the text box on the configuration page...
/*************************************************/
/* importLimit */
/*************************************************/
$filter_names["importLimit"] = "Import Limit";
function filter_importLimitConfigure($filter_data)
{
print "Max Products:<br />";
print "<input type='text' size='40' name='text' value='".widget_safe($filter_data["text"])."' />";
widget_errorGet("text");
}
function filter_importLimitValidate($filter_data)
{
if (!$filter_data["text"])
{
widget_errorSet("text","required field");
}
}
function filter_importLimitExec($filter_data,$text)
{
global $admin_importLimit;
$admin_importLimit = intval($filter_data["text"]);
return $text;
}
Cheers,
David.