Jump to content
Sign in to follow this  
Andrew J

[Contribution] Show Sub-categories

Recommended Posts

contribution link

 

Hi!

 

I?d like to add this mod to my site but my catalog/includes/boxes/categories.php page modified many times so its content is far from the original one.

 

Can somebody make a step by step install guide and post here how to integrate this mod into the existing categories.php page?

 

 

Cheers,

 

Andrew

Share this post


Link to post
Share on other sites

Hello,

 

Please Help! The Bold Feature of the Category /Sub Category Text is not working. The Active Category or Sub Category should be in Bold Letter.

 

 

Any help is highly appreciated.

 

 

fgwapo

 

 

 

 

 

 

 

 

 

 

 

contribution link

 

Hi!

 

I?d like to add this mod to my site but my catalog/includes/boxes/categories.php page modified many times so its content is far from the original one.

 

Can somebody make a step by step install guide and post here how to integrate this mod into the existing categories.php page?

Cheers,

 

Andrew

Share this post


Link to post
Share on other sites

Hi,

 

really a nice contrib, also for seo purposes. But there is one problem I cannot fix: The width of the category box does not match with the box title when visiting the website in the internet explorer (it does in opera and firefox, but not in the ie) Can you tell me how to fix that?

Share this post


Link to post
Share on other sites

Hi ! :lol:

 

I 'm using this contribution and I have make a modification for using 3 levels (Catégorie, Sub-Catégorie and SubSubcatégorie ). :thumbsup:

 

Do you think it is obsolete to update the contribution for this ?

 

If someone want my code, I think we can use an infinite level possibilities :thumbsup: :lol: by using a while loop and array vars instead of solid vars like I have do. <_<

 

Let me know... :-"

Share this post


Link to post
Share on other sites
Hi ! :lol:

 

I 'm using this contribution and I have make a modification for using 3 levels (Catégorie, Sub-Catégorie and SubSubcatégorie ). :thumbsup:

 

Do you think it is obsolete to update the contribution for this ?

 

If someone want my code, I think we can use an infinite level possibilities :thumbsup: :lol: by using a while loop and array vars instead of solid vars like I have do. <_<

 

Let me know... :-"

 

And now, if you click a product without pass by categories searching (click on special or new for this month or also purchached...) it corresponding catégoris and sub, and subsub etc... is automatily highlighted.

Share this post


Link to post
Share on other sites

Hi,

I have the main_categories contribution installed, and when i try to replace my categories box with the one from this contribution, i recieve the following error:

Fatal error: Cannot redeclare preorder() (previously declared in /home/mysite/public_html/includes/boxes/categories.php:17) in /home/mysite/public_html/includes/modules/main_categories.php on line 68

any ideas on how to solve this error?

Thanks.

Edited by altenter

Share this post


Link to post
Share on other sites
Hi ! laugh.gif

 

I 'm using this contribution and I have make a modification for using 3 levels (Catégorie, Sub-Catégorie and SubSubcatégorie ). thumbsup.gif

 

Do you think it is obsolete to update the contribution for this ?

 

If someone want my code, I think we can use an infinite level possibilities thumbsup.gif laugh.gif by using a while loop and array vars instead of solid vars like I have do. dry.gif

 

Let me know... whistling.gif

 

 

I want the code :D

Plaese


Cumparaturi4all

Share this post


Link to post
Share on other sites

Does anybody know how to add a line between the categories. This has no result:

 

$categories_string .= '<br><hr align=center size=1 width=100% color=000080>';

Share this post


Link to post
Share on other sites
Hi,

I have the main_categories contribution installed, and when i try to replace my categories box with the one from this contribution, i recieve the following error:

----

Fatal error: Cannot redeclare preorder() (previously declared in /home/mysite/public_html/includes/boxes/categories.php:17) in /home/mysite/public_html/includes/modules/main_categories.php on line 68

-----

any ideas on how to solve this error?

Thanks.

 

 

 

change lines 53 to 61 from

 

      } */
// Function used for post November 2002 snapshots
 function tep_show_category($counter) {
   global $foo, $categories_string, $id;

   for ($a=0; $a<$foo[$counter]['level']; $a++) {
     $categories_string .= "  ";
   }
   }

 

To

 

      } 
