function getProductCategoriesHTML($focus, $name, $value, $view) { global $app_list_strings; global $mod_strings; global $current_user; if ('EditView' != $view && 'DetailView' != $view) { return ""; // skip the rest of the method if another view calls this method } if (empty($focus->id)) { $focus->id = ""; // set id to empty string to enable search (getAllCategories) } $json = getJSONobj(); $languageStringsJson = $json->encode($mod_strings); $smarty = new Sugar_Smarty(); //tinyMCE languege file detection $langDefault = 'en'; $lang = substr($GLOBALS['current_language'], 0, 2); if (file_exists('include/oqc/tinymce/langs/' . $lang . '.js')) { $langDefault = $lang; } //directionality detection $directionality = SugarThemeRegistry::current()->directionality; $productCatalog = new oqc_ProductCatalog(); $productCatalog->retrieve($focus->id); $categoryArray = empty($focus->id) ? array() : $productCatalog->getAllCategories(); $categoryJSONData = getCategoryJSONData($categoryArray, $view, $focus); //$GLOBALS['log']->error("product catalog: ". var_export($categoryJSONData,true)); $smarty->assign("MOD", $mod_strings); $smarty->assign("categoryJSONData", $json->encode($categoryJSONData)); $smarty->assign('lang', $langDefault); $smarty->assign("languageStrings", $languageStringsJson); $smarty->assign('directionality', $directionality); return $smarty->fetch('include/oqc/ProductCatalog/' . $view . '.html'); }