Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Create a bow for dynamenu


goldoi

Recommended Posts

Posted

Hello everyone,

I try to display dynamenu in a new box named bm_flyout.php. I have put in my header and it's work perfectly! But when i manage to put

<?php include(DIR_WS_BOXES . "dm_categories.php"); ?>

in my box, it doesn't display ... Do you have an idea why it doesn't work ? Thanx for your help!

 

My bm_flyout.php code:

 

<?php
/*
 $Id$

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 class bm_flyout {
   var $code = 'bm_flyout';
   var $group = 'boxes';
   var $title;
   var $description;
   var $sort_order;
   var $enabled = false;

   function bm_flyout() {
     $this->title = MODULE_BOXES_FLYOUT_TITLE;
     $this->description = MODULE_BOXES_FLYOUT_DESCRIPTION;

     if ( defined('MODULE_BOXES_FLYOUT_STATUS') ) {
       $this->sort_order = MODULE_BOXES_FLYOUT_SORT_ORDER;
       $this->enabled = (MODULE_BOXES_FLYOUT_STATUS == 'True');

       $this->group = ((MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
     }
   }

function execute() {
     global $oscTemplate;

     $data = '<div class="ui-widget infoBoxContainer">' .
             '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_FLYOUT_BOX_TITLE . '</div>';
             '  <div class="ui-widget-content infoBoxContents" style="text-align: center;">' .
             '  <br><?php include(DIR_WS_BOXES . "dm_categories.php"); ?>' .
             '  </div>' .
             '</div>';

     $oscTemplate->addBlock($data, $this->group);
   }

   function isEnabled() {
     return $this->enabled;
   }

   function check() {
     return defined('MODULE_BOXES_FLYOUT_STATUS');
   }

   function install() {
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Dynamenu Vertical Fly out Box', 'MODULE_BOXES_FLYOUT_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT', 'Left Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_FLYOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
   }

   function remove() {
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }

   function keys() {
     return array('MODULE_BOXES_FLYOUT_STATUS', 'MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT', 'MODULE_BOXES_FLYOUT_SORT_ORDER');
   }
 }
?>

 

And also, i have write something for the variables in includes/languages/english!

Posted

$data = '<div class="ui-widget infoBoxContainer">' .
		  '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_FLYOUT_BOX_TITLE . '</div>';
		  '  <div class="ui-widget-content infoBoxContents" style="text-align: center;">' .
		  '  <br><?php include(DIR_WS_BOXES . "dm_categories.php"); ?>' .
		  '  </div>' .
		  '</div>';

 

I would say you need to add the box code into the $data and not 'include' a box in a box.

 

I have not used this contribution on 2.3.1 only on 2.2

 

Mark

Posted

The Dynamenu code is a mess. You will need to rewrite parts of it to get it to work in a 2.3 series box. For starters, all of the code that is echoed directly in Dynamenu will need to be added to the string that is fed to the $data variable.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Posted

Hello, thanx for your help!

I have start to edit the dyanemnu code into my new box:

 

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License
*/
 class bm_flyout {
var $code = 'bm_flyout';
var $group = 'boxes';
var $title;
var $description;
var $sort_order;
var $enabled = false;
function bm_flyout() {
  $this->title = MODULE_BOXES_FLYOUT_TITLE;
  $this->description = MODULE_BOXES_FLYOUT_DESCRIPTION;
  if ( defined('MODULE_BOXES_FLYOUT_STATUS') ) {
	$this->sort_order = MODULE_BOXES_FLYOUT_SORT_ORDER;
	$this->enabled = (MODULE_BOXES_FLYOUT_STATUS == 'True');
	$this->group = ((MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
  }
}

function execute() {
  global $oscTemplate;

// add code of dyanamenu -----------------------------------------------------------------------------------------
<?php
/*
  $Id: dm_categories.php,v 1.00 2006/05/07 01:13:58 nate_02631 Exp $
  Ties the store category menu into the PHP Layers Menu library, allowing display
 of categories as DTHML drop-down or fly-out menus, collapsable tree-style menus
 or horizontal/vertical indented plain menus.
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
  Copyright (c) 2006 Nate Welch http://www.natewelch.com
  Released under the GNU General Public License
*/
// BEGIN Configuration Options
  // Set the value below corresponding to the type of menu you want to render
 // 0 = Horizontal Drop-down; 1 = Vertical Flyout; 2 = Tree Menu;
 // 3 = Plain Horizontal Menu; 4 = Plain Vertical Menu
 // Include the appropriate stylesheet in your store stylesheet, and if rendering
 // types '0' or '1', you must also echo (output) the "menu footer" variable
 // in your store footer as described in the readme (or submenus won't work)
 $menu_type = 1;

  // Set to false to display the menu output only. Set to true to display in
 // a regular box. The former is useful for better integrating the menu with your layout.
 $show_dmcats_as_box = false;  

  // Set to 'true' to assign TITLE tags to each of the menu's items, 'false' to leave blank
 $menu_use_titles = true;

  // Name of the icon file to be used preceding menu items. Leave blank for no icons.
 // NOTE: Does not apply to plain style menus. Icon should be in the /images directory
 $menu_icon_file = '';

 // Width and height of icons used in menus (does not apply to plain menus).
 $menu_icon_width = 16;
 $menu_icon_height = 16;

  // Set the graphic to be used for the forward arrow and down arrow images used in
 // drop-down and fly-out menus. Images must reside in your catalog's /images directory
 $menu_fwdarrowimg  = 'forward-arrow.png';
  $menu_downarrowimg = 'down-arrow.png';

 // Indicates whether or not to render your entire category list or just the root categories
 // and the currently selected submenu tree. Rendering the full list is useful for dynamic menu
 // generation where you want the user to have instant access to all categories. The other option
 // is the default oSC behaviour, when the subcats aren't available until the parent is clicked,
 // more suitable for plain-style menus
 $show_full_tree = true;

 // For tree menus, set to true to have only nodes corresponding to the current category path
 // expanded. If set to false, the tree menu will retain expanded/collapse nodes the user has
 // selected (as well as expanding any for categories they've entered)
 $menu_tree_current_path = true;  

  // Set the three numerical values below to adjust the offset of submenus in
  // horizontal drop-down and vertical fly-out menus. Values adjust the following (in order)
  // Top Offset: # of pixels from top border of previous menu the submenu appears
  // Right Offset: # of pixels from right border of previous menu the submenu appears
  // Left Offset: # of pixels from left border of previous menu the submenu appears
  // if the submenu pops to left (i.e. if window border is reached).  Negative values are allowed.
  $menu_layer_offset = array (0,4,4);

 // Show icons on tree menus? If set to false, only expand/collapse icons and connecting lines are shown
 $GLOBALS['dm_tree_folder_icons'] = true;
 // This is the HTML that you would like to appear before/after your categories menu if *not*
 // displaying in a standard "box". This is useful for reconciling tables or clearing
 // floats, depending on your layout needs. For example if not including in a box in the
 // default osC template, you would need opening/closing <tr><td> tags...
 $before_nobox_html = '';
  $after_nobox_html = '';

 // Use this option if you have a *lot* of subcategories in a DHTML style menu and your
 // submenus won't fit on the page.  Set $divide_subcats to the max # of subcategories you want
 // to display.  The menu will show a "more..." link and display the remaining subcategories
 // under that selection. Leave at "0" to not divide your subcategories.
 $divide_subcats = 0;

 // The text you want to display to indicate more subcategories are available
 // This can be set a string or to a language constant you define.
 $divide_subcats_text = 'more...';
// END Configuration Options

// Misc setting to make folder icon clickable to expand tree menu nodes
$GLOBALS['dm_tree_titleclick'] = true;
// Initialize HTML and info_box class if displaying inside a box
if ($show_dmcats_as_box) {
 echo '<tr><td>';
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);
 new infoBoxHeading($info_box_contents, true, false);	
}
// Generate the menu data output (uses configuration options above)
$categories_string = tep_make_cat_dmlist();
// Include required libraries based on menu type
require_once 'includes/functions/dynamenu/lib/PHPLIB.php';
require_once 'includes/functions/dynamenu/lib/layersmenu-common.inc.php';
if ($menu_type < 2) { // Setup for DHTML style menus
 ?>
  <script language="JavaScript" type="text/javascript">
   <!--
	<?php require_once 'includes/functions/dynamenu/libjs/layersmenu-browser_detection.js'; ?>
   // -->
  </script>
  <script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layersmenu-library.js"></script>
  <script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layersmenu.js"></script>
 <?php

 require_once 'includes/functions/dynamenu/lib/layersmenu.inc.php';
 $mid = new LayersMenu($menu_layer_offset[0],$menu_layer_offset[1],$menu_layer_offset[2],1);
} elseif ($menu_type > 2) { // Setup for plain style menus
 require_once 'includes/functions/dynamenu/lib/plainmenu.inc.php';
 $mid = new PlainMenu();
} else {  // Setup for tree style menus

  ?>
  <script language="JavaScript" type="text/javascript">
   <!--
	<?php require_once 'includes/functions/dynamenu/libjs/layersmenu-browser_detection.js'; ?>

		<?php

		   if ($menu_tree_current_path) {
		   echo "\n".'var menu_tree_current_path = true';	  
		  } else {
		   echo "\n".'var menu_tree_current_path = false';		  
		  }

		?>
  // -->
  </script>
  <script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layerstreemenu-cookies.js"></script>
 <?php
  require_once 'includes/functions/dynamenu/lib/treemenu.inc.php';
  $mid = new TreeMenu();
}
// Set menu config variables
$mid->setDirroot('./');
$mid->setLibjsdir('./includes/functions/dynamenu/libjs/');
if ($menu_type !=2) {
 $mid->setTpldir('./includes/functions/dynamenu/templates/');
}

$mid->setImgdir('./images/');
$mid->setImgwww('images/');
$mid->setIcondir('./images/');
$mid->setIconwww('images/');
$mid->setIconsize($menu_icon_width, $menu_icon_height);
// Generate menus
$mid->setMenuStructureString($categories_string);
$mid->parseStructureForMenu('catmenu');
switch ($menu_type) {
 case 0: // Horizontal drop-down
  $mid->setDownArrowImg($menu_downarrowimg);
  $mid->setForwardArrowImg($menu_fwdarrowimg);
  $mid->setHorizontalMenuTpl('layersmenu-horizontal_menu.ihtml');	
  $mid->setSubMenuTpl('layersmenu-horiz_sub_menu.ihtml');	  
	 $mid->newHorizontalMenu('catmenu');
	$mid->printHeader();
  $categories_menu = $mid->getMenu('catmenu');
	$GLOBALS['dmfooter'] = $mid->getFooter();	  
  break;
 case 1:  // Vertical fly-out
  $mid->setDownArrowImg($menu_downarrowimg);
  $mid->setForwardArrowImg($menu_fwdarrowimg);
  $mid->setVerticalMenuTpl('layersmenu-vertical_menu.ihtml');  
  $mid->setSubMenuTpl('layersmenu-vert_sub_menu.ihtml');	  
	$mid->newVerticalMenu('catmenu');
	$mid->printHeader();
  $categories_menu = $mid->getMenu('catmenu');
	$GLOBALS['dmfooter'] = $mid->getFooter();		  
  break;
 case 2:  // Tree menu
   $categories_menu = $mid->newTreeMenu('catmenu');
  break;
 case 3:  // Horizontal plain menu
  $mid->setPlainMenuTpl('layersmenu-horizontal_plain_menu.ihtml');
  $categories_menu = $mid->newHorizontalPlainMenu('catmenu');	  
  break;
 case 4:  // Vertical plain menu
  $mid->setPlainMenuTpl('layersmenu-plain_menu.ihtml');
  $categories_menu = $mid->newPlainMenu('catmenu');	
  break;  
}

// Output list inside a box if specified, otherwise just output unordered list
if ($show_dmcats_as_box) {
 $info_box_contents = array();
 $info_box_contents[] = array('text' => $categories_menu);
 new infoBox($info_box_contents);
  echo '</td></tr>';
} else {
  echo $before_nobox_html;
 echo $categories_menu;
  echo $after_nobox_html;
}
// Create the root category list
function tep_make_cat_dmlist($rootcatid = 0, $maxlevel = 0){
 global $cPath_array, $show_full_tree, $languages_id;

 global $idname_for_menu, $cPath_array, $show_full_tree, $languages_id;
 // Modify category query if not fetching all categories (limit to root cats and selected subcat tree)
  if (!$show_full_tree) {
  $parent_query = 'AND (c.parent_id = "0"';

	if (isset($cPath_array)) {

	 $cPath_array_temp = $cPath_array;

	 foreach($cPath_array_temp AS $key => $value) {
	   $parent_query .= ' OR c.parent_id = "'.$value.'"';
	  }

	  unset($cPath_array_temp);
	}

  $parent_query .= ')';  
  } else {
  $parent_query = '';
  }
  $result = tep_db_query('select c.categories_id, cd.categories_name, c.parent_id from ' . TABLE_CATEGORIES . ' c, ' . TABLE_CATEGORIES_DESCRIPTION . ' cd where c.categories_id = cd.categories_id and cd.language_id="' . (int)$languages_id .'" '.$parent_query.'order by sort_order, cd.categories_name');

  while ($row = tep_db_fetch_array($result)) {  
  $table[$row['parent_id']][$row['categories_id']] = $row['categories_name'];
 }
 $output .= tep_make_cat_dmbranch($rootcatid, $table, 0, $maxlevel);
 return $output;
}
// Create the branches off the category list
function tep_make_cat_dmbranch($parcat, $table, $level, $maxlevel) {
 global $cPath_array, $menu_use_titles, $menu_icon_file, $divide_subcats, $divide_subcats_text;

  $lvl_adjust = 1;

 $list = $table[$parcat];

 // Build data for menu
  while(list($key,$val) = each($list)){

	if (isset($cPath_array) && in_array($key, $cPath_array)) {
   $this_expanded = '1';
   $this_selected = 'dmselected';	
  } else {
   $this_expanded = '';
   $this_selected = '';		
   }
  if (!$level) {
	 unset($GLOBALS['cPath_set']);
	  $GLOBALS['cPath_set'][0] = $key;
   $cPath_new = 'cPath=' . $key;
  } else {
	  $GLOBALS['cPath_set'][$level] = $key;
   $cPath_new = 'cPath=' . implode("_", array_slice($GLOBALS['cPath_set'], 0, ($level+1)));

	  $this_subcat_count++;
  }

	if ($menu_use_titles) {
	 $this_title = $val;
	} else {
	 $this_title = '';  
	}  
  if (SHOW_COUNTS == 'true') {
   $products_in_category = tep_count_products_in_category($key);
   if ($products_in_category > 0) {
	$val .= ' (' . $products_in_category . ')';
   }
  }

	// Output for file to be parsed by PHP Layers Menu
	// Each line (terminated by a newline "\n" is a pipe delimited string with the following fields:
	// [dots]|[text]|[link]|[title]|[icon]|[target]|[expanded]
	// dots - number of dots signifies the level of the link '.' root level items, '..' first submenu, etc....
	// text - text for link; title - tooltip for link; icon - icon for link; target - "dmselected" CSS class if item is selected
	// expanded - signifies if the node is expanded or collapsed by default (applies only to tree style menus)

	// Add "more" submenu if dividing subcategories
	if ($this_subcat_count > $divide_subcats && $divide_subcats) {
   $output .= str_repeat(".", $level+$lvl_adjust).'|'.$divide_subcats_text.'||'.$this_title.'|'.$menu_icon_file.'|'.$this_selected.'|'.$this_expanded."\n";	  
	 $this_subcat_count = 1;
	  $lvl_adjust ++;
	}

  $output .= str_repeat(".", $level+$lvl_adjust).'|'.$val.'|'.tep_href_link(FILENAME_DEFAULT, $cPath_new).'|'.$this_title.'|'.$menu_icon_file.'|'.$this_selected.'|'.$this_expanded."\n";	  


  if ((isset($table[$key])) AND (($maxlevel > $level + 1) OR ($maxlevel == '0'))) {
   $output .= tep_make_cat_dmbranch($key,$table,$level + $lvl_adjust,$maxlevel);
  }

  } // End while loop
 return $output;
}
?>
// end of dynamenu code ------------------------------------------------------------------------------------------	
	  $data = '<div class="ui-widget infoBoxContainer">' .
			  '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_FLYOUT_TITLE . '</div>' .
			  '  <div class="ui-widget-content infoBoxContents" style="text-align: center;">' .
  ' <br><?php include(DIR_WS_MODULES . "dm_categories.php"); ?></br>' .
  '</div>' .
			  '</div>';
  $oscTemplate->addBlock($data, $this->group);
}
function isEnabled() {
  return $this->enabled;
}
function check() {
  return defined('MODULE_BOXES_FLYOUT_STATUS');
}
function install() {
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Dynamenu Vertical Fly out Box', 'MODULE_BOXES_FLYOUT_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT', 'Left Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_FLYOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
}
function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
  return array('MODULE_BOXES_FLYOUT_STATUS', 'MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT', 'MODULE_BOXES_FLYOUT_SORT_ORDER');
}
 }
