Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Category editing (more categories)


jhande

Recommended Posts

Posted

I really need to add a more categories type of add-on. It just makes it more customer friendly with all my different categories and sub-categories.

 

With my MS2 2.2 shop I used - More Category Boxes but that is just to complicated to try and adapt to v2.3.3.

 

Jack pointed me towards - Every category of the products in unique box which is just this file =

 

categories.php

 

<?php
/*
Developed by Alexander Dimelow
http://oscommerce.web-project.co.uk
Copyright (c) 2009 Alexander Dimelow
Released under the GNU General Public License
*/
function preorder2($cid, $level, $foo, $cpath)
{
global $categories_string2;

if ($cid != 0) {
 for ($i=0; $i<$level; $i++)
 $categories_string2 .= '     ';
if ($cpath=="") $categories_string2 .= '<img src="images/template/images/category_arrow.gif" /> ';
 $categories_string2 .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . "$cpath" . "_" . $cid) . '" class="box_categories">';
 $categories_string2 .= $foo[$cid]['name'];
 $categories_string2 .= '</a>';
 if (SHOW_COUNTS) {
 $products_in_category2 = tep_count_products_in_category($cid);
 if ($products_in_category2 > 0) {
	 // $categories_string2 .= ' (' . $products_in_category2 . ')';
 }
 }
 $categories_string2 .= '<br>';
}
foreach ($foo as $key => $value) {
 if ($foo[$key]['parent'] == $cid) {
 preorder2($key, $level+1, $foo, $cid);
 }
}
}


?>
<!-- all_categories //-->
	 <tr>
	 <td class="box_categories">
<?php
$info_box_contents2 = array();
$info_box_contents2[] = array('align' => 'left',
						 'text' => BOX_HEADING_CATEGORIES
						 );
new infoBoxHeading($info_box_contents2, true, false);

$categories_string2 = '';

$categories_query2 = 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='" . $languages_id ."'
							 order by sort_order, cd.categories_name");

while ($categories2 = tep_db_fetch_array($categories_query2)) {
$foo[$categories2['categories_id']] = array(
								 'name' => $categories2['categories_name'],
								 'parent' => $categories2['parent_id'],
								 );

}

preorder2(0, 0, $foo, '');
$info_box_contents2 = array();
$info_box_contents2[] = array('align' => 'left',
						 'text' => $categories_string2
						 );
new infoBox($info_box_contents2);
?>
	 </td>
	 </tr>
<!-- all_categories_eof //-->

 

I assume the above code needs to be added somehow to bm_categories.php but I have no clue how.

 

Any help would be greatly appreciated!

- :: Jim :: -

- My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -

Archived

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

×
×
  • Create New...