// Function used for post November 2002 snapshots
 function tep_show_category($counter) {
   global $foo, $categories_string, $id;

   for ($a=0; $a<$foo[$counter]['level']; $a++) {
     $categories_string .= "  ";
   }*/
   }

 

 

Basically you are just commenting out the function tep_show_category

Edited by cigarsforless

Jim Bullen - President

The Cigar Hut Group of Companies

 

 

Installed add-ons: (that now need to be upgraded to OSC CE Phoenix)

PWA, MVS, Easy Populate, Dynamic Sitemap, Featured Products, MVS Order Editor, MVS Shipping Estimator, Google XML Sitemap, About Us, Ad Tracker, Address Enhancer, Also Purchased, Backorders, Category Descriptions, Dynamic Meta Tags, Contact Us Email Subjects, Country state Selector, Extra Address Line, Order Number in Email Subject, OSC Affiliate, Product Extra Fields, Review Approval System, Reviews in Product Display, Sold Out, Sold Out (but Displayed), Ultimate SEO URL's, Updated Spiders, Welcome Email Password, Pending Order Email, Who's Online Enhancement, CCGV, Easy Discounts, Customer Comments, Request a Review, Sales Report, plus many many more!

Share this post


Link to post
Share on other sites

Hi there everyone.

 

Firstly, let me say this is a great contribution and really helps to make the category menu more functional and attractive.

 

Unfortunately, I think I've run into a bug which has caused me to uninstall this contribution. Hopefully someone will be able to figure out if it is a bug and how to fix it.

 

Suspected Bug Overview:

 

If I have 2 categories (each with their own products and subcategories):

cPath=1

cPath=2

And if I have 2 subcategories in each of the above categories

cPath=1_11

cPath=1_12

cPath=2_21

cPath=2_22

Everything works fine as long as I come into the cart at the top level (index.php). It also works fine if I come in to the cart at the top of a category (index.php?cPath=1).

 

But as soon as I click into a subcategory (such as index.php?cPath=1_11 or index.php?cPath=2_21) all of the other links in the menu pick up the cPath of whatever subcategory I'm in and then also add the corresponding cPath for their own category.

 

So in this case, all of my links will now point to index.php?cPath=1_11_1 or index.php?cPath=1_11_2, which are nonexistent.

 

As a result, it becomes impossible to get back to index.php?cPath=1 using the categories menu.

 

My php skills are not sufficient to figure out where this incorrect "residual" cPath info is being inserted. But I'm hoping someone here will be able to see it. I won't bother posting the code from the contribution's categories.php for reference, but I have used it straight "out-of-the-box" without modifying it at all.

 

Thanks in advance for anyone who can help. I'd love to get this working on my site.

Share this post


Link to post
Share on other sites

Hi again,

 

It's been a couple of weeks since I posted this and I've even sent PMs to previous posters and the MOD originators, but no one has responded.

 

Is there anyone who can shed some light on this? I'd really like to improve the appearance of our menu and this mod is perfect, except for this bug.

 

Hoping to hear from someone,

Jade

Share this post


Link to post
Share on other sites
Hi ! :lol:

 

I 'm using this contribution and I have make a modification for using 3 levels (Catégorie, Sub-Catégorie and SubSubcatégorie ). :thumbsup:

 

Do you think it is obsolete to update the contribution for this ?

 

If someone want my code, I think we can use an infinite level possibilities :thumbsup: :lol: by using a while loop and array vars instead of solid vars like I have do. <_<

 

Let me know... :-"

 

 

