osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Box in the Middle: Categories

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 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > osCommerce 2.2 Modification Help

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 11-15-2004, 03:19 PM
New Member
 
Join Date: Sep 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
carab
Default Box in the Middle: Categories

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
Important: I also want display all cats like its done at yahoo or any other wb directory, not just the top ones,

Can anybody help?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #2  
Old 11-16-2004, 01:40 AM
New Member
 
Join Date: Sep 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
carab
Default

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?
__________________
--
http://www.gratulatio.de/
Geburtstage können Sie jetzt ruhig vergessen!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3  
Old 11-16-2004, 05:15 AM
Active Member
 
Join Date: Jan 2003
Location: Surrey, UK
Posts: 126
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jonthewebb
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4  
Old 11-16-2004, 07:28 AM
New Member
 
Join Date: Sep 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
carab
Default

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'];
    }
  }
To read the top- Categories from teh database

and 3. everything after
Quote:
if (tep_not_null($cPath)) { ....
to read the subcatagories if cPath is set...

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #5  
Old 11-16-2004, 08:45 AM
Active Member
 
Join Date: Jan 2003
Location: Surrey, UK
Posts: 126
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jonthewebb
Default

$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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -8. The time now is 11:39 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax