I read the other articles already for the oodle-external.php file I still can not get it to work for my clients feeds. I am getting "Listing element <listing> not found in feed." from oodle when i test the feed...any suggestions? Here is the code: PHP: <?php require_once('includes/init.php'); /* * Only change this if you are sure your content encoding is not utf-8 */ $oodle_content_encoding = "utf-8"; /* * Only use this require if you want to keep any of the following options * in some other file (other than init.php, which is already included) * as per following comments. Change the path to whatever file you are using. * * require_once(FILESYSTEM_PATH .'includes/my_site_init.php'); */ /* * Custom fields you don't want included on the Oodle feeds. * Use "processed" format (so "Some Field" becomes "some_field") * Example: * $oodle_skip_fields = array( * 'your_birthday', * 'some_unwanted_field', * 'another_unwanted_field' * ); * * NOTE - if you want, you can leave this one alone, and use one called * $init_oodle_skip_fields you define elsewhere (probably in init.php or * somewhere similar) if you are trying to keep all your mod's init code * in one place. */ global $init_oodle_skip_fields; $oodle_skip_fields = array( ); if (is_array($init_oodle_skip_fields)) { $oodle_skip_fields = array_merge($oodle_skip_fields,$init_oodle_skip_fields); } /* * Custom field names you want to substitute on Oodle feeds. For instance you * may need to change "Pet Gender" to "Sex". * Use "processed" format (so "Pet Gender" becomes "pet_gender") * Example: * $oodle_field_subs = array( * 'pet_gender' => 'sex', * 'another_field' => 'some_other_oodle_field' * ); * * NOTE - if you want, you can leave this one alone, and use one called * $init_oodle_field_subs you define elsewhere (probably in init.php or * somewhere similar) if you are trying to keep all your mod's init code * in one place. */ global $init_oodle_field_subs; $oodle_field_subs = array( ); if (is_array($init_oodle_field_subs)) { $oodle_field_subs = array_merge($oodle_field_subs,$init_oodle_field_subs); } /* * Category names you want to change when you feed them to Oodle. * Example: * $oodle_cat_subs = array( * 'Shelter Dogs' => 'Dogs', * 'Shelter Cats' => 'Cats' * ); * * NOTE - if you want, you can leave this one alone, and use one called * $init_oodle_cat_subs you define elsewhere (probably in init.php or * somewhere similar) if you are trying to keep all your mod's init code * in one place. */ global $init_oodle_cat_subs; $oodle_cat_subs = array( ); if (is_array($init_oodle_cat_subs)) { $oodle_cat_subs = array_merge($oodle_cat_subs,$init_oodle_cat_subs); } /* * NO USER SERVICEABLE PARTS BEYOND THIS POINT!! */ // Set up the main product feed query. Joins user, category, custom field // and image data. $sSQL= " SELECT p.id, p.owner, p.title, p.featured, p.section, p.description, p.shortDescription, p.price, p.dateadded, p.expiration, p.pBold, p.pHighlighted, u.state, u.city, u.country, u.username, c.name AS catname, c.id as catid, pf.lfValue as fieldvalue, f.fName as fieldname, i.image as image FROM ".PREFIX."listings AS p LEFT JOIN " . PREFIX . "users AS u ON p.owner = u.id LEFT JOIN " . PREFIX . "categories AS c ON c.id = p.section LEFT JOIN " . PREFIX . "listingsfields AS pf ON pf.lfID = p.id LEFT JOIN " . PREFIX . "fields AS f ON f.fID = pf.lfID LEFT JOIN " . PREFIX . "prodimages AS i ON i.pid = p.id WHERE p.expiration > NOW() AND p.display = 'Y' "; // see if we have any specific category id(s), which can be a single id or a // comma separated list if (isset($_REQUEST['categoryid'])&& $_REQUEST['categoryid']<>"") { // if any catid's are specified, grab the complete tree of id's // for the where clause. $categoryid = $_REQUEST['categoryid']; $arr_childs = explode(',',$categoryid); get_ids($arr_childs); $sSQL .= " AND p.section IN (". implode(', ', $arr_childs) .")"; } // Order by date added $sSQL .= " ORDER BY p.dateadded DESC"; // is there a limit? Default is all items, no limit if(isset($_GET['limit']) && $_GET['limit']<>"") { $sSQL .= " LIMIT ". (int)$_GET['limit']; } // build array of listings $ads = array(); $result = $db->query($sSQL); while ($rs=$result->fetch()) { // because we are using left joins on many-to-one tables (like custom fields and images) // we will have duplicate rows for each id. We only want to grab the basic row // if we don't already have it. if (!$ads[$rs['id']]) { $ads[$rs['id']] = $rs; } // if a custom fieldname and value are specified, add them to an array // for this item if ($rs['fieldname'] and $rs['fieldvalue']) { if (!$ads[$rs['id']]['fields'][$rs['fieldname']]) { $ads[$rs['id']]['fields'][$rs['fieldname']] = $rs['fieldvalue']; } } // if an image is specified, use the first one we see as the image for this item // and just ignore any subsequent images for the item if ($rs['image']) { if (!$ads[$rs['id']]['image']) { $ads[$rs['id']]['image'] = $rs['image']; } } } // set XML type and nocache headers header('Content-Type: text/xml'); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); // print out the page header echo "<?xml version=\"1.0\" encoding=\"$oodle_content_encoding\"?>\r\n"; echo "<listings>\r\n"; // time to build the actual XML list of items if (!empty($ads)) { foreach ($ads AS $listing) { // do any cat name substitutions if ($oodle_cat_subs[$listing['catname']]) { $listing['catname'] = $oodle_cat_subs[$listing['catname']]; } // conacatenate the short and long descriptions if ($listing['shortDescription']) { $listing['description'] = $listing['shortDescription'] . "\n\n" . $listing['description']; } // sanitize text fields $listing['title'] = htmlspecialchars($listing['title']); $listing['catname'] = htmlspecialchars($listing['catname']); $listing['description'] = htmlspecialchars($listing['description']); $listing['image_url'] = $listing['image'] ? URL . "/thumbs/small_" . $listing['image'] : ""; // output the basic information common to all entries echo "\t<listing>\r\n"; echo "\t\t<category>" . $listing['catname'] . "</category>\r\n"; echo "\t\t<id>" . $listing['id'] . "</id>\r\n"; echo "\t\t<title>" . $listing['title'] . "</title>\r\n"; echo "\t\t<description>" . $listing['description'] . "</description>\r\n"; echo "\t\t<price>" . $listing['price'] . "</price>\r\n"; echo "\t\t<currency>USD</currency>\r\n"; echo "\t\t<url>". URL ."/viewlisting.php?view=".$listing['id']."</url>\r\n"; echo "\t\t<image_url>". $listing['image_url'] ."</image_url>\r\n"; // now grab and output any custom fields if (is_array($listing['fields'])) { foreach ($listing['fields'] as $fieldname => $fieldvalue) { $fieldname = htmlspecialchars(preg_replace('# #','_',strtolower($fieldname))); // skip it if it's in the ignore list if (in_array($fieldname,$oodle_skip_fields)) { continue; } // make any custom fieldname substitutions if (in_array($fieldname,$oodle_field_subs)) { $fieldname = $oodle_field_subs[$fieldname]; } $fieldvalue = htmlspecialchars($fieldvalue); echo "\t\t<$fieldname>$fieldvalue</$fieldname>\r\n"; } } echo "\t</listing>\r\n"; } } //close the feed echo "</listings>\r\n"; // Hey, we're done! Cool!! ?>
The oodle product I am aware of is 3rd party so your best bet may be to contact them. Having said that, I wouldnt expect too many people to spend a lot of time working on this based on the info you have provided. The very first question that conmes to mind is the oodle feed compatible with the version of 68C you are using?? You didnt share those details so its anyones guess.
I beleive the oodle code was created around V3 of 68C so not even sure it works with V4 and even if it did you 68C version of 4.0.1 has known vulnerabilities in it and is 2 years old. If your concerned about your client I would encourage them to upgrade to the current 68C version.