Search a tpy XML file on the same server as C5 installation

Permalink
Hi,

I have a site that's been built in C5 all lovely jubbly.

The customer sells products via a retail outlet, so whilst the site will not sell like a full e-commerce site, it will be displaying their product stock with images.

The product listing is supplied by a third party by way of a regular 15-20 minute XML file, which is upload into a specific folder that's not in any of the C5 folders. Images are also uploaded by the third party and again are uploaded into the same folder as the XML (albeit a sub folder called 'Images').

/public_html/library/xml/ToWeb/file.xml
/public_html/library/xml/ToWeb/images/file.jpg

Obviously the client would like C5's own search function to be able to search for these products, but I'm not sure how (if at all) this is possible?

I will be using PHP to parse the XML and display the content using a PHP block in a specific page or page type.

Any help would be extremely helpful.

Thanks in advance.

zapbrannigan1972
 
chemmett replied on at Permalink Reply
chemmett
I would create a C5 Job that reads in the XML and creates/updates C5 pages for the products. You can create pages and content blocks programatically, which will then get indexed by the C5 search.

We did something sort of similar and it works quite well. Schedule your cron job that runs the C5 Jobs to run every 15-20 minutes, shortly after the third party has uploaded the file.

Your job can also delete/unpublish product pages no longer in the XML data if you like.

You can either use a database table or custom page attributes to link a C5 page to a product ID or other metadata. I've done it both ways. If you use C5 attributes, it makes it easier to (for example) add a listing block that shows all the widgets colored "blue". Use the PageList object and filterByAttribute() functions.

Hope that helps. Good luck!