?>

 

Before editing completely all the code, which part of this use display the menu ?

I have clear all php tag and functions about $menu_use_titles for the moment, i continue to update it!

All your ideas are welcome!

Posted

I have shorten the comment and all disable the functions we don't use. Only one error to correct:

 

Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /homepages/46/d289027439/htdocs/wsb5375180001/shop/includes/modules/boxes/bm_flyout.php on line 294 with $data

 

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License
*/
 class bm_flyout {
   var $code = 'bm_flyout';
   var $group = 'boxes';
   var $title;
   var $description;
   var $sort_order;
   var $enabled = false;
   function bm_flyout() {
  $this->title = MODULE_BOXES_FLYOUT_TITLE;
  $this->description = MODULE_BOXES_FLYOUT_DESCRIPTION;
  if ( defined('MODULE_BOXES_FLYOUT_STATUS') ) {
    $this->sort_order = MODULE_BOXES_FLYOUT_SORT_ORDER;
    $this->enabled = (MODULE_BOXES_FLYOUT_STATUS == 'True');
    $this->group = ((MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
  }
   }

function execute() {
  global $oscTemplate;

// add code of dynamenu -----------------------------------------------------------------------------------------
    //Dynamenu box for osc 2.3.1
 $menu_type = 1; // 0 = Horizontal Drop-down; 1 = Vertical Flyout; 2 = Tree Menu 3 = Plain Horizontal Menu; 4 = Plain Vertical Menu
 $show_dmcats_as_box = false; // display in a box = true   
 $menu_use_titles = true; //set to true to assign title tags to each menu items
 $menu_icon_file = ''; //icon preceding menu items in /images directory (not for plain)
 $menu_icon_width = 16; // Width of icons used in menus (does not apply to plain menus).
 $menu_icon_height = 16; // Height of icons used in menus (does not apply to plain menus).
 $menu_fwdarrowimg  = 'forward-arrow.png'; //forward and down arrow for drop down and fly out menu (catalog/images)
    $menu_downarrowimg = 'down-arrow.png'; 
 $show_full_tree = true; // show only first categories = true else false for all
 $menu_tree_current_path = true; //for tree menu, only display category path select by user  
    // Top Offset: # of pixels from top border of previous menu the submenu appears
    // Right Offset: # of pixels from right border of previous menu the submenu appears
    // Left Offset: # of pixels from left border of previous menu the submenu appears
    $menu_layer_offset = array (0,4,4); //top offset
 $GLOBALS['dm_tree_folder_icons'] = true; // Show icons on tree menus=true
 $before_nobox_html = '<tr><td>'; //html before and after menu, use <tr><td> if not in a box
    $after_nobox_html = '';
 $divide_subcats = 0; //if too many subcategories, display "more"
 $divide_subcats_text = 'more...'; // text used in previous fonction
   // Misc setting to make folder icon clickable to expand tree menu nodes
   $GLOBALS['dm_tree_titleclick'] = true;
   // Generate the menu data output (uses configuration options above)
   $categories_string = tep_make_cat_dmlist();
   // Include required libraries based on menu type
   require_once 'includes/functions/dynamenu/lib/PHPLIB.php';
   require_once 'includes/functions/dynamenu/lib/layersmenu-common.inc.php';
   if ($menu_type < 2) { // Setup for DHTML style menus
 ?>
  <script language="JavaScript" type="text/javascript">
   <!--
    <?php require_once 'includes/functions/dynamenu/libjs/layersmenu-browser_detection.js'; ?>
   // -->
  </script>
  <script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layersmenu-library.js"></script>
  <script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layersmenu.js"></script>
 <?php

 require_once 'includes/functions/dynamenu/lib/layersmenu.inc.php';
 $mid = new LayersMenu($menu_layer_offset[0],$menu_layer_offset[1],$menu_layer_offset[2],1);
   } elseif ($menu_type > 2) { // Setup for plain style menus
 require_once 'includes/functions/dynamenu/lib/plainmenu.inc.php';
 $mid = new PlainMenu();
   } else {  // Setup for tree style menus

  ?>
  <script language="JavaScript" type="text/javascript">
   <!--
    <?php require_once 'includes/functions/dynamenu/libjs/layersmenu-browser_detection.js'; ?>

	    <?php

		   if ($menu_tree_current_path) {
		   echo "\n".'var menu_tree_current_path = true';	   
		  } else {
		   echo "\n".'var menu_tree_current_path = false';		  
		  }

	    ?>
  // -->
  </script>
  <script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layerstreemenu-cookies.js"></script>
 <?php
  require_once 'includes/functions/dynamenu/lib/treemenu.inc.php';
  $mid = new TreeMenu();
   }
   // Set menu config variables
   $mid->setDirroot('./');
   $mid->setLibjsdir('./includes/functions/dynamenu/libjs/');
   if ($menu_type !=2) {
 $mid->setTpldir('./includes/functions/dynamenu/templates/');
   }

   $mid->setImgdir('./images/');
   $mid->setImgwww('images/');
   $mid->setIcondir('./images/');
   $mid->setIconwww('images/');
   $mid->setIconsize($menu_icon_width, $menu_icon_height);
   // Generate menus
   $mid->setMenuStructureString($categories_string);
   $mid->parseStructureForMenu('catmenu');
   switch ($menu_type) {
 case 0: // Horizontal drop-down
  $mid->setDownArrowImg($menu_downarrowimg);
  $mid->setForwardArrowImg($menu_fwdarrowimg);
  $mid->setHorizontalMenuTpl('layersmenu-horizontal_menu.ihtml');	 
  $mid->setSubMenuTpl('layersmenu-horiz_sub_menu.ihtml');	  
	 $mid->newHorizontalMenu('catmenu');
    $mid->printHeader();
  $categories_menu = $mid->getMenu('catmenu');
    $GLOBALS['dmfooter'] = $mid->getFooter();	   
  break;
 case 1:  // Vertical fly-out
  $mid->setDownArrowImg($menu_downarrowimg);
  $mid->setForwardArrowImg($menu_fwdarrowimg);
  $mid->setVerticalMenuTpl('layersmenu-vertical_menu.ihtml');   
  $mid->setSubMenuTpl('layersmenu-vert_sub_menu.ihtml');	  
    $mid->newVerticalMenu('catmenu');
    $mid->printHeader();
  $categories_menu = $mid->getMenu('catmenu');
    $GLOBALS['dmfooter'] = $mid->getFooter();		   
  break;
 case 2:  // Tree menu
   $categories_menu = $mid->newTreeMenu('catmenu');
  break;
 case 3:  // Horizontal plain menu
  $mid->setPlainMenuTpl('layersmenu-horizontal_plain_menu.ihtml'); 
  $categories_menu = $mid->newHorizontalPlainMenu('catmenu');	  
  break;
 case 4:  // Vertical plain menu
  $mid->setPlainMenuTpl('layersmenu-plain_menu.ihtml'); 
  $categories_menu = $mid->newPlainMenu('catmenu');	 
  break;   
   }

   // Initialize HTML and info_box class if displaying inside a box
   //if ($show_dmcats_as_box) {
   // echo '<tr><td>';
   // $info_box_contents = array();
   // $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);
   // new infoBoxHeading($info_box_contents, true, false);	
   }
   // Output list inside a box if specified, otherwise just output unordered list
   //if ($show_dmcats_as_box) {
   // $info_box_contents = array();
   // $info_box_contents[] = array('text' => $categories_menu);
   // new infoBox($info_box_contents);
   //  echo '</td></tr>'; // end of html tags
   //} else {
   //  echo $before_nobox_html;
   // echo $categories_menu;
   //  echo $after_nobox_html;
   //}

   // Create the root category list
   function tep_make_cat_dmlist($rootcatid = 0, $maxlevel = 0){
 global $cPath_array, $show_full_tree, $languages_id;

 global $idname_for_menu, $cPath_array, $show_full_tree, $languages_id;
 // Modify category query if not fetching all categories (limit to root cats and selected subcat tree)
  if (!$show_full_tree) {
  $parent_query = 'AND (c.parent_id = "0"';

    if (isset($cPath_array)) {

	 $cPath_array_temp = $cPath_array;

	 foreach($cPath_array_temp AS $key => $value) {
	   $parent_query .= ' OR c.parent_id = "'.$value.'"';
	  }

	  unset($cPath_array_temp);
    }

  $parent_query .= ')';   
  } else {
  $parent_query = '';
  } 
  $result = tep_db_query('select c.categories_id, cd.categories_name, c.parent_id from ' . TABLE_CATEGORIES . ' c, ' . TABLE_CATEGORIES_DESCRIPTION . ' cd where c.categories_id = cd.categories_id and cd.language_id="' . (int)$languages_id .'" '.$parent_query.'order by sort_order, cd.categories_name');

  while ($row = tep_db_fetch_array($result)) {   
  $table[$row['parent_id']][$row['categories_id']] = $row['categories_name'];
 }
 $output .= tep_make_cat_dmbranch($rootcatid, $table, 0, $maxlevel);
 return $output;
   }
   // Create the branches off the category list
   function tep_make_cat_dmbranch($parcat, $table, $level, $maxlevel) {
 global $cPath_array, $menu_use_titles, $menu_icon_file, $divide_subcats, $divide_subcats_text;

  $lvl_adjust = 1;

 $list = $table[$parcat];

 // Build data for menu
  while(list($key,$val) = each($list)){

    if (isset($cPath_array) && in_array($key, $cPath_array)) {
   $this_expanded = '1';
   $this_selected = 'dmselected';	 
  } else {
   $this_expanded = '';
   $this_selected = '';		
   }
  if (!$level) {
	 unset($GLOBALS['cPath_set']);
	  $GLOBALS['cPath_set'][0] = $key;
   $cPath_new = 'cPath=' . $key;
  } else {
	  $GLOBALS['cPath_set'][$level] = $key; 
   $cPath_new = 'cPath=' . implode("_", array_slice($GLOBALS['cPath_set'], 0, ($level+1)));

	  $this_subcat_count++;
  }

    if ($menu_use_titles) {
	 $this_title = $val;
    } else {
	 $this_title = '';   
    }   
  if (SHOW_COUNTS == 'true') {
   $products_in_category = tep_count_products_in_category($key);
   if ($products_in_category > 0) {
    $val .= ' (' . $products_in_category . ')';
   }
  }

    // Output for file to be parsed by PHP Layers Menu
    // Each line (terminated by a newline "\n" is a pipe delimited string with the following fields:
    // [dots]|[text]|[link]|[title]|[icon]|[target]|[expanded]
    // dots - number of dots signifies the level of the link '.' root level items, '..' first submenu, etc....
    // text - text for link; title - tooltip for link; icon - icon for link; target - "dmselected" CSS class if item is selected
    // expanded - signifies if the node is expanded or collapsed by default (applies only to tree style menus)

    // Add "more" submenu if dividing subcategories
    if ($this_subcat_count > $divide_subcats && $divide_subcats) {
   $output .= str_repeat(".", $level+$lvl_adjust).'|'.$divide_subcats_text.'||'.$this_title.'|'.$menu_icon_file.'|'.$this_selected.'|'.$this_expanded."\n";	   
	 $this_subcat_count = 1;
	  $lvl_adjust ++;
    }

  $output .= str_repeat(".", $level+$lvl_adjust).'|'.$val.'|'.tep_href_link(FILENAME_DEFAULT, $cPath_new).'|'.$this_title.'|'.$menu_icon_file.'|'.$this_selected.'|'.$this_expanded."\n";	   


  if ((isset($table[$key])) AND (($maxlevel > $level + 1) OR ($maxlevel == '0'))) {
   $output .= tep_make_cat_dmbranch($key,$table,$level + $lvl_adjust,$maxlevel);
  }

  } // End while loop
			    return $output;
		    }
		    //  Create new box for 2.3.1
	  $data = '<div class="ui-widget infoBoxContainer">' .
			  '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_FLYOUT_TITLE . '</div>' .
			  '  <div class="ui-widget-content infoBoxContents">' . $categories_menu . '</div>';
			  '</div>';

	 $oscTemplate->addBlock($data, $this->group);
   }

// end of dynamenu code ------------------------------------------------------------------------------------------	 
   function isEnabled() {
  return $this->enabled;
   }
   function check() {
  return defined('MODULE_BOXES_FLYOUT_STATUS');
   }
   function install() {
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Dynamenu Vertical Fly out Box', 'MODULE_BOXES_FLYOUT_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT', 'Left Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_FLYOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
   }
   function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }
   function keys() {
  return array('MODULE_BOXES_FLYOUT_STATUS', 'MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT', 'MODULE_BOXES_FLYOUT_SORT_ORDER');
   }
 }
