Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

I Deleted my categries box


Guest

Recommended Posts

Posted

Hi, I deleted my categories box and I didnt mean to do it :'( ....can some one please assist me in getting this back...Thanks

Posted

Hiya,

All you need to do is to open up a fresh copy of OSC that suits your version number then upload it to you server to replace the missing one, dont worry we all done it!!

Nic

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Posted

I saved the original categories file but when I try to input a new code from contributions I get this code.......Fatal error: Class 'CategoriesBoxHeading' not found in /home/herblife/public_html/includes/boxes/categories.php on line 105..........this is line 105.....

 

 

 

 

new CategoriesBox($info_box_contents);

Posted

nope :( it still shows me the same messageis something else wrong with this code.......

 

 

 

<?php

/*

$id: Great Categories v2.1 2005/07/09 14:00:00 willross Exp $

http://www.palaia.com/ujp/ - [email protected]

*** For use with standard install of osCommerce 2.2MS2+

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2005 osCommerce

 

Released under the GNU General Public License

*/

function tep_show_category($counter) {

global $tree, $categories_string, $cPath_array, $aa;

 

for ($a=0; $a<$tree[$counter]['level']; $a++) {

// $categories_string .= "  ";

}

//category start

if ($tree[$counter]['level'] == 0)

{

if ($aa == 1)

{

$categories_string .= '<img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="2"><br><img src="images/pixel_ltgray.gif" border="0" alt="" width="100%" height="1"><br><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="2">';

}

else

{$aa=1;}

}

if ($tree[$counter]['level'] == 0) {$categories_string .= '<div id="topcat">';}

if ($tree[$counter]['level'] == 1) {$categories_string .= '<div id="secondcat">';}

if ($tree[$counter]['level'] == 2) {$categories_string .= '<div id="thirdcat">';}

if ($tree[$counter]['level'] == 3) {$categories_string .= '<div id="fourthcat">';}

if ($tree[$counter]['level'] == 4) {$categories_string .= '<div id="fifthcat">';}

 

 

 

 

 

$categories_string .= '<a';

if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) {

$categories_string .= ' class="activelink"';

}

 

if ($tree[$counter]['parent'] == 0) {

$cPath_new = 'cPath=' . $counter;

} else {

$cPath_new = 'cPath=' . $tree[$counter]['path'];

}

 

$categories_string .= ' href="'.tep_href_link(FILENAME_DEFAULT, $cPath_new);

$categories_string .= '">';

// display category name

if (tep_has_category_subcategories($counter) || $tree[$counter]['level'] == 0) {

if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) {

$categories_string .= '<span class="catwithsubs">'.tep_image(DIR_WS_IMAGES . 'categories/arrow_down.gif', '', '9', '9') . "</span>";

} else {

$categories_string .= '<span class="catwithsubs">'.tep_image(DIR_WS_IMAGES . 'categories/arrow_right.gif', '', '9', '9') . "</span>";

}

} else {

$categories_string .= '<span class="catwithnosubs">' .tep_image(DIR_WS_IMAGES . 'categories/arrow_bullet.gif', 'nokta', '9', '9') . "</span>";

}

 

 

 

//category name

$categories_string .= $tree[$counter]['name'];

 

 

 

if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) {

//end of active link

$categories_string .= '';

}

 

if (tep_has_category_subcategories($counter)) {

$categories_string .= '';

}

 

$categories_string .= '</a>';

 

if (SHOW_COUNTS == 'true') {

$products_in_category = tep_count_products_in_category($counter);

if ($products_in_category > 0) {

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

}

}

 

// $categories_string .= '<br>';

$categories_string .= '</div>';

 

if ($tree[$counter]['next_id']) {

tep_show_category($tree[$counter]['next_id']);

}

}

?>

<!-- categories //-->

<tr>

<td>

<?php

$info_box_contents = array();

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

'text' => BOX_HEADING_CATEGORIES);

 

new CategoriesBoxHeading($info_box_contents, true, false);

 

$categories_string = '<div id="thecategories">';

 

$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 = '0' 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)) {

$tree[$categories['categories_id']] = array(

'name' => $categories['categories_name'],

'parent' => $categories['parent_id'],

'level' => 0,

'path' => $categories['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $categories['categories_id'];

}

 

$parent_id = $categories['categories_id'];

 

if (!isset($first_element)) {

$first_element = $categories['categories_id'];

}

}

 

//------------------------

if ($cPath) {

$cPath_array = split('_', $cPath);

reset($cPath_array);

while (list($key, $value) = each($cPath_array)) {

$new_path .= $value;

unset($parent_id);

unset($first_id);

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

$category_check = tep_db_num_rows($categories_query);

while ($row = tep_db_fetch_array($categories_query)) {

$tree[$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($parent_id)) {

$tree[$parent_id]['next_id'] = $row['categories_id'];

}

 

$parent_id = $row['categories_id'];

 

if (!isset($first_id)) {

$first_id = $row['categories_id'];

}

 

$last_id = $row['categories_id'];

}

if ($category_check != 0) {

$tree[$last_id]['next_id'] = $tree[$value]['next_id'];

$tree[$value]['next_id'] = $first_id;

}

 

$new_path .= '_';

}

}

 

tep_show_category($first_element);

$info_box_contents = array();

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

'text' => $categories_string.'</div>');

