Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

drop down menu php code change


abulink

Recommended Posts

i have a drop down menu see. http://test.nuvo.biz/clients/aesthetix/cat...log/default.php

 

but the drop down only show catagories i want it to also show products can someone help me adapt this php code to show catagories and products.

 

thanks.

 

<?php

 

$number_top_levels = 0;

$categories_string='';

$number_top_levels = build_menus(0,'','');

echo 'var NoOffFirstLineMenus= ' . $number_top_levels. ';' ; // Number of first level items

echo $categories_string;

 

function build_menus($currentParID,$menustr,$catstr) {

global $categories_string, $id, $languages_id;

$tmpCount;

 

$tmpCount = 0;

$haschildren = 0; //default

 

$categories_query_catmenu = 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 = '" . $currentParID . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name");

while ($categories = tep_db_fetch_array($categories_query_catmenu)) {

$tmpString = '';

$tmpCount += 1;

$haschildren=tep_has_category_subcategories($categories['categories_id']);

 

if ($haschildren) {

if($menustr != ''){

$menu_tmp = $menustr . '_' . $tmpCount;

} else {

$menu_tmp = $tmpCount;

}

if($catstr != ''){

$cat_tmp = $catstr . '_' . $categories['categories_id'];

} else {

$cat_tmp = $categories['categories_id'];

}

$NumChildren = build_menus($categories['categories_id'],$menu_tmp,$cat_tmp); } else {

$NumChildren = 0;

}

 

if ($id==$categories['categories_id']) {

$tmpString .= '<b>';

}

// display category name

$tmpString .= $categories['categories_name'];

 

if ( $id==$categories['categories_id'] ) {

$tmpString .= '</b>';

}

if (SHOW_COUNTS == 'true') {

$products_in_category = tep_count_products_in_category($categories['categories_id']);

if ($products_in_category > 0) {

$tmpString .= ' (' . $products_in_category . ')';

}

}

 

if($catstr != ''){

$cPath_new = 'cPath=' . $catstr . '_' . $categories['categories_id'];

} else {

$cPath_new = 'cPath=' . $categories['categories_id'];

}

 

// Menu tree

// Menu1_1_1=new Array(Text to show, Link, background image (optional), number of sub elements, height, width);

if($menustr != ''){

$menu_tmp = $menustr . '_' . $tmpCount;

} else {

$menu_tmp = $tmpCount;

}

$categories_string .= 'Menu' . ($menustr!=''?$menustr.'_':'') . $tmpCount;

$categories_string .= '= new Array("' . $tmpString . '","';

$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new);

$categories_string .= '","",' ;

$categories_string .= $NumChildren;

$categories_string .= ',' . LEFT_LINK_HEIGHT . ',' . LEFT_LINK_WIDTH ;

$categories_string .= '); ';

 

}// end while

return $tmpCount;

} //end build menus

 

echo '</script>';

 

//$tabletext ="<table><tr><td><div id='MenuBar' style='position:relative; width: " . LEFT_LINK_WIDTH . "; height: " . ($number_top_levels*LEFT_LINK_HEIGHT) . ";'> </div></td></tr></table>";

 

// $info_box_contents = array();

// $info_box_contents[] = array('align' => 'left',

//'text' => $tabletext

// );

// new infoBox($info_box_contents);

 

 

?>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...