function fetchProductCategory( $categoryID ) { return array( 'result' => eZProductCategory::fetch( $categoryID ) ); }
function title($contentObjectAttribute, $name = null) { $categoryID = $contentObjectAttribute->attribute("data_int"); $category = $categoryID > 0 ? eZProductCategory::fetch($categoryID) : false; return is_object($category) ? $category->attribute('name') : ''; }
// Remove checked categories. // Will check for categories' dependencies. // If there are none just removes the categories. // Otherwise shows confirmation dialog with the dependencies displayed. if ($module->isCurrentAction('Remove')) { $errors = applyChanges($module, $http); if (!$module->hasActionParameter('CategoryIDList')) { $catIDList = array(); } else { $catIDList = $module->actionParameter('CategoryIDList'); } if ($catIDList) { // Find dependencies for the categories being removed. $deps = array(); foreach ($catIDList as $catID) { $category = eZProductCategory::fetch($catID); if (!is_object($category)) { continue; } $catName = $category->attribute('name'); $dependantRulesCount = eZVatRule::fetchCountByCategory($catID); $dependantProductsCount = eZProductCategory::fetchProductCountByCategory($catID); $deps[$catID] = array('name' => $catName, 'affected_rules_count' => $dependantRulesCount, 'affected_products_count' => $dependantProductsCount); } // Skip the confirmation dialog if the categories // being removed have no conflicts. $haveDeps = false; foreach ($deps as $dep) { if ($dep['affected_rules_count'] > 0 || $dep['affected_products_count'] > 0) { $haveDeps = true; }