function vam_show_category_content($counter)
{
    global $foo, $categories_string, $id;
    for ($a = 0; $a < $foo[$counter]['level']; $a++) {
        $categories_string .= "&nbsp;&nbsp;";
    }
    $categories_string .= '<a href="';
    if ($foo[$counter]['parent'] == 0) {
        $cPath_new = 'cPath=' . $counter;
    } else {
        $cPath_new = 'cPath=' . $foo[$counter]['path'];
    }
    $categories_string .= vam_href_link(FILENAME_DEFAULT, $cPath_new);
    $categories_string .= '">';
    if ($id && in_array($counter, $id)) {
        $categories_string .= '<b>';
    }
    // display category name
    $categories_string .= $foo[$counter]['name'];
    if ($id && in_array($counter, $id)) {
        $categories_string .= '</b>';
    }
    if (vam_has_category_subcategories($counter)) {
        $categories_string .= '-&gt;';
    }
    $categories_string .= '</a>';
    //if (SHOW_COUNTS == 'true') {
    //  $products_in_category = vam_count_products_in_category($counter);
    //  if ($products_in_category > 0) {
    //    $categories_string .= '&nbsp;(' . $products_in_category . ')';
    //  }
    //}
    $categories_string .= '<br />';
    if ($foo[$counter]['next_id']) {
        vam_show_category_content($foo[$counter]['next_id']);
    }
}
Esempio n. 2
0
function vam_rss_category_tree($id_parent = 0, $cPath = '', $limit = null)
{
    global $db, $rss;
    if ($limit != null && $limit < 0) {
        return;
    }
    if ($limit != null) {
        $limit--;
    }
    $groups_cat_query = vam_db_query("select c.categories_id, c.parent_id, c.date_added, c.last_modified, c.categories_image, cd.categories_name, cd.categories_description\n\t\t\t\t\t\t\t\t\t\t\t from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd\n\t\t\t\t\t\t\t\t\t\t\t where c.parent_id = '" . (int) $id_parent . "'\n\t\t\t\t\t\t\t\t\t\t\t and c.categories_id = cd.categories_id\n\t\t\t\t\t\t\t\t\t\t\t and cd.language_id='" . (int) $_SESSION['languages_id'] . "'\n\t\t\t\t\t\t\t\t\t\t\t and c.categories_status= '1'\n\t\t\t\t\t\t\t\t\t\t\t order by c.sort_order, cd.categories_name");
    if (vam_db_num_rows($groups_cat_query) == 0) {
        return;
    }
    while ($groups_cat = vam_db_fetch_array($groups_cat_query)) {
        $link_categories = addslashes(vam_href_link(FILENAME_DEFAULT, vam_category_link($groups_cat['categories_id'], $groups_cat['categories_name']) . (isset($_GET['ref']) ? '&ref=' . $_GET['ref'] : null), 'NONSSL', false));
        $products_in_category = vam_count_products_in_category($groups_cat['categories_id']);
        if (CATEGORIES_COUNT_ZERO == '1' && $products_in_category == 0 or $products_in_category >= 1) {
            $rss->rss_feed_item($groups_cat['categories_name'], $link_categories, $link_categories, date('r', strtotime(max($groups_cat['date_added'], $groups_cat['last_modified']))), $groups_cat['categories_description'], $groups_cat['categories_image'], false, STORE_OWNER_EMAIL_ADDRESS . " (" . STORE_OWNER . ")");
        }
        if (vam_has_category_subcategories($groups_cat['categories_id'])) {
            vam_rss_category_tree($groups_cat['categories_id'], vam_not_null($cPath) ? $cPath . '_' . $groups_cat['categories_id'] : $groups_cat['categories_id'], $limit);
            // следующая группа
        }
        //		$groups_cat->MoveNext();
    }
}
 // Link a specification group to a product category
 $specification_group_id = (int) $_POST['specification_group_id'];
 $categories_id = (int) $_POST['link_category_id'];
 $link_subcats = $_POST['link_subcats'] == 'True' ? 'True' : 'False';
 if ($specification_group_id != 0) {
     $links_query_raw = "select specification_group_id\n                              from " . TABLE_SPECIFICATIONS_TO_CATEGORIES . "\n                              where specification_group_id = '" . $specification_group_id . "' \n                                and categories_id = '" . $categories_id . "'\n                            ";
     //print $links_query_raw . "<br />\n";
     $links_query = vam_db_query($links_query_raw);
     if (vam_db_num_rows($links_query) < 1) {
         $sql_data_array = array('specification_group_id' => $specification_group_id, 'categories_id' => $categories_id);
         vam_db_perform(TABLE_SPECIFICATIONS_TO_CATEGORIES, $sql_data_array);
     }
     // if (vam_db_num_rows
 }
 // Link all subcategories if selected
 if ($link_subcats == 'True' && vam_has_category_subcategories($categories_id)) {
     $categories_array = array();
     vam_get_subcategories($categories_array, $categories_id);
     foreach ($categories_array as $categories_id) {
         $sql_data_array = array();
         $links_query_raw = "select specification_group_id\n                                from " . TABLE_SPECIFICATIONS_TO_CATEGORIES . "\n                                where specification_group_id = '" . $specification_group_id . "' \n                                  and categories_id = '" . $categories_id . "'\n                              ";
         //print $links_query_raw . "<br />\n";
         $links_query = vam_db_query($links_query_raw);
         if (vam_db_num_rows($links_query) < 1) {
             $sql_data_array = array('specification_group_id' => $specification_group_id, 'categories_id' => $categories_id);
             vam_db_perform(TABLE_SPECIFICATIONS_TO_CATEGORIES, $sql_data_array);
         }
         // if (vam_db_num_rows
     }
     // foreach ($categories_array
 }