You are here:  » Help a newbie? Categorising CSV datafeed


Help a newbie? Categorising CSV datafeed

Submitted by Kev on Fri, 2005-12-16 14:49 in

Hi,

I am a complete newbie at this php/datafeed manipluation business, so please forgive my questions if they have obvious answers!

I have created a test page that I am using to learn how to maniplate an affiliate datafeed from affiliatefuture. The code I am using is this (well it isn't any more seeing as I had to delete a load of stuff from it because it looked "suspicious"!):

require("MagicParser.php");
function myRecordHandler($product)
{
print $product["FIELD3"]; <---- Product manufacturer
print $product["FIELD2"]; <---- Product name
print $product["FIELD5"]; <----- Product description
print $product["FIELD8"]; <---- Product price
print <a hyperlink>.$product["FIELD6"].<an image>$product["FIELD7"]; <----- Link via an image
}
MagicParser_parse("http://www.xxxxxxxxxxxxxx.com/productsBuyMobilePhones.txt","myRecordHandler","csv|9|0|0");

This is my first proper attempt at learning what MagicParser does, so please forgive the simplicity of the code... What this code does is churn through the whole feed and returns entries for every item on the merchant website.

What I would like to learn to do is how to categorise the parsed file, for example by manufacturer ("FIELD3"), so I can create a page for each manufacturer that returns the relevant records.

The second thing that I would like to learn is how sort records, for example ascending price ("FIELD8").

I would greatly appreciate and hints/tips/links to resources that will help me in my learning quest!

Many thanks in advance and kindset regards,

Kev