Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Article Manager v1.0 + Menu CSS


Guest

Recommended Posts

Error

Warning: Invalid argument supplied for foreach() in C:\wamp\www\catalog\includes\boxes\articles_css.php on line 244

 

Please HELP

 

<?
   // cssMenu - Begin of configuration //
   $cssMenuConfig1 = array();
   $cssMenuConfig1['ShowEmptyCategories'] = true;
   $cssMenuConfig1['includeProducts']     = false;     // Should CSSMenu show products
   $cssMenuConfig1['maxProductsInMenu']   = 8;          // Maximum number of products to show in a menu ( stops massive menus being created )
   $cssMenuConfig1['moreText']            = "More...."; // Maximum number of products to show in a menu ( stops massive menus being created )
   $cssMenuConfig1['showSubMenu']         = true; // Show category dependent menu
//    $cssMenuConfig['idSubMenu']           = array('619', '620'); // Category id for the dependent menu

   // cssMenu - End of configuration //

   $topics_subs = array();
   $topics_start = array();

   $topics_subs_query = tep_db_query("select count(*) as count, parent_id from " . TABLE_TOPICS . " GROUP BY parent_id");
   while($row = tep_db_fetch_array($topics_subs_query)) {
       $topics_subs[$row['parent_id']] = $row['count'];
   }


   $topics_query = tep_db_query("select t.topics_id, td.topics_name, t.parent_id from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.parent_id = '0' and t.topics_id = td.topics_id and td.language_id = '" . (int)$languages_id . "' order by sort_order, td.topics_name");
   while($row = tep_db_fetch_array($topics_query)) {
       $topics_start['T_' . $row['topics_id'] . '_' . $row['parent_id'] . '_F'] = $row;
   }

?>
<style type="text/css">

/*Credits: Dynamic Drive CSS Library */
/*URL: [url="http://www.dynamicdrive.com/style/"]http://www.dynamicdrive.com/style/[/url] */

.suckerdiv ul{
margin: 0;
padding: 0;
list-style-type: none;
width: 146px; /* Width of Menu Items */
border-bottom: 1px solid #2D3D4C;
font-family: arial;
font-size: 12px;
}

.suckerdiv ul li{
position: relative;

}

/*1st level sub menu style */
.suckerdiv ul li ul{
left: 146px; /* Parent menu width - 1*/
position: absolute;
width: 145px; /*sub menu width*/
top: 0;
display: none;
}

/*All subsequent sub menu levels offset */
.suckerdiv ul li ul li ul{
left: 145px; /* Parent menu width - 1*/
}

/*All subsequent sub menu levels offset */
.suckerdiv ul li ul li a{
left: 145px; /* Parent menu width - 1*/
background-color: #FFFFFF;
}

/*All subsequent sub menu levels offset */
.suckerdiv ul li ul li ul li a{
background-color: #FFFFFF;
}

/*All subsequent sub menu levels offset */
.suckerdiv ul li ul li ul li ul li a{
background-color: #FFFFFF;
}

/* menu links style */
.suckerdiv ul li a{
display: block;
color: #000000;
text-decoration: none;
background-color: #FFFFFF;
padding: 1px 5px;
border: 1px solid #2D3D4C;
border-right: 0;
border-bottom: 0;
line-height: 1.75em;
}

.suckerdiv ul li a:hover{
background-color: #D6D6D6;
color: black;
text-decoration: none;
}

.suckerdiv ul li ul li a:hover{
background-color: #D6D6D6;
color: black;
text-decoration: none;
}

.suckerdiv ul li ul li ul li a:hover{
background-color: #D6D6D6;
color: black;
text-decoration: none;
}

/* The main categories with sub-categories */
.suckerdiv .subfolderstyle{
background: url(images/arrow-list.gif) no-repeat center right;
}

/* This one colors the sub-folder with other sub-folders */
.suckerdiv ul li ul .subfolderstyle {
background-color: #D6D6D6;
}

/* This one colors the sub-folder with other sub-folders */
.suckerdiv ul li ul li ul .subfolderstyle {
background-color: #D6D6D6;
}

/* This one colors the sub-folder with other sub-folders */
.suckerdiv ul li ul li ul li ul .subfolderstyle {
background-color: #D6D6D6;
}

/* Holly Hack for IE \*/
* html .suckerdiv ul li { float: left; height: 1%; }
* html .suckerdiv ul li a { height: 1%; }
/* End */

</style>

<script type="text/javascript">

//SuckerTree Vertical Menu (Aug 4th, 06)
//By Dynamic Drive: [url="http://www.dynamicdrive.com/style/"]http://www.dynamicdrive.com/style/[/url]

