The OP was looking for code to import not export a product feed and this isn't any help to them either 
Placing this code in the root of your Zen Cart install will generate an XML export of the products.
Tested on v1.3.7.
Code:
<?php
require("includes/application_top.php");
?>
<?php
// We'll be outputting XML
header('Content-type: application/xml');
?>
<?php
/**
* Get the default language for the site
* @return array An array containing the lanugage id and two-letter code.
*/
function get_default_language() {
global $db;
$sql = "select languages_id, code from ".TABLE_LANGUAGES.", ".TABLE_CONFIGURATION." where configuration.configuration_value=languages.code AND configuration.configuration_key='DEFAULT_LANGUAGE'";
$result = $db->Execute($sql);
return array('code' => $result->fields['code'],
'languages_id' => $result->fields['languages_id']);
}
/**
* Fetch back a list of products with their details in the language specified by $language_id.
* @param int $language_id Specify the language that product descriptions should be returned as.
* @return queryFactory A list of products wrapped in a queryFactory.
*/
function get_product_list($language_id) {
global $db;
$sql = "select p.products_id as id, p_d.products_name as name, p_d.products_description as description, p_d.products_url as url, p.products_image as image, p.products_quantity as stock, m.manufacturers_name as manufacturers_name, p.products_price as price from ".TABLE_PRODUCTS." as p inner join ".TABLE_PRODUCTS_DESCRIPTION." as p_d on p.products_id=p_d.products_id left outer join ".TABLE_MANUFACTURERS." as m on p.manufacturers_id=m.manufacturers_id where p_d.language_id=".$language_id;
$result = $db->Execute($sql);
return $result;
}
/**
* Fetch back a list of products and their categories.
* This a 1-to-many relationship
* @return array An array keyed by the product and listing the categories it's in.
*/
function get_product_categories() {
global $db;
$sql = "select products_id as p_id, categories_id as cat_id from ".TABLE_PRODUCTS_TO_CATEGORIES." order by products_id";
$result = $db->Execute($sql);
//Loop and store result as a hash with the product_id the key
$product_categories = array();
while(!$result->EOF) {
$key = $result->fields['p_id'];
if (array_key_exists($key, $product_categories)) {
array_push($product_categories[$key], $result->fields['cat_id']);
} else {
$product_categories[$key] = array($result->fields['cat_id']);
}
$result->MoveNext();
}
return $product_categories;
}
/**
* Get the list of categories for the specified language.
* @param int $language_id The language of the category name and description.
* @return array An array keyed by category id and storing its name and description.
*/
function get_categories($language_id) {
global $db;
$sql = "select categories_id, categories_name as name, categories_description as description from ".TABLE_CATEGORIES_DESCRIPTION." where language_id=".$language_id;
$result = $db->Execute($sql);
//convert this to hash with the category id as the key
$categories = array();
if ($result->RecordCount() > 0) {
while(!$result->EOF) {
$categories[$result->fields['categories_id']] = array("name" => $result->fields['name'],
"description" => $result->fields['description']);
$result->MoveNext();
}
}
return $categories;
}
/**
* Fetch back all the attributes used to make up a product feed..
* @param int $language_id The language used within the feed.
* @return array The product, product description and categories.
*/
function get_products($language_id) {
$products = get_product_list($language_id);
$categories = get_categories($language_id);
$product_categories = get_product_categories();
return array($products, $product_categories, $categories);
}
/**
* On which server are we running?
* @global const $request_type
* @return const HTTP_SERVER or HTTPS_SERVER.
*/
function get_server() {
global $request_type; //SSL or NONSSL ?
$server = HTTP_SERVER;
if ($request_type == 'SSL') {
if (ENABLE_SSL == 'true') {
$server = HTTPS_SERVER ;
}
}
return $server;
}
?>
<?php
$server_protocol = get_server(); //SSL or NONSSL ?
$lang = get_default_language();
$result = get_products($lang['languages_id']);
$products = $result[0];
$product_categories = $result[1];
$categories = $result[2];
//Ready to start flushing output buffers?
while (ob_get_level()) {
ob_end_flush();
}
if (ob_get_length() === false) {
ob_start();
}
//Write the response
echo "<?xml version=\"1.0\"?>"."\n";
echo "<products>"."\n";
//flush
ob_flush();
flush();
if ($products->RecordCount() >0) {
while(!$products->EOF) {
echo "<product id=\"".$products->fields['id']."\">"."\n";
echo "<name lang=\"".$lang['code']."\"><![CDATA[".$products->fields['name']."]]></name>"."\n";
echo "<description lang=\"".$lang['code']."\"><![CDATA[".$products->fields['description']."]]></description>"."\n";
echo "<url lang=\"".$lang['code']."\">".zen_href_link("product_info", "products_id=".$products->fields['id']."&language=".$lang['code'], $request_type, false)."</url>"."\n";
//Product image is optional
if (zen_not_null($products->fields['image'])) {
echo "<image>".$server_protocol."/".DIR_WS_IMAGES.$products->fields['image']."</image>"."\n";
}
//echo the categories that the product belongs to
if (array_key_exists($products->fields['id'], $product_categories)) {
foreach($product_categories[$products->fields['id']] as $cat_id) {
echo "<category lang=\"".$lang['code']."\"><![CDATA[".$categories[$cat_id]['name']."]]></category>"."\n";
}
}
//Product manufacturer is optional
if (zen_not_null($products->fields['manufacturers_name'])) {
echo "<manufacturer><![CDATA[".$products->fields['manufacturers_name']."]]></manufacturer>"."\n";
}
echo "<price>".$products->fields['price']."</price>"."\n";
echo "<stock>".$products->fields['stock']."</stock>"."\n";
echo "</product>"."\n";
$products->MoveNext();
//flush
ob_flush();
flush();
}
}
echo "</products>"."\n";
?>
<?php
require(DIR_WS_INCLUDES."application_bottom.php");
?>
I haven't done any number formatting on the price element, so you may want to look at satpromo's code for that.
Does anyone have an example 3rd party product feed?