Menu categorie per OSWAI

Questo forum è dedicato alle discussioni riguardanti le contribution per osCommerce

Moderatore: mod Generali

Rispondi
twist3d
membro Junior
membro Junior
Messaggi: 7
Iscritto il: 01/03/2008, 15:25
Località: Ferrara
Contatta:

Menu categorie per OSWAI

Messaggio da twist3d »

Salve a tutti,
già avevo postato l'argomento sul topic di oswai ma poi pensavo di aver risolto e invece...

Volevo realizzare un menu per le categorie come questo http://bodhi.thirdeyeconsulting.it/lafarm.it/
quello che vedete è quello che son riuscito a fare io ma sinceramente è una cosa fatta un tanto al metro infatti se la guardate con explorer da problemi con il puntatore del mouse e con tutti da problemi con l'hover dei link. In pratica io ho cercato di gestire il menu originale così:

Codice: Seleziona tutto

  $boxHeading = BOX_HEADING_CATEGORIES;
  $corner_left = 'rounded';
  $corner_right = 'square';
  $box_base_name = 'categories'; // for easy unique box template setup (added BTSv1.2)
  $box_id = $box_base_name . 'Box';  // for CSS styling paulm (editted BTSv1.2)

  function tep_show_category($counter) {
    global $tree, $boxContent, $cPath_array;



    $boxContent .= '<div class="boxcategoria"><a href="';
   
    if ($tree[$counter]['parent'] == 0) {
      $cPath_new = 'cPath=' . $counter;
    } else {
      $cPath_new = 'cPath=' . $tree[$counter]['path'];
    }

    $boxContent .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';
	
	 for ($i=0; $i<$tree[$counter]['level']; $i++) {
      $boxContent .= '<div class="boxcategoria3">';
    }
	
    if (isset($cPath_array) && in_array($counter, $cPath_array)) {
      $boxContent .= '<div class="boxcategoria2">';
    }

// display category name

	
    $boxContent .= '     '. $tree[$counter]['name'];
	

    if (isset($cPath_array) && in_array($counter, $cPath_array)) {
      $boxContent .= '</div>';
    }
	  for ($i=0; $i<$tree[$counter]['level']; $i++) {
      $boxContent .= '</div>';
    }
	 
    if (tep_has_category_subcategories($counter)) {
      $boxContent .= '';
    }
    $boxContent .= '</a></div>';

    if (SHOW_COUNTS == 'true') {
      $products_in_category = tep_count_products_in_category($counter);
      if ($products_in_category > 0) {
        $boxContent .= '';
      }
    }

    $boxContent .= '';

    if ($tree[$counter]['next_id'] != false) {
      tep_show_category($tree[$counter]['next_id']);
    }
  }
?>
<!-- categories //-->
<?php


  $boxContent = '<div class="AlignLeft"><center>' ;
  $tree = array();

// #################### Added Enable / Disable Categories ##############
//  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' and c.categories_status = '1' order by sort_order, cd.categories_name");
// #################### End Added Enable / Disable Categories ##############

  while ($categories = tep_db_fetch_array($categories_query))  {
    $tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
                                                'parent' => $categories['parent_id'],
                                                'level' => 0,
                                                'path' => $categories['categories_id'],
                                                'next_id' => false);

    if (isset($parent_id)) {
      $tree[$parent_id]['next_id'] = $categories['categories_id'];
    }

    $parent_id = $categories['categories_id'];

    if (!isset($first_element)) {
      $first_element = $categories['categories_id'];
    }
  }

  //------------------------
  if (tep_not_null($cPath)) {
    $new_path = '';
    reset($cPath_array);
    while (list($key, $value) = each($cPath_array)) {
      unset($parent_id);
      unset($first_id);
// #################### Added Enable / Disable Categories ##############
//      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' and c.categories_status = '1' order by sort_order, cd.categories_name");
// #################### End Added Enable / Disable Categories ##############

      if (tep_db_num_rows($categories_query)) {
        $new_path .= $value;
        while ($row = tep_db_fetch_array($categories_query)) {
          $tree[$row['categories_id']] = array('name' => $row['categories_name'],
                                               'parent' => $row['parent_id'],
                                               'level' => $key+1,
                                               'path' => $new_path . '_' . $row['categories_id'],
                                               'next_id' => false);

          if (isset($parent_id)) {
            $tree[$parent_id]['next_id'] = $row['categories_id'];
          }

          $parent_id = $row['categories_id'];

          if (!isset($first_id)) {
            $first_id = $row['categories_id'];
          }

          $last_id = $row['categories_id'];
        }
        $tree[$last_id]['next_id'] = $tree[$value]['next_id'];
        $tree[$value]['next_id'] = $first_id;
        $new_path .= '_';
      } else {
        break;
      }
    }
  }
  tep_show_category($first_element); 

  $boxContent .= '<br /><a href="' . tep_href_link(FILENAME_CATALOG_LIST, 'pfrom=0' . SEPARATOR_LINK . 'pto=999999999999999999', 'NONSSL') . '" >' . BOX_CATALOG_PRODUCTS_WITH_IMAGES . '</a></center></div>';

include (bts_select('boxes', $box_base_name)); // BTS 1.5
?>
<!-- categories_eof //-->
Come potete notare non me ne intendo tanto di codice e volevo chiedervi se qualcuno riuscirebbe a darmi delle dritte per realizzarne uno decente.
Grazie mille
twist3d
membro Junior
membro Junior
Messaggi: 7
Iscritto il: 01/03/2008, 15:25
Località: Ferrara
Contatta:

Messaggio da twist3d »

Nessuno mi sa aiutare?
twist3d
membro Junior
membro Junior
Messaggi: 7
Iscritto il: 01/03/2008, 15:25
Località: Ferrara
Contatta:

Messaggio da twist3d »

Neanche i tecnici ufficiali oswai riescono a darmi qualche dritta perfavore? è molto importante. :oops:
Rispondi