Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Remove 'box look' from categories.php


sgtpepper

Recommended Posts

Posted

How can I remove the whole 'box look' from categories.php? I would like to remove the heading, and the box backgrounds. But only for categories.php

 

The other boxes in the left column are fine.

 

Thanks

Are Oompa-Loompa's asexual?

Posted

Have you tried www.oscdox.com? I believe it is explained in the documentation. You can also edit the respective php-files. :)

Posted

I tried looking through that website. It still needs more content to be effective. From what I could tell, what it gives is usually found in this forum by searching.

 

I explained how to change ALL the boxes, using boxes.php...that isnt what I can trying to do. I want to remove the 'box look' only from categories, while keeping the box look for everything else.

 

I know it should be simply removing some code in categories.php but I am not sure what I should remove. Everything I have tried seems to also remove the contents of the box. Any suggestions would be helpful...

 

Thanks

Are Oompa-Loompa's asexual?

Posted

The categories box makes use (like all boxes) of the box class.

It basically does a lot of queries on the db and forms one big long string with all the category links in it.

 

Then a box object is created and fed with an array containing the layout bits and that string...

(The famous new infoBox($info_box_contents); )

 

So if you just skip that part and use the $categories_string

you can poor it in any html layout you desire.

 

Make sure the categories.php starts with <tr><td> and ends with </td></tr> or your table layout will freak out.

Boxes have those tags by default so don't remove them unless you know what you're doing 'html-table-wise' ;)

 

Regards,

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Posted

Mattice,

 

Thanks for the help...but I am still a little confused. Here is what I am trying to do. I want to create the sub categories so they are placed in products_info near the product description.

 

I have have created a file in /includes/boxes called subcategories.php which is a copy of categories, but with everything but sub categories commented out. The code is below:

 

<?php

/*

$Id: categories.php,v 1.20 2002/06/05 19:18:22 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

 

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

$cPath_new = 'cPath=' . $counter;

} else {

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

}

 

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

$categories_string .= '">';

 

if ( ($id) && (in_array($counter, $id)) ) {

$categories_string .= '<b>';

}

 

// display category name

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

 

if ( ($id) && (in_array($counter, $id)) ) {

$categories_string .= '</b>';

}

 

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>';

 

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

tep_show_category2($foo[$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, false, false);

 

$categories_string = '';

 

$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)) {

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

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

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

'level' => 0,

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

'next_id' => false

);

 

if (isset($prev_id)) {

$foo[$prev_id]['next_id'] = $categories['categories_id'];

}

 

$prev_id = $categories['categories_id'];

 

if (!isset($first_element)) {

$first_element = $categories['categories_id'];

}

}

 

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

if ($cPath) {

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

reset($id);

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

$new_path .= $value;

unset($prev_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)) {

$foo[$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($prev_id)) {

$foo[$prev_id]['next_id'] = $row['categories_id'];

}

 

$prev_id = $row['categories_id'];

 

if (!isset($first_id)) {

$first_id = $row['categories_id'];

}

 

$last_id = $row['categories_id'];

}

if ($category_check != 0) {

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

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

}

 

$new_path .= '_';

}

}

 

tep_show_category2($first_element);

 

$info_box_contents = array();

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

'text' => $categories_string

);

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- categories_eof //-->

 

 

This files is doing what I want it to do with two exceptions.

 

1. It has the 'box look' and I still am not sure which part of the above code needs to be removed to get rid of the box....and keep just the sub-category links

 

2. Although I have eveything but the sub-categories commented out, the box seems to be the same height as the main categories.php

 

An example is here http://www.dartmouthimages.com/catalog/product_info.php?cPath=22&products_id=29'>http://www.dartmouthimages.com/catalog/pro...&products_id=29

 

If you can help me figure out what is wrong with this code, I would be very thankful.

 

Thanks!

Are Oompa-Loompa's asexual?

Posted

Ah... I was looking at an older version of categories.php...

 

but this is what I meant anyway:

 

...

...

..

/* comment out start



$info_box_contents = array(); 

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

'text' => $categories_string 

); 

new infoBox($info_box_contents);



comment out end */ 



// now echo the string 

echo $categories_string;

?>

The idea is you manipulate the string to your likings while it is being build.

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Posted

Great!!! Thanks! That did the trick....one thing though. It seems to have built the whole nav. For example instead of

 

<--- Start of nav ---->

sub-category

<--- End of nav ---->

 

I have

 

<--- Start of nav ---->

 

 

 

 

 

 

 

 

 

 

sub-category

 

 

 

 

 

 

 

 

<--- end of nav ---->

 

Almost like it is building places for the other links, even though I do not have them showing. Any ideas on how I can tighten that up? Thanks for the help!

Are Oompa-Loompa's asexual?

Archived

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

×
×
  • Create New...