You are here

function uc_catalog_pathauto_bulkupdate in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_catalog/uc_catalog.module \uc_catalog_pathauto_bulkupdate()
  2. 7.3 uc_catalog/uc_catalog.pathauto.inc \uc_catalog_pathauto_bulkupdate()

Generate aliases for all categories without aliases

File

uc_catalog/uc_catalog.module, line 437
Übercart Catalog module.

Code

function uc_catalog_pathauto_bulkupdate() {
  $catalog_vid = variable_get('uc_catalog_vid', 0);
  $query = "SELECT tid, vid, name, src, dst FROM {term_data} LEFT JOIN {url_alias} ON src LIKE CONCAT('catalog/', CAST(tid AS CHAR)) WHERE src IS NULL AND vid = %d";
  $result = db_query_range($query, $catalog_vid, 0, variable_get('pathauto_max_bulk_update', 50));
  $count = 0;
  $placeholders = array();
  while ($category = db_fetch_object($result)) {
    $count = _uc_catalog_pathauto_alias($category, 'bulkupdate') + $count;
  }
  drupal_set_message(format_plural($count, "Bulk generation of terms completed, @count alias generated.", "Bulk generation of terms completed, @count aliases generated."));
}