new CategoriesBoxHeading($info_box_contents);

?>

</td>

</tr>

<!-- categories_eof //-->

Posted

This is the one from the contribution you are using, it should be a striaght swap :-)

 

 

<?php

/*

$id: Great Categories v2.1 2005/07/09 14:00:00 willross Exp $

http://www.palaia.com/ujp/ - [email protected]

*** For use with standard install of osCommerce 2.2MS2+

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2005 osCommerce

 

Released under the GNU General Public License

*/

function tep_show_category($counter) {

global $tree, $categories_string, $cPath_array, $aa;

 

for ($a=0; $a<$tree[$counter]['level']; $a++) {

// $categories_string .= "  ";

}

//category start

if ($tree[$counter]['level'] == 0)

{

if ($aa == 1)

{

$categories_string .= '<img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="2"><br><img src="images/pixel_ltgray.gif" border="0" alt="" width="100%" height="1"><br><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="2">';

}

else

{$aa=1;}

}

if ($tree[$counter]['level'] == 0) {$categories_string .= '<div id="topcat">';}

if ($tree[$counter]['level'] == 1) {$categories_string .= '<div id="secondcat">';}

if ($tree[$counter]['level'] == 2) {$categories_string .= '<div id="thirdcat">';}

if ($tree[$counter]['level'] == 3) {$categories_string .= '<div id="fourthcat">';}

if ($tree[$counter]['level'] == 4) {$categories_string .= '<div id="fifthcat">';}

 

 

 

 

 

$categories_string .= '<a';

if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) {

$categories_string .= ' class="activelink"';

}

 

if ($tree[$counter]['parent'] == 0) {

$cPath_new = 'cPath=' . $counter;

} else {

$cPath_new = 'cPath=' . $tree[$counter]['path'];

}

 

$categories_string .= ' href="'.tep_href_link(FILENAME_DEFAULT, $cPath_new);

$categories_string .= '">';

// display category name

if (tep_has_category_subcategories($counter) || $tree[$counter]['level'] == 0) {

if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) {

$categories_string .= '<span class="catwithsubs">'.tep_image(DIR_WS_IMAGES . 'categories/arrow_down.gif', '', '9', '9') . "</span>";

} else {

$categories_string .= '<span class="catwithsubs">'.tep_image(DIR_WS_IMAGES . 'categories/arrow_right.gif', '', '9', '9') . "</span>";

}

} else {

$categories_string .= '<span class="catwithnosubs">' .tep_image(DIR_WS_IMAGES . 'categories/arrow_bullet.gif', 'nokta', '9', '9') . "</span>";

}

 

 

 

//category name

$categories_string .= $tree[$counter]['name'];

 

 

 

if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) {

//end of active link

$categories_string .= '';

}

 

if (tep_has_category_subcategories($counter)) {

$categories_string .= '';

}

 

$categories_string .= '</a>';

 

if (SHOW_COUNTS == 'true') {

$products_in_category = tep_count_products_in_category($counter);

if ($products_in_category > 0) {

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

}

}

 

// $categories_string .= '<br>';

$categories_string .= '</div>';

 

if ($tree[$counter]['next_id']) {

tep_show_category($tree[$counter]['next_id']);

}

}

?>

<!-- categories //-->

<tr>

<td>

<?php

$info_box_contents = array();

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

'text' => BOX_HEADING_CATEGORIES);

 

new infoBoxHeading($info_box_contents, true, false);

 

$categories_string = '<div id="thecategories">';

 

$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 = '0' 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)) {

$tree[$categories['categories_id']] = array(

'name' => $categories['categories_name'],

'parent' => $categories['parent_id'],

'level' => 0,

'path' => $categories['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $categories['categories_id'];

}

 

$parent_id = $categories['categories_id'];

 

if (!isset($first_element)) {

$first_element = $categories['categories_id'];

}

}

 

//------------------------

if ($cPath) {

$cPath_array = split('_', $cPath);

reset($cPath_array);

while (list($key, $value) = each($cPath_array)) {

$new_path .= $value;

unset($parent_id);

unset($first_id);

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

$category_check = tep_db_num_rows($categories_query);

while ($row = tep_db_fetch_array($categories_query)) {

$tree[$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($parent_id)) {

$tree[$parent_id]['next_id'] = $row['categories_id'];

}

 

$parent_id = $row['categories_id'];

 

if (!isset($first_id)) {

$first_id = $row['categories_id'];

}

 

$last_id = $row['categories_id'];

}

if ($category_check != 0) {

$tree[$last_id]['next_id'] = $tree[$value]['next_id'];

$tree[$value]['next_id'] = $first_id;

}

 

$new_path .= '_';

}

}

 

tep_show_category($first_element);

$info_box_contents = array();

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

'text' => $categories_string.'</div>');

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- categories_eof //-->

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Posted

:huh:........You amaze me every time....thanks alot nic..........but I have a question what exactly does this code do....the only thing I see changing is a small box next to the words categories in the box

Archived

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

×
×
  • Create New...