tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
4
ZUGRIFFE
513
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    wethe wethe ist offline Mitglied Bronze
    Registriert seit
    Jan 2004
    Beiträge
    32
    Richte gerade ein Shop System ein und dort gibt es ein Menü dass ich gerne konfigurieren würde.
    Im Moment schaut es so aus dass die Kategorien angezeigt werden und wenn man dann auf eine drauf drückt klappen sich daraunter die Unterkategorien aus. Vom Stil her wie es ist möchte ich es auch behalten, jedoch nur die kleinigkeit dass die Unterkategorien permanent ausgeklappt angezeigt werden und zwar genaus wie hier:

    http://img514.imageshack.us/img514/8...enannt27yi.jpg

    Habe nach einiger Zeit nun die PHP-Datei gefunden die dies steuert, komme jedoch nicht mit dem Code klar. Habe schon mehrere Leute gefragt die ein mehr Erfahrung mit PHP haben und die konnten mir auch nicht weiter helfen. Liegt vermutlich daran dass der Shop mit Smarty entwickelt wurde.

    Ich habe die Datei mal hier hochgeladen:
    block_categories.php

    Wäre total froh wenn jmd. mir helfen könnte!

    Lieben Gruß
    Jacob
     

  2. #2
    Avatar von Flex
    Flex Flex ist offline (aka Felix Jacobi)
    tutorials.de Moderator
    Registriert seit
    Nov 2001
    Ort
    Wuppertal
    Beiträge
    5.295
    Blog-Einträge
    65
    So bringt uns das leider nichts, weil da nur steht:
    Direct Access to this location is not allowed.
    Einfach den Quelltext aus der Datei in [php] Tags reinkopieren, danke
     

  3. #3
    wethe wethe ist offline Mitglied Bronze
    Registriert seit
    Jan 2004
    Beiträge
    32
    Oops! Vielen Dank für den Hinweis! Aber schonmal schön Resonanz zu haben

    PHP-Code:
     /** ensure this file is being included by a parent file */
      
    defined'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );

      if (!
    defined('HIDE_A_CATEGORY_ON')) {
        
    define('HIDE_A_CATEGORY_ON''false');
      }

     
    /**
      * Return the number of products in a category
      *
      * @param $category_id
      * @param $include_inactive
      * @return string
      */ 
      
    function oosCountProductsInCategory($category_id$include_inactive false) {
        
        
    $products_count 0;

        
    $db =& oosDBGetConn();
        
    $oosDBTable oosDBGetTables();

        if (
    $include_inactive == true) {
          
    $products $db->Execute("SELECT COUNT(*) AS total FROM " $oosDBTable['products'] . " p, " $oosDBTable['products_to_categories'] . " p2c WHERE p.products_id = p2c.products_id AND p2c.categories_id = '" intval($category_id) . "'");
        } else {
          
    $products $db->Execute("SELECT COUNT(*) AS total FROM " $oosDBTable['products'] . " p, " $oosDBTable['products_to_categories'] . " p2c WHERE p.products_id = p2c.products_id AND p.products_status >= '1' AND p2c.categories_id = '" intval($category_id) . "'");
        }
        
    $products_count += $products->fields['total'];

        
    $child_categories_result $db->Execute("SELECT categories_id FROM " $oosDBTable['categories'] . " WHERE parent_id = '" intval($category_id) . "'");
        if (
    $child_categories_result->RecordCount()) {
          while (
    $child_categories $child_categories_result->fields) {
            
    $products_count += oosCountProductsInCategory($child_categories['categories_id'], $include_inactive);
            
    $child_categories_result->MoveNext();
          }
        }

        return 
    $products_count;
      }


     
    /**
      * Return true if the category has subcategories
      *
      * @param $category_id
      * @return boolean
      */
      
    function oosHasCategorySubcategories($category_id) {

        
    $db =& oosDBGetConn();    
        
    $oosDBTable oosDBGetTables();

        
    $child_category $db->Execute("SELECT COUNT(*) AS total FROM " $oosDBTable['categories'] . " WHERE parent_id = '" intval($category_id) . "'");

        if (
    $child_category->fields['total'] > 0) {
          return 
    true;
        } else {
          return 
    false;
        }
      }  

     
    /**
      * Return Show Category
      *
      * @param $counter
      * @return string
      */
      
    function oosShowCategory($counter) {
        global 
    $foo$categories_array$cPath_new$id;

        
    $oosFilename oosGetFilename();
        
    $oosModules oosGetModules();

        
    $category_array = array('counter' => $counter);

        if ( (isset(
    $id)) && (in_array($counter$id)) ) {
          
    $category_array['isSelected'] = 1;
        } else {
          
    $category_array['isSelected'] = 0;
        }

        if (
    oosHasCategorySubcategories($counter)) {
          
    $category_array['isHasSubCategories'] = 1;
        } else {
          
    $category_array['isHasSubCategories'] = 0;
        }

        if (
    SHOW_COUNTS == 'true') {
          
    $products_in_category oosCountProductsInCategory($counter);
          
    $category_array['countProductsInCategory'] = $products_in_category;
        }

        
    $category_array array_merge($category_array$foo[$counter]);
        
    $categories_array[] = $category_array;

        if (
    $foo[$counter]['next_id']) {
          
    oosShowCategory($foo[$counter]['next_id']);
        }
      }
      
      
      
    // Use Categories Scroll List
      // Uses HIDE_A_CATEGORY 
      
    if (CATEGORIES_BOX_SCROLL_LIST_ON == 'true') {
        
    $categories_isscroll 1;
        
    $categories_array = array();
        
    $categories_array['hideSession'] = oosHideSessionId();
        
    $categories_array['pullDownMenu'] = oosDrawPullDownMenu('cPath'oosGetCategories(array(array('id' => '''text' => $lang['pull_down_default']))), $cPath'onchange="this.form.submit();" size="' CATEGORIES_SCROLL_BOX_LEN '"');
      } else {
        
    // Normal Categories Display list
        
    $categories_isscroll 0;
        if (
    HIDE_A_CATEGORY_ON == 'false') {
          
    $sql "SELECT c.categories_id, cd.categories_name, c.parent_id, c.categories_status 
                  FROM " 
    $oosDBTable['categories'] . " c, 
                       " 
    $oosDBTable['categories_description'] . " cd 
                  WHERE c.categories_status = '1' 
                    AND c.parent_id = '0' 
                    AND c.categories_id = cd.categories_id 
                    AND cd.categories_language = '" 
    oosDBInput($language) . "' 
                    AND c.categories_id !='" 
    . (int)HIDE_A_CATEGORY "' 
                  ORDER BY sort_order, cd.categories_name"
    ;
        } else {
          
    $sql "SELECT c.categories_id, cd.categories_name, c.parent_id, c.categories_status 
                  FROM " 
    $oosDBTable['categories'] . " c, 
                       " 
    $oosDBTable['categories_description'] . " cd 
                  WHERE c.categories_status = '1' 
                    AND c.parent_id = '0' 
                    AND c.categories_id = cd.categories_id 
                    AND cd.categories_language = '" 
    oosDBInput($language) . "' 
                  ORDER BY sort_order, cd.categories_name"
    ;
        }
        
    $categories_result $db->Execute($sql);
        while (
    $categories $categories_result->fields) {
          
    $foo[$categories['categories_id']] = array('name' => $categories['categories_name'],
                                                     
    'parent' => $categories['parent_id'],
                                                     
    'level' => 0,
                                                     
    'path' => $categories['categories_id'],
                                                     
    'next_id' => false);

          if (isset(
    $prev_id)) {
            
    $foo[$prev_id]['next_id'] = $categories['categories_id'];
          }

          
    $prev_id $categories['categories_id'];

          if (!isset(
    $first_element)) {
            
    $first_element $categories['categories_id'];
          }
          
    $categories_result->MoveNext();
        }


        if (
    oosNotNull($cPath)) {
          
    $new_path '';
          
    $id split('_'$cPath);
          
    reset($id);
          while (list(
    $key$value) = each($id)) {
            unset(
    $prev_id);
            unset(
    $first_id);
            
    $sql "SELECT c.categories_id, cd.categories_name, c.parent_id, c.categories_status 
                    FROM " 
    $oosDBTable['categories'] . " c, 
                         " 
    $oosDBTable['categories_description'] . " cd 
                    WHERE c.categories_status = '1' 
                      AND c.parent_id = '" 
    intval($value) . "' 
                      AND c.categories_id = cd.categories_id 
                      AND cd.categories_language = '" 
    oosDBInput($language) . "' 
                    ORDER BY sort_order, cd.categories_name"
    ;
            
    $categories_result $db->Execute($sql);
            
    $category_check $categories_result->RecordCount();
            if (
    $category_check 0) {
              
    $new_path .= $value;
              while (
    $row $categories_result->fields) {
                
    $foo[$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(
    $prev_id)) {
                  
    $foo[$prev_id]['next_id'] = $row['categories_id'];
                }

                
    $prev_id $row['categories_id'];

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

                
    $last_id $row['categories_id'];
              
                
    $categories_result->MoveNext();
              }
              
    $foo[$last_id]['next_id'] = $foo[$value]['next_id'];
              
    $foo[$value]['next_id'] = $first_id;
              
    $new_path .= '_';
            } else {
              break;
            }
          }
        }
        
    oosShowCategory($first_element); 

      }

      
    $smarty->assign(array('block_heading_categories' => $block_heading,
                            
    'categories_contents' => $categories_array,
                            
    'categories_isscroll' => $categories_isscroll));
    ?> 
    Geändert von wethe (15.04.06 um 17:09 Uhr)
     

  4. #4
    wethe wethe ist offline Mitglied Bronze
    Registriert seit
    Jan 2004
    Beiträge
    32
    Hat Niemand eine Ahnung?
     

  5. #5
    Avatar von Flex
    Flex Flex ist offline (aka Felix Jacobi)
    tutorials.de Moderator
    Registriert seit
    Nov 2001
    Ort
    Wuppertal
    Beiträge
    5.295
    Blog-Einträge
    65
    Da es bisher so wenig Resonanz gab, würde ich dir raten in diesem Forum zu schauen:
    http://www.phpinsider.com/smarty-forum/
    Bzw. hier (die deutsche Version)
    http://www.phpinsider.com/smarty-for...f9dd13bccac949

    Ich denke, da wirst du mehr Hilfe finden... Wenn du es trotzdem hier weiterversuchst, wäre deine Smarty Version sowie welchen Shop du verwendest sinnvoll zu wissen... Außerdem wären die Templates des Shops interessant.
     

Ähnliche Themen

  1. Zufallsgenerator im Shop-System
    Von Highway im Forum PHP
    Antworten: 2
    Letzter Beitrag: 06.05.08, 13:41
  2. Shop System
    Von GoldenEye im Forum Content Management Systeme (CMS)
    Antworten: 8
    Letzter Beitrag: 27.02.07, 19:44
  3. Datei-Shop-System
    Von bluex im Forum PHP
    Antworten: 2
    Letzter Beitrag: 05.09.06, 03:53
  4. Rechnungsnr. Shop-System
    Von chpa im Forum PHP
    Antworten: 2
    Letzter Beitrag: 05.11.04, 12:00
  5. Online Shop System ?
    Von CvH im Forum PHP
    Antworten: 3
    Letzter Beitrag: 31.05.02, 18:40