Can u tell me how u did whit the 3 lvl`s ? i dident see u on long time, would need urgent help on this :)

Take care

Share this post


Link to post
Share on other sites

Installed it with no problems but it doesn't place <br> between sub-categories and after categories, they are all in line like

Category Sub-category1 Sub-category2 ...

 

It is also highlight a < > between sub-categories

 

It would be greate if can be fiexed

Sergei

Share this post


Link to post
Share on other sites
Hi there everyone.

 

Firstly, let me say this is a great contribution and really helps to make the category menu more functional and attractive.

 

Unfortunately, I think I've run into a bug which has caused me to uninstall this contribution. Hopefully someone will be able to figure out if it is a bug and how to fix it.

 

Suspected Bug Overview:

 

If I have 2 categories (each with their own products and subcategories):

cPath=1

cPath=2

And if I have 2 subcategories in each of the above categories

cPath=1_11

cPath=1_12

cPath=2_21

cPath=2_22

Everything works fine as long as I come into the cart at the top level (index.php). It also works fine if I come in to the cart at the top of a category (index.php?cPath=1).

 

But as soon as I click into a subcategory (such as index.php?cPath=1_11 or index.php?cPath=2_21) all of the other links in the menu pick up the cPath of whatever subcategory I'm in and then also add the corresponding cPath for their own category.

 

So in this case, all of my links will now point to index.php?cPath=1_11_1 or index.php?cPath=1_11_2, which are nonexistent.

 

As a result, it becomes impossible to get back to index.php?cPath=1 using the categories menu.

 

My php skills are not sufficient to figure out where this incorrect "residual" cPath info is being inserted. But I'm hoping someone here will be able to see it. I won't bother posting the code from the contribution's categories.php for reference, but I have used it straight "out-of-the-box" without modifying it at all.

 

Thanks in advance for anyone who can help. I'd love to get this working on my site.

 

any one got a fix for this? i'm having big problems with ultimate SEO.

 

Thanks

Share this post


Link to post
Share on other sites

Hello,

I have install it on my developpement store but i have too many sub category. How can i change it to show only the category and if someone click on category show the sub category.

Would you help me please to make this mod.

Thanks in advance.

 

Bruno

Share this post


Link to post
Share on other sites
Hello,

I have install it on my developpement store but i have too many sub category. How can i change it to show only the category and if someone click on category show the sub category.

Would you help me please to make this mod.

Thanks in advance.

 

Bruno

this contribution is not very good with sub category especially if you use ultimate SEO

Share this post


Link to post
Share on other sites
this contribution is not very good with sub category especially if you use ultimate SEO

Thanks for your reply i have no matter with Ultimate SEO, i just want hide the sub category and if someone click on categorie show the sub category like an original menu of oscommerce.

I think i have to declare these "global $tree, $categories_string, $cPath_array;" in function preorder

And then change the code on these line

while ($categories = tep_db_fetch_array($categories_query)) {
  if ($categories['parent_id'] == 0) 
  {
           $temp_cPath_array = $cPath_array;  //Johan's solution - kill the array but save it for the rest of the site
        unset($cPath_array);

           $cPath_new = tep_get_path($categories['categories_id']);

        $text_subcategories = '';
    $subcategories_query = tep_db_query($query);
    while ($subcategories = tep_db_fetch_array($subcategories_query)) 
        {

               if ($subcategories['parent_id'] == $categories['categories_id'])
               {

 

I put the code of catalog\includes\boxes\categories of this contrib if someone can help me it will be nice

<?php
/*
 $Id: show_subcategories.php,v 1.0 2003/01/08 10:37:00 Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com/"]http://www.oscommerce.com/[/url]

 Based on: main_categories.php Ver. 1.0 by Gustavo Barreto

 History: 1.0 Creation

 Released under the GNU General Public License

*/

// Preorder tree traversal
 function preorder($cid, $level, $foo, $cpath)
 {
   global $categories_string, $HTTP_GET_VARS;

// Display link
   if ($cid != 0) {
     for ($i=0; $i<$level; $i++)
       $categories_string .=  '  ';
     $categories_string .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath
=' . $cpath . $cid) . '">';

// 1.6 Are we on the "path" to selected category?
     $bold = strstr($HTTP_GET_VARS['cPath'], $cpath . $cid . '_') ||  $HTTP_GET_VARS['cPath'] == $cpath . $cid;
// 1.6 If yes, use <b>
     if ($bold)
       $categories_string .=  '<b>';
     $categories_string .=  $foo[$cid]['name'];
     if ($bold)
       $categories_string .=  '</b>';
     $categories_string .=  '</a>';
// 1.4 SHOW_COUNTS is 'true' or 'false', not true or false
     if (SHOW_COUNTS == 'true') {
       $products_in_category = tep_count_products_in_category($cid);
       if ($products_in_category > 0) {
         $categories_string .= ' (' . $products_in_category . ')';
       }
     }
     $categories_string .= '<br>';
   }

// Traverse category tree- this is for older snapshots pre-November 2002
/*    foreach ($foo as $key => $value) {
     if ($foo[$key]['parent'] == $cid) {
//        print "$key, $level, $cid, $cpath<br>";
       preorder($key, $level+1, $foo, ($level != 0 ? $cpath . $cid . '_' : ''))
;
     } */
// Function used for post November 2002 snapshots
 function tep_show_category($counter) {
   global $foo, $categories_string, $id;

   for ($a=0; $a<$foo[$counter]['level']; $a++) {
     $categories_string .= "  ";
   }
   }
 }

?>
<!-- show_subcategories //-->
         <tr>
           <td class="infoBox_left">

<?php

//////////
// Display box heading
//////////
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'left', 'text'  => BOX_HEADING_CATEGORIES);
 new infoBoxHeading($info_box_contents, true, false, false, true);

//////////
// Get categories list
//////////
// 1.2 Test for presence of status field for compatibility with older versions
//  $status = tep_db_num_rows(tep_db_query('describe categories status')); used for older snapshots
$status = tep_db_num_rows(tep_db_query('describe ' .  TABLE_CATEGORIES . ' status'));


 $query = "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image
           from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
           where c.categories_id = cd.categories_id";
// 1.3 Can't have 'where' in an if statement!
 if ($status >0)
   $query.= " and c.status = '1'";
 $query.= " and cd.language_id='" . $languages_id ."'
           order by sort_order, cd.categories_name";

 $categories_query = tep_db_query($query);


// Initiate tree traverse
 $categories_string = '';
 preorder(0, 0, $foo, '');

//////////
// Display box contents
//////////
 $info_box_contents = array();
 $row = 0;
 $col = 0;
 while ($categories = tep_db_fetch_array($categories_query)) {
  if ($categories['parent_id'] == 0) 
  {
           $temp_cPath_array = $cPath_array;  //Johan's solution - kill the array but save it for the rest of the site
        unset($cPath_array);

           $cPath_new = tep_get_path($categories['categories_id']);

        $text_subcategories = '';
    $subcategories_query = tep_db_query($query);
    while ($subcategories = tep_db_fetch_array($subcategories_query)) 
        {

               if ($subcategories['parent_id'] == $categories['categories_id'])
               {

                                       $cPath_new_sub = "cPath="  . $categories['categories_id'] . "_" . $subcategories['categories_id'];

                   $text_subcategories .= '' . '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new_sub, 'NONSSL') . '" class="menusubcateg">' . '   ' . tep_image(DIR_WS_IMAGES . 'pointer_blue_light.gif', '') . $subcategories['categories_name'] . '</a>' . " ";
               } // if
    } // While Interno
   $info_box_contents[$row] = array('align' => 'left',
                                          'params' => 'class="smallText" width="125" valign="top"',
                                          'text' => '' . '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new, 'NONSSL') . '" class="menucateg"><b>' . ' ' . tep_image(DIR_WS_IMAGES . 'pointer_blue.gif', '') . $categories['categories_name'] . '</b></a>' . $text_subcategories);
   $col ++;
   if ($col > 0) 
       {
               $col = 0;
               $row ++;
   }
   $cPath_array = $temp_cPath_array; //Re-enable the array for the rest of the code
  }
 }
 new infoBox($info_box_contents, true);


?>
           </td>
         </tr>
<!-- show_subcategories_eof //-->

The demo of this contrib http://www.oscommerce-demo.com/demo01/

Thanks in advance

Share this post


Link to post
Share on other sites

Did anyone ever figure out how to get this to work three levels down? I sent a message to the guy who said he had done it, but he hasn't been around for several months and I don't know if he's checking his messages. It would be great to get this working for multiple levels of sub-categories.

Share this post


Link to post
Share on other sites

I've install this contribution using the included categories.php file unaltered. The first sub-category under a root category is not starting on a new line, which causing the whole box to have crazy formatting. Has anyone else seen this?

Share this post


Link to post
Share on other sites
I've install this contribution using the included categories.php file unaltered. The first sub-category under a root category is not starting on a new line, which causing the whole box to have crazy formatting. Has anyone else seen this?

 

After looking at it in a little more detail, it would appear that the whole sub-category tree is one long text string instead of each sub-category starting on a new row. Is no one else seeing this?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×