var menuids=["suckertree1"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus(){
for (var i=0; i<menuids.length; i++){
 var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
   for (var t=0; t<ultags.length; t++){
   ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
   ultags[t].parentNode.onmouseover=function(){
   this.getElementsByTagName("ul")[0].style.display="block"
   }
   ultags[t].parentNode.onmouseout=function(){
   this.getElementsByTagName("ul")[0].style.display="none"
   }
   }
 }
}

if (window.addEventListener)
window.addEventListener("load", buildsubmenus, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus)

</script>
<?


 function PrintArticles( $topics_id, $topics_string , $includeul, $languageID)
 {
      global $cssMenuConfig1;



      $article_path="article_info.php?cPath=".$article_id."&article_id=";
      $topics_query = tep_db_query("select t.topics_id, td.topics_name, t.parent_id from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.parent_id = '0' and t.topics_id = td.topics_id and td.language_id = '" . (int)$languages_id . "' order by sort_order, td.topics_name");
      //$articles_query = tep_db_query("select pc.articles_id, pc.categories_id from articles_to_categories pc, articles p where pc.categories_id = " . $category_id . " and p.articles_id = pc.articles_id and articles_status=1 order by articles_price");

      $articlesDisplay=mysql_num_rows( $articles_query );
      $addMore= false;

      if ( $includeul  && $articlesDisplay > 0 ) {
        $returnval .= "<ul>";

      }

      if ( $articlesDisplay > $cssMenuConfig1['maxarticlesInMenu'] ) {
       $articlesDisplay=$cssMenuConfig1['maxarticlesInMenu'];
       $addMore= true;
      }

      $count_string = '';

       if (SHOW_COUNTS == 'true') {
         if ($totalitemsincategory > 0) {
           $count_string = ' (' . $totalitemsincategory . ')';
         }
       }

      $i=0;
      while ($i < $articlesDisplay) {
        $articles = tep_db_fetch_array($articles_query);
        $article_query = tep_db_query("select articles_name from articles_description where articles_id = " . $articles['articles_id'] . " AND language_id = ".$languageID );
        $article = tep_db_fetch_array($article_query);
        $returnval .= "<li><a href='".$article_path.$articles['articles_id']."'>".$article['articles_name']."</a></li>\n";
        $i++;
      }

       if ( $addMore ) {
        $returnval .= "<li><a href='".$topics_string."'>".$cssMenuConfig1['moreText']."</a></li>\n";
       }

       if ( $articlesDisplay > 0 || !$includeul ) {
       $returnval .= "</ul>";
       }

       return $returnval;
 }

 function PrintSubTopics( $parentID, $languageID, $start_path ){

     global $cssMenuConfig1, $topics_subs, $topics_start;

     $returnval = '';
     if (($start_path == '') && ($parentID > 0)) {
       $start_path = $parentID;
     } else {
       if ($parentID > 0) $start_path .= "_" . $parentID;
     }
     if ($parentID != 0) {
       $returnval .= "<ul>";
     } else {
       $returnval .= "<div class='suckerdiv'>";
       $returnval .= "<ul id='suckertree1'>";
     }
//      $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 = '".$parentID."' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languageID ."' order by sort_order, cd.categories_name");
     $top_subs = array();
     foreach($topics_start as $key => $value) {
       if(strstr($key, '_' . $parentID . '_F')) {
           $top_subs[$parentID][] = substr($key, 2, strpos($key, "_", 2) - 2);
       }
     }

//      if (!isset($_GET['cPath'])) {

       foreach ($top_subs[$parentID] as $v)  { //$categories = tep_db_fetch_array($categories_query)
         $topics = $topics_start['T_' . $v . '_' . $parentID . '_F'];

         if ($start_path == "") {
           $grouppath = $topics['topics_id'];
         } else {
           $grouppath = $start_path . "_" . $topics['topics_id'];
         }
         $tPath_new = 'tPath=' . $grouppath;
         $topics_string = tep_href_link(FILENAME_ARTICLES, $tPath_new);
         $totalitemsintopic = tep_count_articles_in_topic($topics['topics_id']);

         $count_string = '';

         if ((SHOW_COUNTS == 'false') && ($totalitemsintopic > 0) ){
             $count_string = ' (' . $totalitemsintopic . ')';
         }

         if (cssMenu_ShowTopics($cssMenuConfig1['ShowEmptyTopics'], $totalitemsintopic)) {
             $returnval .= "<li><a href='".$topics_string."'>".$topics['topics_name'].$count_string."</a>\n";
         }

         if (array_key_exists($topics['topics_id'], $topics_subs)) { //tep_has_category_subcategories($categories['categories_id'])
            $returnval .= PrintSubTopics( $topics['topics_id'], $languageID, $start_path );
            if ( $cssMenuConfig1['includearticles'] ) {
               $returnval .= PrintArticles($topics['topics_id'],$topics_string, false, $languageID);
            }
         } else {
            if ( $cssMenuConfig1['includearticles'] ) {
               $returnval .= PrintArticles($topics['topics_id'],$topics_string, true, $languageID);
            }
         }
         if (cssMenu_ShowTopics($cssMenuConfig1['ShowEmptyTopics'], $totalitemsintopics)) {
            $returnval .= "</li>";
         }
       }
//      }
     if ( !$cssMenuConfig1['includearticles'] ) {
       $returnval .= "</ul>";
     }
     if ($parentID == 0) $returnval .= "</div>";
     return $returnval;
 }

 function cssMenu_ShowTopics( $switch, $articles) {
     if ( $switch == 1 ) {
        return true;
     } else {
       if ($articles > 0) {
          return true;
       } else {
          return false;
       }
     }
 }
?>

<!-- topics //-->
<tr>
<td>

<?php


 $info_box_contents = array();
 $info_box_contents[] = array('text' => PrintSubTopics( 0, $languages_id, '' ));

 new infoBox2($info_box_contents);

?>
</td>
</tr>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...