function uc_catalog_orphaned_products in Ubercart 6.2
Same name and namespace in other branches
- 5 uc_catalog/uc_catalog.module \uc_catalog_orphaned_products()
- 7.3 uc_catalog/uc_catalog.admin.inc \uc_catalog_orphaned_products()
Display links to all products that have not been categorized.
1 string reference to 'uc_catalog_orphaned_products'
- uc_catalog_menu in uc_catalog/
uc_catalog.module - Implements hook_menu().
File
- uc_catalog/
uc_catalog.admin.inc, line 231 - Catalog administration menu items.
Code
function uc_catalog_orphaned_products() {
$output = '<p>' . t('Orphaned products are products that you have created but
not yet assigned to a category in your product catalog. All such
products will appear as links below that you can follow to edit
the product listings to assign them to categories.') . '</p>';
$query = "SELECT DISTINCT n.nid, n.title FROM {node} AS n LEFT JOIN {term_node} AS tn ON n.nid = tn.nid LEFT JOIN {vocabulary_node_types} AS vnt ON n.type = vnt.type WHERE n.type <> 'image' AND tn.tid IS NULL AND vnt.vid = %d";
$vid = variable_get('uc_catalog_vid', 0);
$result = db_query($query, $vid);
$rows = array();
while ($node = db_fetch_object($result)) {
$rows[] = l($node->title, 'node/' . $node->nid . '/edit', array(
'query' => array(
'destination' => 'admin/store/products/orphans',
),
));
}
if (count($rows) > 0) {
$output .= theme('item_list', $rows);
}
else {
$output .= '<p>' . t('All products are currently listed in the catalog.') . '</p>';
}
return $output;
}