function getCategoryPath($catid, $begin = false) { static $array = array(); if (intval($catid) == 0) { return false; } if ($begin) { $array = array(); } $user =& JFactory::getUser(); $aid = (int) $user->get('aid'); $catid = (int) $catid; $db =& JFactory::getDBO(); $query = "SELECT * FROM #__k2_categories WHERE id={$catid} AND published=1 AND trash=0 AND access<={$aid}"; $db->setQuery($query); $rows = $db->loadObjectList(); if ($db->getErrorNum()) { echo $db->stderr(); return false; } foreach ($rows as $row) { array_push($array, $row->name); getCategoryPath($row->parent, false); } return array_reverse($array); }
function getCategoryPath($catid, $begin = false) { static $array = array(); if (intval($catid) == 0) { return false; } if ($begin) { $array = array(); } $user = JFactory::getUser(); $aid = (int) $user->get('aid'); $catid = (int) $catid; $db = JFactory::getDBO(); $query = "SELECT * FROM #__k2_categories WHERE id={$catid} AND published=1"; if (version_compare(JVERSION, '1.6.0', 'ge')) { $query .= " AND access IN(" . implode(',', $user->getAuthorisedViewLevels()) . ") "; } else { $query .= " AND access<={$aid} "; } $db->setQuery($query); $rows = $db->loadObjectList(); if ($db->getErrorNum()) { echo $db->stderr(); return false; } foreach ($rows as $row) { array_push($array, $row->alias); getCategoryPath($row->parent, false); } return array_reverse($array); }
function getCategoryPath($id) { global $tab; if ($_GET['c']) { return "ROOT"; } $result = mysql_query('S' . $tab . 'W' . $id); $tempOutput = getCategoryPath($result); return $tempOutput; }
function getCategoryPath($catid) { $sqlstring = SELECT_ALL . TABLE_EBAY_CATEGORIES . SQL_WHERE; if ($catid) { $sqlstring .= " id=" . $catid; } else { $sqlstring .= " parentid=0"; } $recordset = olc_db_query($sqlstring); $catstring = EMPTY_STRING; do { $parentid = $row_name['parentid']; $name = htmlentities($row_name['name']); } while ($row_name = olc_db_fetch_array($recordset)); if ($parentid != 0) { $catstring .= getCategoryPath($parentid); } $catstring .= HTML_A_START . CURRENT_SCRIPT . '?catid=' . $catid . '&x=' . $_GET['x'] . '" style="cursor:hand">' . $name . HTML_A_END . HTML_NBSP . '> '; return $catstring; }
/** * Get the category erp5 like path * * @return String, category_path, */ function getCategoryPath($category_id, $parent_id) { //if ($parent_id == '0') //echo getCategoryName($category_id)."/"; $sSql = "SELECT category_parent_id, category_name\n FROM " . constant('_VM_TABLE_PREFIX_') . "_category_xref cat_xref\n LEFT JOIN " . constant('_VM_TABLE_PREFIX_') . "_category cat \n ON cat_xref.category_parent_id = cat.category_id\n WHERE category_child_id={$category_id}\n AND category_parent_id != '0' "; $req = mysql_query($sSql) or die(mysql_error() . " - Req: " . $sSql); if (mysql_num_rows($req) > 0) { $aData = mysql_fetch_assoc($req); return getCategoryPath($aData['category_parent_id'], $aData['category_parent_id']) . "/" . $aData['category_name']; } }
$req_select .= "RIGHT OUTER JOIN " . constant('_VM_TABLE_PREFIX_') . "_order_item item ON item.product_id=prod_categ.product_id "; $req_select .= "WHERE item.order_id='" . $order_id . "' "; if ($order_item_id != "") { $req_select .= "AND item.order_item_id='" . $order_item_id . "' "; } $req_select .= "AND category_name != ''"; //echo $req_select; $req = mysql_query($req_select) or die('\\nInvalid query: ' . $req_select . ' ' . mysql_error()); if (mysql_num_rows($req) > 0) { $xml = '<xml>'; while ($row = mysql_fetch_assoc($req)) { $xml .= '<object>'; foreach ($row as $fieldname => $fieldvalue) { if ($fieldname == 'category') { $categ_id = $row['id']; $category_path = getCategoryPath($categ_id, $parent_id = 0) . "/" . getCategoryName($categ_id); $category_path = constant('_COLLECTION_CIM_ID_') . "" . $category_path; $xml .= '<' . $fieldname . '>' . $category_path . '</' . $fieldname . '>'; } else { $xml .= '<' . $fieldname . '>' . $fieldvalue . '</' . $fieldname . '>'; } } $xml .= '</object>'; } if ($order_item_id != "") { $xml .= getProductAttributeFormattedList($order_item_id); } $xml .= '</xml>'; header('Content-type: text/xml'); echo $xml; } else {
} //if updatedate is not the same date then look for online category version if ($updatetime[0] < date("Y-m-d")) { $res = $cs->GetCategories($req); $onlineversion = $res->getCategoryVersion(); } else { //else don't look - once a day is enough $onlineversion = $localversion; } } } } $a_start_cat = HTML_A_START . CURRENT_SCRIPT . '?catid=#&x=' . $x . '" style="cursor:hand">'; if ($catid) { $main_content .= HTML_B_START . AUCTIONS_TEXT_CATEGORIES_ROOT_PATH . HTML_B_END . HTML_HR . HTML_BR; $path = '<div width="275">' . getCategoryPath($catid) . '</div>'; $categories = getSubCategories($catid); $content = AUCTIONS_TEXT_CATEGORIES_SUB_CAT; } else { //if onlineversion is equal to offlineversion if ($localversion == $onlineversion) { if ($localversion) { $main_content .= HTML_NBSP . sprintf(AUCTIONS_TEXT_CATEGORIES_VERSION_OK, $localversion); insertVersion($onlineversion, date(AUCTIONS_DATE_FORMAT)); } } else { //download new category-tree $main_content .= HTML_NBSP . AUCTIONS_TEXT_CATEGORIES_DOWNLOAD . olc_draw_form("category", basename($PHP_SELF), 'post', EMPTY_STRING, 'onsubmit="check_submit()"') . olc_draw_submit_button('updatecat', AUCTIONS_TEXT_CATEGORIES_CAT_UPDATE) . "\n\t\t</form>\n"; } $path = EMPTY_STRING; $categories = getRootCategories();
$products_values[$rebuild_text] = ZERO_STRING; $products_values[$duration_text] = 7; } else { $productssql = SELECT_ALL . TABLE_AUCTION_PREDEFINITION . SQL_WHERE . $predef_id_text . EQUAL . $id; $myproducts = olc_db_query($productssql); $products_values = olc_db_fetch_array($myproducts); $stored_description = true; $predefined_data = true; $cat1 = $products_values[$cat1_text]; if ($cat1) { $cat1 = getCategoryPath($cat1); $cat1 = revertCategoryPath($cat1); } $cat2 = $products_values[$cat2_text]; if ($cat2) { $cat2 = getCategoryPath($cat2); $cat2 = revertCategoryPath($cat2); } //check for multiple pictures //All file-names are packed into one field $multi_picfile_names = explode('|', $products_values[$pic_url_text]); $n = sizeof($multi_picfile_names); if ($n > 1) { $products_values[$pic_url_text] = $multi_picfile_names[0]; $error_multi_pic = array(); for ($i = 1; $i < $n; $i++) { $multi_picfile_name = $multi_picfile_names[$i]; if (!file_exists($original_dir_local . $multi_picfile_name)) { $error_total = true; $error_multi_pic[] = $i; $have_multi_pic_error = true;