Example #1
0
 /**
  * Shows the Number of Products in category $category_id
  *
  * @param int $category_id
  * @return string The number in brackets
  */
 function products_in_category($category_id)
 {
     if (PSHOP_SHOW_PRODUCTS_IN_CATEGORY == '1' || vmIsAdminMode()) {
         $num = ps_product_category::product_count($category_id);
         if (empty($num) && ps_product_category::has_childs($category_id)) {
             $db = new ps_DB();
             $q = "SELECT category_child_id FROM #__{vm}_category_xref ";
             $q .= "WHERE category_parent_id='{$category_id}' ";
             $db->query($q);
             while ($db->next_record()) {
                 $num += ps_product_category::product_count($db->f("category_child_id"));
             }
         }
         return " ({$num}) ";
     } else {
         return "";
     }
 }
 if (!isset($depth_list[$n])) {
     $depth_list[$n] = 0;
 }
 $catname = shopMakeHtmlSafe($categories[$row_list[$n]]["category_name"]);
 $listObj->newRow();
 // The row number
 $listObj->addCell($pageNav->rowNumber($ibg));
 // The Checkbox
 $listObj->addCell(vmCommonHTML::idBox($ibg, $categories[$row_list[$n]]["category_child_id"], false, "category_id"));
 // Which category depth level we are in?
 $repeat = $depth_list[$n] + 1;
 $tmp_cell = str_repeat("&nbsp;&nbsp;&nbsp;", $repeat) . "&#095&#095;|" . $repeat . "|&nbsp;" . "<a href=\"" . $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_category_form&category_id=" . $categories[$row_list[$n]]["category_child_id"] . "&category_parent_id=" . $categories[$row_list[$n]]["category_parent_id"] . "\">" . $catname . "</a>";
 $listObj->addCell($tmp_cell);
 $desc = strlen($categories[$row_list[$n]]["category_description"]) > 255 ? mm_ToolTip($categories[$row_list[$n]]["category_description"], $VM_LANG->_('PHPSHOP_CATEGORY_FORM_DESCRIPTION')) : $categories[$row_list[$n]]["category_description"];
 $listObj->addCell("&nbsp;&nbsp;" . $desc);
 $listObj->addCell(ps_product_category::product_count($categories[$row_list[$n]]["category_child_id"]) . "&nbsp;<a href=\"" . $_SERVER['PHP_SELF'] . "?page=product.product_list&category_id=" . $categories[$row_list[$n]]["category_child_id"] . "&option=com_virtuemart" . "\">[ " . $VM_LANG->_('PHPSHOP_SHOW') . " ]</a>");
 // Publish / Unpublish
 $tmp_cell = "<a href=\"" . $sess->url($_SERVER['PHP_SELF'] . "?page=product.product_category_list&category_id=" . $categories[$row_list[$n]]["category_child_id"] . "&func=changePublishState");
 if ($categories[$row_list[$n]]["category_publish"] == 'N') {
     $tmp_cell .= "&task=publish\">";
 } else {
     $tmp_cell .= "&task=unpublish\">";
 }
 $tmp_cell .= vmCommonHTML::getYesNoIcon($categories[$row_list[$n]]["category_publish"]);
 $tmp_cell .= "</a>";
 $listObj->addCell($tmp_cell);
 // Order Up and Down Icons
 if ($keyword == '') {
     // This must be a big cheat, because we're working on sorted arrays,
     // not on database information
     // Check for predecessors and brothers and sisters