function _uc_importer_export_categories in Ubercart 5
Export categories as XML.
1 call to _uc_importer_export_categories()
- uc_importer_export in uc_importer/
uc_importer.module - Constructs the XML representation of the store from the ids given.
File
- uc_importer/
uc_importer.module, line 466 - XML product importer and exporter.
Code
function _uc_importer_export_categories($categories) {
$xml .= '<categories>';
foreach ($categories as $tid) {
$xml .= '<category>';
$term = taxonomy_get_term($tid);
$parents = taxonomy_get_parents($tid);
$xml .= '<id>' . $term->tid . '</id>';
$xml .= '<vid>' . $term->vid . '</vid>';
$xml .= '<name>' . htmlspecialchars($term->name, ENT_QUOTES, "UTF-8") . '</name>';
$xml .= '<description>' . htmlspecialchars($term->description, ENT_QUOTES, "UTF-8") . '</description>';
foreach ($parents as $parent) {
$xml .= '<parent>' . $parent->tid . '</parent>';
}
$xml .= uc_importer_invoke('export', 'category', $tid);
$xml .= '</category>';
}
$xml .= '</categories>';
return $xml;
}