commission junction feed - product catalog - parser
feed parser script written in php, the package consists of 3 php scripts and one css file to suit your layout. if you are an commission junction affiliate, you might know that some advertisers provide an product catalog. this product catalogs can be exported as text files via ftp or http. this is were the cj feed parser comes into play, it allows you, once you have an local copy of an product catalog, to parse the catalog and then display the content inside your website. following you will see the setup php script.


// welcome to the cj script.


// the package consists of 3 scripts, and one css file.
// the cj_setup.php file which you are reading and should edit to suit your server environment,
// the cj_data.php script which does all the data handling and storage,
// the cj_view.php which is the frontend for your new website.
// the cj_setup.php file should be the only script to be edited.
// all scripts will share this setup file.
// cj.css can be edited to suit your layout.


// this is the main format string for the cj data feeds, if it is changed at www.cj.com you should also edit it here.
$cj_feed_tags = "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";


// there is an possibility to rename the cj_view.php file to any name you like,
// but you will also have to edit following parameter to be the same name.


$frontend_filename = "cj_view.php";


$email_address = "me@email-address.com"; // your email address.
$number_items_per_page = 5; // number of items which will be shown on one page.


// $home_path is the one of two folders which got to be created by you.
// if you have completed the setup, please upload all your files to that folder.
// it is possible that you will have to switch the permissions ( linux ) for this folder to 777 -> chmod 777 your_home_path_folder


$home_path = "/your/homepath/cj-folder"; // absolute path to your folder where the scripts will be stored.
$home_domain = "http://www.yourdomain.com/cj-folder"; // url to the same folder like your $home_path.


// the second folder is the one where you will store your feed/s.
// please create this one under your $home_path folder.


$feeds_folder = "feeds";


// main category names will be drawn from feed names.
// for example if you name your feed " new_books.txt ", the main category name will be " new_books ".
// upload your feed/s to the feeds folder.
// Please set your Product Export at www.cj.com to TAB delimited, this is abolutely necessary.


// following folders will be created by the php script, but can be named here.
// they will be existant under your $home_path/main category.


$tags_folder = "tags";
$items_folder = "items";
$categories_folder = "categories";


// following parameters go into the head section of your website.
$title = "CJ FEED PARSER"; // title for your games site.
$description = ""; // description.
$keywords = ""; // keywords.


// if you got an header image file, please type in the relative or absolute url to the image.
// if not leave the default value "no", and your $title will be displayed as an header.
$header_image = "no";


// you may run the cj_data.php from the command line like this -> php cj_data.php
// optional you can run the script with an silent flag for backgound operation -> php cj_data.php silent &
// or from your browser http://www.yoursite.com/cj_folder/cj_data.php


// when you have built your items library with the cj_data.php script,
// you will be able to access your frontend at http://www.yoursite.com/cj_folder/cj_view.php
// where the folder "cj_folder" should reflect the last folder of your $home_path parameter.


// the script will create keyword text files, where the keywords are taken from item names, inside your Main Category Folders.


// the script is able to export random items, which you may include in other pages as an advertising to your items.
// you can do this by calling the script like this, for example inside another php file, ->
// $exported_items_string = `php /your/home/path/cj_view.php export 4 GamesFunT FunTicket`;
// where 4 is any number of items you wish to export,
// GamesFunT, should reflect an Main Category Name,
// and FunTicket is the Sub Category Name.


// once you got the $exported_item_string, you may format it for output ->
// $exported_items_array = explode("<--id-->", $exported_items_string);
// this will give you an array containing all the requested items.


// from there you may loop the array and process all items ->
// in this example we will have the items formatted in an horizontal table.


// print ">table border=0<>tr valign='top'<\n";
// foreach ( $exported_items_array as $item ) {


// $item_array = explode("<--is-->", $item);


// $item_link = $item_array[0];
// $item_title = $item_array[1];
// $item_picture_url = $item_array[2];
// $item_description = $item_array[3];


// print "$item_link$item_picture_url
$item_link$item_title
$item_description\n";
// }
// print ">/table<\n";


// end parameters setup.

DEMODOWNLOAD