Quantcast
Channel: [Plugin: CJ-Datafeed] CJ DATA FEEDS CLICKS | WordPress.org
Viewing all articles
Browse latest Browse all 26

Reply To: [Plugin: CJ-Datafeed] CJ DATA FEEDS CLICKS

$
0
0

Here’s how to remove the problem of the first line in the CJ datafeeds:

In two functions:
function cj_process_datafeed($cj_preview,$cj_time_interval,$cj_time_factor )
AND
function cj_datafeed()

Change this code:
if ( $cj_previewdone == “ok” ) {
break;
}
if(empty($v)) {
unset($cj_data[$k]);
}
else {
// Read file row

to this:
if ( $cj_previewdone == “ok” ) {
break;
}
if(empty($v)) {
unset($cj_data[$k]);
}
else if(!preg_match(“/[0-9]/”, $v)) {continue;}
else {
// Read file row

This line:
else if(!preg_match(“/[0-9]/”, $v)) {continue;}

Makes the code skip processing the first line of the file because it contains no digits. Every other line in the feed file will have at least one digit because there are prices, which contain digits!

Clearly, the first line, which looks like:

PROGRAMNAME|PROGRAMURL|CATALOGNAME|LASTUPDATED|NAME|KEYWORDS|DESCRIPTION|SKU|MANUFACTURER|MANUFACTURERID|UPC|ISBN|CURRENCY|SALEPRICE|PRICE|RETAILPRICE|FROMPRICE|BUYURL|IMPRESSIONURL|IMAGEURL|ADVERTISERCATEGORY|THIRDPARTYID|THIRDPARTYCATEGORY|AUTHOR|ARTIST|TITLE|PUBLISHER|LABEL|FORMAT|SPECIAL|GIFT|PROMOTIONALTEXT|STARTDATE|ENDDATE|OFFLINE|ONLINE|INSTOCK|CONDITION|WARRANTY|STANDARDSHIPPINGCOST

has no digits.

Enjoy!


Viewing all articles
Browse latest Browse all 26

Trending Articles