function tep_get_generated_category_path_ids($id, $from = 'category') { $calculated_category_path_string = ''; $calculated_category_path = tep_generate_category_path($id, $from); for ($i = 0, $n = sizeof($calculated_category_path); $i < $n; $i++) { for ($j = 0, $k = sizeof($calculated_category_path[$i]); $j < $k; $j++) { $calculated_category_path_string .= $calculated_category_path[$i][$j]['id'] . '_'; } $calculated_category_path_string = substr($calculated_category_path_string, 0, -1) . '<br />'; } $calculated_category_path_string = substr($calculated_category_path_string, 0, -6); if (strlen($calculated_category_path_string) < 1) { $calculated_category_path_string = TEXT_TOP; } return $calculated_category_path_string; }
$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'move_category': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_MOVE_CATEGORY . '</b>'); $contents = array('form' => tep_draw_form('categories', FILENAME_CATEGORIES, 'action=move_category_confirm&cPath=' . $cPath) . tep_draw_hidden_field('categories_id', $cInfo->categories_id)); $contents[] = array('text' => sprintf(TEXT_MOVE_CATEGORIES_INTRO, $cInfo->categories_name)); $contents[] = array('text' => '<br>' . sprintf(TEXT_MOVE, $cInfo->categories_name) . '<br>' . tep_draw_pull_down_menu('move_to_category_id', tep_get_category_tree(), $current_category_id)); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_move.gif', IMAGE_MOVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'delete_product': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_PRODUCT . '</b>'); $contents = array('form' => tep_draw_form('products', FILENAME_CATEGORIES, 'action=delete_product_confirm&cPath=' . $cPath) . tep_draw_hidden_field('products_id', $pInfo->products_id)); $contents[] = array('text' => TEXT_DELETE_PRODUCT_INTRO); $contents[] = array('text' => '<br><b>' . $pInfo->products_name . '</b>'); $product_categories_string = ''; $product_categories = tep_generate_category_path($pInfo->products_id, 'product'); for ($i = 0, $n = sizeof($product_categories); $i < $n; $i++) { $category_path = ''; for ($j = 0, $k = sizeof($product_categories[$i]); $j < $k; $j++) { $category_path .= $product_categories[$i][$j]['text'] . ' > '; } $category_path = substr($category_path, 0, -16); $product_categories_string .= tep_draw_checkbox_field('product_categories[]', $product_categories[$i][sizeof($product_categories[$i]) - 1]['id'], true) . ' ' . $category_path . '<br>'; } $product_categories_string = substr($product_categories_string, 0, -4); $contents[] = array('text' => '<br>' . $product_categories_string); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'move_product': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_MOVE_PRODUCT . '</b>'); $contents = array('form' => tep_draw_form('products', FILENAME_CATEGORIES, 'action=move_product_confirm&cPath=' . $cPath) . tep_draw_hidden_field('products_id', $pInfo->products_id));
break; case 'copy_to': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_COPY_TO . '</b>'); $contents = array('form' => tep_draw_form('copy_to', FILENAME_CATEGORIES, 'action=copy_to_confirm&cPath=' . $cPath) . tep_draw_hidden_field('products_id', $pInfo->products_id)); $contents[] = array('text' => TEXT_INFO_COPY_TO_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENT_CATEGORIES . '<br><b>' . tep_output_generated_category_path($pInfo->products_id, 'product') . '</b>'); $contents[] = array('text' => '<br>' . TEXT_CATEGORIES . '<br>' . tep_draw_pull_down_menu('categories_id', tep_get_category_tree(), $current_category_id)); $contents[] = array('text' => '<br>' . TEXT_HOW_TO_COPY . '<br>' . tep_draw_radio_field('copy_as', 'link', true) . ' ' . TEXT_COPY_AS_LINK . '<br>' . tep_draw_radio_field('copy_as', 'duplicate') . ' ' . TEXT_COPY_AS_DUPLICATE); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_copy.gif', IMAGE_COPY) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if ($rows > 0) { if (isset($cInfo) && is_object($cInfo)) { // category info box contents $category_path_string = ''; $category_path = tep_generate_category_path($cInfo->categories_id); for ($i = sizeof($category_path[0]) - 1; $i > 0; $i--) { $category_path_string .= $category_path[0][$i]['id'] . '_'; } $category_path_string = substr($category_path_string, 0, -1); $heading[] = array('text' => '<b>' . $cInfo->categories_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $category_path_string . '&cID=' . $cInfo->categories_id . '&action=edit_category') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $category_path_string . '&cID=' . $cInfo->categories_id . '&action=delete_category') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $category_path_string . '&cID=' . $cInfo->categories_id . '&action=move_category') . '">' . tep_image_button('button_move.gif', IMAGE_MOVE) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added)); if (tep_not_null($cInfo->last_modified)) { $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($cInfo->last_modified)); } $contents[] = array('text' => '<br>' . tep_info_image($cInfo->categories_image, $cInfo->categories_name, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '<br>' . $cInfo->categories_image); $contents[] = array('text' => '<br>' . TEXT_SUBCATEGORIES . ' ' . $cInfo->childs_count . '<br>' . TEXT_PRODUCTS . ' ' . $cInfo->products_count); } elseif (isset($pInfo) && is_object($pInfo)) { // product info box contents $heading[] = array('text' => '<b>' . tep_get_products_name($pInfo->products_id, $languages_id) . '</b>');
function tep_generate_category_path($id, $from = 'category', $categories_array = '', $index = 0) { global $languages_id; if (!is_array($categories_array)) { $categories_array = array(); } if ($from == 'product') { $categories_query = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int) $id . "'"); while ($categories = tep_db_fetch_array($categories_query)) { if ($categories['categories_id'] == '0') { $categories_array[$index][] = array('id' => '0', 'text' => 'Top'); // eigentlich TEXT_TOP statt 'Top' } else { $category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int) $categories['categories_id'] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int) $languages_id . "'"); $category = tep_db_fetch_array($category_query); $categories_array[$index][] = array('id' => $categories['categories_id'], 'text' => $category['categories_name']); if (tep_not_null($category['parent_id']) && $category['parent_id'] != '0') { $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index); } $categories_array[$index] = array_reverse($categories_array[$index]); } $index++; } } elseif ($from == 'category') { $category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int) $id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int) $languages_id . "'"); $category = tep_db_fetch_array($category_query); $categories_array[$index][] = array('id' => $id, 'text' => $category['categories_name']); if (tep_not_null($category['parent_id']) && $category['parent_id'] != '0') { $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index); } } return $categories_array; }
<tbody> <?php if (isset($_GET['search'])) { $search = HTML::sanitize($_GET['search']); $Qcategories = $OSCOM_Db->get(['categories c', 'categories_description cd'], ['c.categories_id', 'cd.categories_name', 'c.categories_image', 'c.parent_id', 'c.sort_order', 'c.date_added', 'c.last_modified'], ['c.categories_id' => 'cd.categories_id', 'cd.language_id' => $OSCOM_Language->getId(), 'cd.categories_name' => ['op' => 'like', 'val' => '%' . $search . '%']], ['c.sort_order', 'cd.categories_name']); } else { $Qcategories = $OSCOM_Db->get(['categories c', 'categories_description cd'], ['c.categories_id', 'cd.categories_name', 'c.categories_image', 'c.parent_id', 'c.sort_order', 'c.date_added', 'c.last_modified'], ['c.parent_id' => (int) $current_category_id, 'c.categories_id' => ['rel' => 'cd.categories_id'], 'cd.language_id' => $OSCOM_Language->getId()], ['c.sort_order', 'cd.categories_name']); } while ($Qcategories->fetch()) { // Get parent_id for subcategories if search if (isset($_GET['search'])) { $cPath = $Qcategories->valueInt('parent_id'); } $category_path_string = ''; $category_path = tep_generate_category_path($Qcategories->valueInt('categories_id')); for ($i = sizeof($category_path[0]) - 1; $i > 0; $i--) { $category_path_string .= $category_path[0][$i]['id'] . '_'; } $category_path_string = substr($category_path_string, 0, -1); ?> <tr> <td><?php echo '<a href="' . OSCOM::link(FILENAME_CATEGORIES, tep_get_path($Qcategories->valueInt('categories_id'))) . '"><i class="fa fa-play"></i> ' . $Qcategories->value('categories_name') . '</a>'; ?> </td> <td></td> <td></td> <td class="text-right"></td> <td class="action"><?php
<td class="menuBoxHeading" width="400"> <span style="font-family: Verdana, Arial, sans-serif; font-size: 10px; color: black;"> <?php print qtpro_doctor_formulate_product_investigation($product_investigation, 'detailed'); ?> </span> </td> <td class="menuBoxHeading"> <?php echo '<br><ul><li><a href="' . tep_href_link(FILENAME_CATEGORIES, 'pID=' . $VARS['product_id'] . '&action=new_product') . '" class="menuBoxContentLink">' . TEXT_EDIT_PRODUCT . '</a></li>'; echo '<li><a href="' . tep_href_link(FILENAME_STATS_LOW_STOCK_ATTRIB, '', 'NONSSL') . '" class="menuBoxContentLink">' . TEXT_GOTO_LOW_STOCK . '</a><br></li>'; //class="menuBoxHeading columnLeft //We shall now generate links back to the product in the admin/categories.php page. //The same product can exist in differend categories. //Generate both the text (in $path_array) and the parameter (in $cpath_string_array) $raw_path_array = tep_generate_category_path($VARS['product_id'], 'product'); $path_array = array(); $cpath_string_array = array(); foreach ($raw_path_array as $raw_path) { $path_in_progress = ''; $cpath_string_in_progress = ''; foreach ($raw_path as $raw_path_piece) { $path_in_progress .= $raw_path_piece['text'] . ' >> '; $cpath_string_in_progress .= $raw_path_piece['id'] . '_'; } $path_array[] = substr($path_in_progress, 0, -4); $cpath_string_array[] = substr($cpath_string_in_progress, 0, -1); } if (sizeof($raw_path_array) > 0) { $curr_pos = 0; foreach ($path_array as $neverusedvariable) {