This is a discussion on Box in the Middle: Categories within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Hi, I would like to offer my wine-shop visitors on the shop-start page all shop categories in the center of ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Hi, I would like to offer my wine-shop visitors on the shop-start page all shop categories in the center of the page. I did not find any documentation or post about how to do it. If I just try to include It the way its done in the left colum, I get Code: Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/www/web11/html/shop/includes/boxes/categories.php:13) in /home/www/web11/html/shop/includes/boxes/categories.php on line 13 Can anybody help? |
|
#2
| |||
| |||
| Made a copy of categories.php and called that one.... Now it works. Dirty trick, i know, if anyone knows a better solution, I would prefer that. Still a problem: How do I show all categories? It only gives me the top-categories? |
|
#3
| |||
| |||
| You'd need to write a custom categories.php to run through all the categories not just the active one. It wouldn't be hard but you'd need to understand php. jon |
|
#4
| |||
| |||
| Yes, I can follow you so far. Since I am a beginner in PHP, I have some problems to analyse the code in categories.php. MAybe you (or someone else) can help a little As I read it, it has three parts: 1. function tep_show_category($counter) to assamble the output HTML 2. Code: $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='" . (int)$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'];
}
}
and 3. everything after Quote:
Now I asume , that only 1 cPath can be handed over.... But what is $cPath_array ? Whats it used for? Is there a variable / array that contains all subcategories allready so that I can work with it? Or do I have to read them myself from the database? I would figure it out by echoing, but echo throws an error message in this part of the code: Code: Warning: Variable passed to reset() is not an array or object in /home/www/web11/html/shop/includes/boxes/categories.php on line 95 Any hint will help.... Thanx carab |
|
#5
| |||
| |||
| $cPath_array is constructed in application_top from the cPath _GET variable, you can see it in the title bar whenever you're looking at categories or products. The cPath_array is made by split() ing the $cPath so for example cPath=1_5_34_54 will be made into an array (1,5,34,54). You are correct when you say that the cPath_array determines what categories are shown....it runs through until it reaches the end of the array. Thinking back, I have made a similar modification to what you want, but it only dealt with one sub-level of categories. It was so I could have a dropdown menu for each top level category. I remember it made my head spin trying to understand the category structure of OSC. Sorry I've not been much help but you are on the right tracks. jw |
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with categories | krissj | osCMax v1.7 Discussion | 1 | 12-09-2004 12:41 PM |
| Want to show categories AND sub categories in index.php!! | calle | osCommerce 2.2 Modification Help | 0 | 10-27-2004 11:51 AM |
| CATEGORIES BOX does not display categories list | glk | osCMax v1.7 Discussion | 2 | 03-05-2004 11:09 AM |
| Edit middle of index.php?? | Anonymous | osCMax v1.7 Discussion | 3 | 09-29-2003 11:45 AM |
| categories in MS2 Max | gellnsh | osCMax v1.7 Discussion | 1 | 09-25-2003 01:43 PM |