?>

Posted

change this

 

'  <div class="ui-widget-content infoBoxContents">' . $categories_menu . '</div>';

 

to

 

'  <div class="ui-widget-content infoBoxContents">' . $categories_menu . '</div>' .

Posted

Fixed, thx pupar, 2 errors less mellow.png

Replace

// new infoBoxHeading($info_box_contents, true, false);

}

 

By

 

// new infoBoxHeading($info_box_contents, true, false);

//}

 

But another error to correct:

 

Fatal error: Call to undefined function tep_make_cat_dmlist() in /homepages/46/d289027439/htdocs/wsb5375180001/shop/includes/modules/boxes/bm_flyout.php on line 63

  • 1 month later...
Posted

Perhaps:

 

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License
*/
 class bm_flyout {
   var $code = 'bm_flyout';
   var $group = 'boxes';
   var $title;
   var $description;
   var $sort_order;
   var $enabled = false;
   function bm_flyout() {
  $this->title = MODULE_BOXES_FLYOUT_TITLE;
  $this->description = MODULE_BOXES_FLYOUT_DESCRIPTION;
  if ( defined('MODULE_BOXES_FLYOUT_STATUS') ) {
    $this->sort_order = MODULE_BOXES_FLYOUT_SORT_ORDER;
    $this->enabled = (MODULE_BOXES_FLYOUT_STATUS == 'True');
    $this->group = ((MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
  }
   }

 function execute() {
   global $oscTemplate;

// add code of dynamenu -----------------------------------------------------------------------------------------
  //Dynamenu box for osc 2.3.1
  $menu_type = 4; // 0 = Horizontal Drop-down; 1 = Vertical Flyout; 2 = Tree Menu 3 = Plain Horizontal Menu; 4 = Plain Vertical Menu
  $show_dmcats_as_box = false; // display in a box = true  
 $menu_use_titles = true; //set to true to assign title tags to each menu items
 $menu_icon_file = ''; //icon preceding menu items in /images directory (not for plain)
 $menu_icon_width = 16; // Width of icons used in menus (does not apply to plain menus).
 $menu_icon_height = 16; // Height of icons used in menus (does not apply to plain menus).
 $menu_fwdarrowimg  = 'forward-arrow.png'; //forward and down arrow for drop down and fly out menu (catalog/images)
 $menu_downarrowimg = 'down-arrow.png';
 $show_full_tree = true; // show only first categories = true else false for all
 $menu_tree_current_path = true; //for tree menu, only display category path select by user 
   // Top Offset: # of pixels from top border of previous menu the submenu appears
   // Right Offset: # of pixels from right border of previous menu the submenu appears
   // Left Offset: # of pixels from left border of previous menu the submenu appears
   $menu_layer_offset = array (0,4,4); //top offset
 $GLOBALS['dm_tree_folder_icons'] = true; // Show icons on tree menus=true
 $before_nobox_html = '<tr><td>'; //html before and after menu, use <tr><td> if not in a box
    $after_nobox_html = '';
 $divide_subcats = 0; //if too many subcategories, display "more"
 $divide_subcats_text = 'more...'; // text used in previous fonction
   // Misc setting to make folder icon clickable to expand tree menu nodes
   $GLOBALS['dm_tree_titleclick'] = true;
   // Generate the menu data output (uses configuration options above)
   $categories_string = $this->tep_make_cat_dmlist();
   // Include required libraries based on menu type
   require_once 'includes/functions/dynamenu/lib/PHPLIB.php';
   require_once 'includes/functions/dynamenu/lib/layersmenu-common.inc.php';

   if ($menu_type < 2) { // Setup for DHTML style menus
	 $head = '<script language="JavaScript" type="text/javascript">' . PHP_EOL;
	 $head .= '<!--';
// PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/
	 $head .= 'DOM = (document.getElementById) ? 1 : 0;' . PHP_EOL;
	 $head .= 'NS4 = (document.layers) ? 1 : 0;' . PHP_EOL;
	 $head .= '// We need to explicitly detect Konqueror' . PHP_EOL;
	 $head .= '// because Konqueror 3 sets IE = 1 ... AAAAAAAAAARGHHH!!!' . PHP_EOL;
	 $head .= "Konqueror = (navigator.userAgent.indexOf('Konqueror') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= '// We need to detect Konqueror 2.2 as it does not handle the window.onresize event' . PHP_EOL;
	 $head .= "Konqueror22 = (navigator.userAgent.indexOf('Konqueror 2.2') > -1 || navigator.userAgent.indexOf('Konqueror/2.2') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= 'Konqueror30 =' . PHP_EOL;
	 $head .= ' (' . PHP_EOL;
	   $head .= "navigator.userAgent.indexOf('Konqueror 3.0') > -1" . PHP_EOL;
	   $head .= "|| navigator.userAgent.indexOf('Konqueror/3.0') > -1" . PHP_EOL;
	   $head .= "|| navigator.userAgent.indexOf('Konqueror 3;') > -1" . PHP_EOL;
	   $head .= "|| navigator.userAgent.indexOf('Konqueror/3;') > -1" . PHP_EOL;
	   $head .= "|| navigator.userAgent.indexOf('Konqueror 3)') > -1" . PHP_EOL;
	 $head .= "  || navigator.userAgent.indexOf('Konqueror/3)') > -1" . PHP_EOL;
	  $head .= ')' . PHP_EOL;
	  $head .= '? 1 : 0;' . PHP_EOL;
	 $head .= "Konqueror31 = (navigator.userAgent.indexOf('Konqueror 3.1') > -1 || navigator.userAgent.indexOf('Konqueror/3.1') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= '// We need to detect Konqueror 3.2 and 3.3 as they are affected by the see-through effect only for 2 form elements' . PHP_EOL;
	 $head .= "Konqueror32 = (navigator.userAgent.indexOf('Konqueror 3.2') > -1 || navigator.userAgent.indexOf('Konqueror/3.2') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= "Konqueror33 = (navigator.userAgent.indexOf('Konqueror 3.3') > -1 || navigator.userAgent.indexOf('Konqueror/3.3') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= "Opera = (navigator.userAgent.indexOf('Opera') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= "Opera5 = (navigator.userAgent.indexOf('Opera 5') > -1 || navigator.userAgent.indexOf('Opera/5') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= "Opera6 = (navigator.userAgent.indexOf('Opera 6') > -1 || navigator.userAgent.indexOf('Opera/6') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= 'Opera56 = Opera5 || Opera6;' . PHP_EOL;
	 $head .= "IE = (navigator.userAgent.indexOf('MSIE') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= 'IE = IE && !Opera;' . PHP_EOL;
	 $head .= 'IE5 = IE && DOM;' . PHP_EOL;
	 $head .= 'IE4 = (document.all) ? 1 : 0;' . PHP_EOL;
	 $head .= 'IE4 = IE4 && IE && !DOM;' . PHP_EOL;
	 //require_once 'includes/functions/dynamenu/libjs/layersmenu-browser_detection.js';
	  $head .= ' // -->' . PHP_EOL;
	  $head .= '</script>' . PHP_EOL;
	  $head .= '<script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layersmenu-library.js"></script>' . PHP_EOL;
	  $head .= '<script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layersmenu.js"></script>';

	 require_once 'includes/functions/dynamenu/lib/layersmenu.inc.php';
	 $mid = new LayersMenu($menu_layer_offset[0],$menu_layer_offset[1],$menu_layer_offset[2],1);
   } elseif ($menu_type > 2) { // Setup for plain style menus
	 require_once 'includes/functions/dynamenu/lib/plainmenu.inc.php';
	 $mid = new PlainMenu();
	 $head = '';
   } else {  // Setup for tree style menus

	  $head = '<script language="JavaScript" type="text/javascript">' . PHP_EOL;
	  $head .= '<!--';
// PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/
	 $head .= 'DOM = (document.getElementById) ? 1 : 0;' . PHP_EOL;
	 $head .= 'NS4 = (document.layers) ? 1 : 0;' . PHP_EOL;
	 $head .= '// We need to explicitly detect Konqueror' . PHP_EOL;
	 $head .= '// because Konqueror 3 sets IE = 1 ... AAAAAAAAAARGHHH!!!' . PHP_EOL;
	 $head .= "Konqueror = (navigator.userAgent.indexOf('Konqueror') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= '// We need to detect Konqueror 2.2 as it does not handle the window.onresize event' . PHP_EOL;
	 $head .= "Konqueror22 = (navigator.userAgent.indexOf('Konqueror 2.2') > -1 || navigator.userAgent.indexOf('Konqueror/2.2') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= 'Konqueror30 =' . PHP_EOL;
	 $head .= ' (' . PHP_EOL;
	   $head .= "navigator.userAgent.indexOf('Konqueror 3.0') > -1" . PHP_EOL;
	   $head .= "|| navigator.userAgent.indexOf('Konqueror/3.0') > -1" . PHP_EOL;
	   $head .= "|| navigator.userAgent.indexOf('Konqueror 3;') > -1" . PHP_EOL;
	   $head .= "|| navigator.userAgent.indexOf('Konqueror/3;') > -1" . PHP_EOL;
	   $head .= "|| navigator.userAgent.indexOf('Konqueror 3)') > -1" . PHP_EOL;
	 $head .= "  || navigator.userAgent.indexOf('Konqueror/3)') > -1" . PHP_EOL;
	  $head .= ')' . PHP_EOL;
	  $head .= '? 1 : 0;' . PHP_EOL;
	 $head .= "Konqueror31 = (navigator.userAgent.indexOf('Konqueror 3.1') > -1 || navigator.userAgent.indexOf('Konqueror/3.1') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= '// We need to detect Konqueror 3.2 and 3.3 as they are affected by the see-through effect only for 2 form elements' . PHP_EOL;
	 $head .= "Konqueror32 = (navigator.userAgent.indexOf('Konqueror 3.2') > -1 || navigator.userAgent.indexOf('Konqueror/3.2') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= "Konqueror33 = (navigator.userAgent.indexOf('Konqueror 3.3') > -1 || navigator.userAgent.indexOf('Konqueror/3.3') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= "Opera = (navigator.userAgent.indexOf('Opera') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= "Opera5 = (navigator.userAgent.indexOf('Opera 5') > -1 || navigator.userAgent.indexOf('Opera/5') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= "Opera6 = (navigator.userAgent.indexOf('Opera 6') > -1 || navigator.userAgent.indexOf('Opera/6') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= 'Opera56 = Opera5 || Opera6;' . PHP_EOL;
	 $head .= "IE = (navigator.userAgent.indexOf('MSIE') > -1) ? 1 : 0;" . PHP_EOL;
	 $head .= 'IE = IE && !Opera;' . PHP_EOL;
	 $head .= 'IE5 = IE && DOM;' . PHP_EOL;
	 $head .= 'IE4 = (document.all) ? 1 : 0;' . PHP_EOL;
	 $head .= 'IE4 = IE4 && IE && !DOM;' . PHP_EOL;
	 //require_once 'includes/functions/dynamenu/libjs/layersmenu-browser_detection.js';
	  //require_once 'includes/functions/dynamenu/libjs/layersmenu-browser_detection.js';
	  if ($menu_tree_current_path) {
	    $head .= "\n".'var menu_tree_current_path = true';	   
	  } else {
	    $head .=  "\n".'var menu_tree_current_path = false';
	  }
	  $head .= '// -->';
	  $head .= '</script>' . PHP_EOL;
	  $head .= '<script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layerstreemenu-cookies.js"></script>';
	  require_once 'includes/functions/dynamenu/lib/treemenu.inc.php';
	  $mid = new TreeMenu();
   }

   $oscTemplate->addBlock($head, $this->group);

   // Set menu config variables
   $mid->setDirroot('./');
   $mid->setLibjsdir('./includes/functions/dynamenu/libjs/');
   if ($menu_type !=2) {
	 $mid->setTpldir('./includes/functions/dynamenu/templates/');
   }

   $mid->setImgdir('./images/');
   $mid->setImgwww('images/');
   $mid->setIcondir('./images/');
   $mid->setIconwww('images/');
   $mid->setIconsize($menu_icon_width, $menu_icon_height);
   // Generate menus
   $mid->setMenuStructureString($categories_string);
   $mid->parseStructureForMenu('catmenu');
   switch ($menu_type) {
	 case 0: // Horizontal drop-down
	  $mid->setDownArrowImg($menu_downarrowimg);
	  $mid->setForwardArrowImg($menu_fwdarrowimg);
	  $mid->setHorizontalMenuTpl('layersmenu-horizontal_menu.ihtml');	   
	  $mid->setSubMenuTpl('layersmenu-horiz_sub_menu.ihtml');		
			 $mid->newHorizontalMenu('catmenu');
	    $mid->printHeader();
	  $categories_menu = $mid->getMenu('catmenu');
	    $GLOBALS['dmfooter'] = $mid->getFooter();	 
	  break;
	 case 1:  // Vertical fly-out
	  $mid->setDownArrowImg($menu_downarrowimg);
	  $mid->setForwardArrowImg($menu_fwdarrowimg);
	  $mid->setVerticalMenuTpl('layersmenu-vertical_menu.ihtml');  
	  $mid->setSubMenuTpl('layersmenu-vert_sub_menu.ihtml');		 
	    $mid->newVerticalMenu('catmenu');
	    $mid->printHeader();
	  $categories_menu = $mid->getMenu('catmenu');
	    $GLOBALS['dmfooter'] = $mid->getFooter();			 
	  break;
	 case 2:  // Tree menu
	   $categories_menu = $mid->newTreeMenu('catmenu');
	  break;
	 case 3:  // Horizontal plain menu
	  $mid->setPlainMenuTpl('layersmenu-horizontal_plain_menu.ihtml');
	  $categories_menu = $mid->newHorizontalPlainMenu('catmenu');	
	  break;
	 case 4:  // Vertical plain menu
	  $mid->setPlainMenuTpl('layersmenu-plain_menu.ihtml');
	  $categories_menu = $mid->newPlainMenu('catmenu');	 
	  break;  
   }

   // Initialize HTML and info_box class if displaying inside a box
   //if ($show_dmcats_as_box) {
   // echo '<tr><td>';
   // $info_box_contents = array();
   // $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);
   // new infoBoxHeading($info_box_contents, true, false);	
   // Output list inside a box if specified, otherwise just output unordered list
   //if ($show_dmcats_as_box) {
   // $info_box_contents = array();
   // $info_box_contents[] = array('text' => $categories_menu);
   // new infoBox($info_box_contents);
   //  echo '</td></tr>'; // end of html tags
   //} else {
   //  echo $before_nobox_html;
   // echo $categories_menu;
   //  echo $after_nobox_html;
   //}


  //  Create new box for 2.3.1
  $data = '<div class="ui-widget infoBoxContainer">' .
		  '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_FLYOUT_TITLE . '</div>' .
		  '  <div class="ui-widget-content infoBoxContents">' . $categories_menu . '</div>' .
		  '</div>';
  $oscTemplate->addBlock($data, $this->group);
   }
   // Create the root category list
   function tep_make_cat_dmlist($rootcatid = 0, $maxlevel = 0){
  global $cPath_array, $show_full_tree, $languages_id;
  // Modify category query if not fetching all categories (limit to root cats and selected subcat tree)
  if (!$show_full_tree) {
    $parent_query = 'AND (c.parent_id = "0"';

    if (isset($cPath_array)) {

	  $cPath_array_temp = $cPath_array;

	  foreach($cPath_array_temp AS $key => $value) {
		 $parent_query .= ' OR c.parent_id = "'.$value.'"';
	  }

	  unset($cPath_array_temp);
    }

    $parent_query .= ')';  
  } else {
    $parent_query = '';
  }
  $result = tep_db_query('select c.categories_id, cd.categories_name, c.parent_id from ' . TABLE_CATEGORIES . ' c, ' . TABLE_CATEGORIES_DESCRIPTION . ' cd where c.categories_id = cd.categories_id and cd.language_id="' . (int)$languages_id .'" '.$parent_query.'order by sort_order, cd.categories_name');
  $output = '';
  while ($row = tep_db_fetch_array($result)) {  
    $table[$row['parent_id']][$row['categories_id']] = $row['categories_name'];
  }
  $output .= $this->tep_make_cat_dmbranch($rootcatid, $table, 0, $maxlevel);
  return $output;
   }
   // Create the branches off the category list
   function tep_make_cat_dmbranch($parcat, $table, $level, $maxlevel) {
	 global $cPath_array, $menu_use_titles, $menu_icon_file, $divide_subcats, $divide_subcats_text;

	 $lvl_adjust = 1;
	 $this_subcat_count = 0;
	 $list = $table[$parcat];
	 $output = '';

	 // Build data for menu
	  while(list($key,$val) = each($list)){

	    if (isset($cPath_array) && in_array($key, $cPath_array)) {
	   $this_expanded = '1';
	   $this_selected = 'dmselected';	   
	  } else {
	   $this_expanded = '';
	   $this_selected = '';		
	   }
	  if (!$level) {
			 unset($GLOBALS['cPath_set']);
			  $GLOBALS['cPath_set'][0] = $key;
	   $cPath_new = 'cPath=' . $key;
	  } else {
			  $GLOBALS['cPath_set'][$level] = $key;
	   $cPath_new = 'cPath=' . implode("_", array_slice($GLOBALS['cPath_set'], 0, ($level+1)));

			  $this_subcat_count++;
	  }

	    if ($menu_use_titles) {
			 $this_title = $val;
	    } else {
			 $this_title = '';  
	    }  
	  if (SHOW_COUNTS == 'true') {
	   $products_in_category = tep_count_products_in_category($key);
	   if ($products_in_category > 0) {
	    $val .= ' (' . $products_in_category . ')';
	   }
	  }

	    // Output for file to be parsed by PHP Layers Menu
	    // Each line (terminated by a newline "\n" is a pipe delimited string with the following fields:
	    // [dots]|[text]|[link]|[title]|[icon]|[target]|[expanded]
	    // dots - number of dots signifies the level of the link '.' root level items, '..' first submenu, etc....
	    // text - text for link; title - tooltip for link; icon - icon for link; target - "dmselected" CSS class if item is selected
	    // expanded - signifies if the node is expanded or collapsed by default (applies only to tree style menus)

	    // Add "more" submenu if dividing subcategories
	    if ($this_subcat_count > $divide_subcats && $divide_subcats) {
	   $output .= str_repeat(".", $level+$lvl_adjust).'|'.$divide_subcats_text.'||'.$this_title.'|'.$menu_icon_file.'|'.$this_selected.'|'.$this_expanded."\n";	   
			 $this_subcat_count = 1;
			  $lvl_adjust ++;
	    }

	  $output .= str_repeat(".", $level+$lvl_adjust).'|'.$val.'|'.tep_href_link(FILENAME_DEFAULT, $cPath_new).'|'.$this_title.'|'.$menu_icon_file.'|'.$this_selected.'|'.$this_expanded."\n";		 


	  if ((isset($table[$key])) AND (($maxlevel > $level + 1) OR ($maxlevel == '0'))) {
	   $output .= $this->tep_make_cat_dmbranch($key,$table,$level + $lvl_adjust,$maxlevel);
	  }

	  } // End while loop
							    return $output;
   }
// end of dynamenu code ------------------------------------------------------------------------------------------	  
   function isEnabled() {
	  return $this->enabled;
   }
   function check() {
	  return defined('MODULE_BOXES_FLYOUT_STATUS');
   }
   function install() {
	  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Dynamenu Vertical Fly out Box', 'MODULE_BOXES_FLYOUT_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
	  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT', 'Left Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");
	  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_FLYOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
   }
   function remove() {
	  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }
   function keys() {
	  return array('MODULE_BOXES_FLYOUT_STATUS', 'MODULE_BOXES_FLYOUT_CONTENT_PLACEMENT', 'MODULE_BOXES_FLYOUT_SORT_ORDER');
   }
 }
?>

 

 

but I think it is time to full rewrite this menu system. I found a lot of problem with grid system compatibility.

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...