Jump to content



Latest News: (loading..)

* * * * * 1 votes

[Contribution] More Category Boxes


  • Please log in to reply
291 replies to this topic

#41   kikoleppard

kikoleppard
  • Members
  • 25 posts
  • Real Name:Kiril Nedelchev
  • Location:Plovdiv - Bulgaria

Posted 10 September 2005 - 02:28 PM

Hi Jcall,

Looks  a great contribution and thanks for your hard work.  

However to test it I've installed on a clean osCommerce MS2 and everything works great except
the

Quote

red lighting from class="errorText"
for Categories ( the code is from Category Box Enhancement).

It's a small thing but i can't find where is the problem.
I have disactivated the standard category box, looked in the code,  changed the styles - always is the  the same thing.  The color of the Categories remain always black.

I surely omit something.

Thanks in advance and best regards.
My Contributions:


New Attributes Manager+Sort v1.0
http://www.oscommerce.com/community/contributions,3301/
Bulgarian Language Total Pack
http://www.oscommerce.com/community/contributions,3261/

#42   kikoleppard

kikoleppard
  • Members
  • 25 posts
  • Real Name:Kiril Nedelchev
  • Location:Plovdiv - Bulgaria

Posted 14 September 2005 - 02:42 PM

Nobody has found a similar problem?

It doesn't matter if I change the code with pure HTML - the categories lighting always remain the same - standard black.

???

Best regards
My Contributions:


New Attributes Manager+Sort v1.0
http://www.oscommerce.com/community/contributions,3301/
Bulgarian Language Total Pack
http://www.oscommerce.com/community/contributions,3261/

#43   jcall

jcall
  • Members
  • 3,092 posts
  • Real Name:Jared Call
  • Gender:Male
  • Location:Saratoga Springs, UT

Posted 14 September 2005 - 06:50 PM

I'm sorry, Kiril - - I've seen this problem before, but just not had time to chase it down.  I'll see if I can get it addressed in the next few days.

Feel free to hassle me if I'm taking too long.

-jared

#44   kikoleppard

kikoleppard
  • Members
  • 25 posts
  • Real Name:Kiril Nedelchev
  • Location:Plovdiv - Bulgaria

Posted 15 September 2005 - 03:49 AM

jcall, on Sep 14 2005, 07:50 PM, said:

I'm sorry, Kiril - - I've seen this problem before, but just not had time to chase it down.  I'll see if I can get it addressed in the next few days.

Feel free to hassle me if I'm taking too long.

-jared

<{POST_SNAPBACK}>


Hi Jared,

first of all thanks for the respone.

Well i found a some kind of solution but  it isn't the best variant.

// commented for CategoryBox Enhancement      $categories_string .= '<b>' . $tree[$counter]['name'] . '</b>';
      $categories_string .= '<b>';
      
// CategoryBox Enhancement  
      if ($cat_name == $tree[$counter]['name']) {
        $categories_string .= '<span class="errorText">';
         }
// CategoryBox Enhancement  
      
      $categories_string .= $tree[$counter]['name'];

// CategoryBox Enhancement        
  if ($cat_name == $tree[$counter]['name']) {
 	 $categories_string .= '</span>';
           }
// CategoryBox Enhancement      

      $categories_string .= '</b>';
     }

    else
    {
// CategoryBox Enhancement  
      if ($cat_name == $tree[$counter]['name']) {
        $categories_string .= '<b><span class="errorText">';
         }
// CategoryBox Enhancement  

      $categories_string .= $tree[$counter]['name'];
      
// CategoryBox Enhancement        
  if ($cat_name == $tree[$counter]['name']) {
 	 $categories_string .= '</span></b>';
           }
// CategoryBox Enhancement  

I've changed to this:

// commented for CategoryBox Enhancement      $categories_string .= '<b>' . $tree[$counter]['name'] . '</b>';
      $categories_string .= '<b><font color="red">';
      
// CategoryBox Enhancement  
      if ($cat_name == $tree[$counter]['name']) {
        $categories_string .= '<span>';
         }
// CategoryBox Enhancement  
      
      $categories_string .= $tree[$counter]['name'];

// CategoryBox Enhancement        
  if ($cat_name == $tree[$counter]['name']) {
 	 $categories_string .= '</span>';
           }
// CategoryBox Enhancement      

      $categories_string .= '</font></b>';
     }

    else
    {
// CategoryBox Enhancement  
      if ($cat_name == $tree[$counter]['name']) {
        $categories_string .= '<b><font color="red">';
         }
// CategoryBox Enhancement  

      $categories_string .= $tree[$counter]['name'];
      
// CategoryBox Enhancement        
  if ($cat_name == $tree[$counter]['name']) {
 	 $categories_string .= '</font></b>';
           }
// CategoryBox Enhancement    

In this mode the Redlighting works but the Main Category remain red too when you go in some SubCategory.

For me it's better than first.
I'm still don't understand why exist this STYLES dependence from  the standard Category infobox.

Best regards.
My Contributions:


New Attributes Manager+Sort v1.0
http://www.oscommerce.com/community/contributions,3301/
Bulgarian Language Total Pack
http://www.oscommerce.com/community/contributions,3261/

#45   mark27uk3

mark27uk3
  • Members
  • 1,547 posts
  • Real Name:Mark
  • Gender:Male
  • Location:24-7 Mobile Accessories

Posted 20 September 2005 - 05:49 PM

Hi Jared,

I am well pleased with this contrib!

However I do have one little problem. I have changed the infobox header to an image using this code

    $info_box_contents = array();
    $info_box_contents[] = array('text' => new_tep_show_category($boxId,$cPath_array,$tree,$first_element));

    new infoBox($info_box_contents);
  }

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

<TABLE WIDTH=162 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
  <TD COLSPAN=3>
 	 <IMG SRC="images/boxes/table_simfree.gif" WIDTH=162 HEIGHT=25></TD>
	</TR>
<?php

  $_infoBox = array();

//  define('TABLE_CATEGORIES_MORE','categories_more');

  $categories_this_infobox_query = tep_db_query("select * from " . TABLE_CATEGORIES_MORE . " where enabled = 1");

  while ($_categories = tep_db_fetch_array($categories_this_infobox_query))

and I have closed all the tables etc at the bottom of the file, the problem is that when the category box is disabled the header image still shows.

I presume this has something to with the way it is called in column_left.

Can you shed me some light on how to correct this so that when the box is disabled so is the header.

You can see an example here

Thanks
Mark
Lifes a bitch, then you marry one, then you die!

#46   mark27uk3

mark27uk3
  • Members
  • 1,547 posts
  • Real Name:Mark
  • Gender:Male
  • Location:24-7 Mobile Accessories

Posted 21 September 2005 - 10:00 AM

As well as my problem above, is there anyway to stop the categories shown in the more_categories box showing in the regular categories box apart from using an earlier suggestion in this thread about making all category boxes more_categories and removing the regular box.

I hope that made sense!

Thanks

Mark
Lifes a bitch, then you marry one, then you die!

#47   jcall

jcall
  • Members
  • 3,092 posts
  • Real Name:Jared Call
  • Gender:Male
  • Location:Saratoga Springs, UT

Posted 22 September 2005 - 04:45 AM

Mark,

Regarding the image:  enclose your HTML code that calls the image in this:
<?php if (DEFAULT_CATEGORY_BOX_ENABLED == 'true') 
{
?>

 <insert code that calls your header image>

<?php 
}
?>

Regarding putting constraints on the "regular" categories infobox:  Just disable it. Admin >> Configuration >> More Categories.   You can simply create a new categories box, with the title you want, with the categories inside it that you want.



Cleve (and others) who would like to disable the ?infoBox=x in the URL:  In includes/boxes/more_categories.php, change this:
    $categories_string .= tep_href_link(FILENAME_DEFAULT, 'infoBox=' . $boxId . '&' . $cPath_new) . '">';
to this:
 
//    $categories_string .= tep_href_link(FILENAME_DEFAULT, 'infoBox=' . $boxId . '&' . $cPath_new) . '">';
    $categories_string .= tep_href_link(FILENAME_DEFAULT, '&' . $cPath_new) . '">';


NOTE:  The purpose of the ?infoBox= variable in the URL is so that if you list the same item in several of the more_categories infoboxes, the code knows in which box to expand to the subcategories (if any).  If you don't need to display the same data in several boxes, then you can use the code change above.

Now that I think about it, it may be more common to NOT list a category in 2 boxes.  If you agree, then I'll change the default behavior to work as above, and document the change in the readme (for those who want/need to change it back).  

What say ye?

-jared

P.S.  On my medium-long term list of things to do is add header image functionality to this contrib.  In other words, I want to be able to specify a header image (that you've created) for each infobox.  Whaddya think?

Edited by jcall, 22 September 2005 - 04:46 AM.


#48   mark27uk3

mark27uk3
  • Members
  • 1,547 posts
  • Real Name:Mark
  • Gender:Male
  • Location:24-7 Mobile Accessories

Posted 22 September 2005 - 07:06 AM

Quote

Regarding the image: enclose your HTML code that calls the image in this:
CODE
<?php if (DEFAULT_CATEGORY_BOX_ENABLED == 'true')
{
?>

<insert code that calls your header image>

<?php
}
?>

Hi Jared,

Thanks for your time, I will try the above code.

Quote

Regarding putting constraints on the "regular" categories infobox: Just disable it. Admin >> Configuration >> More Categories. You can simply create a new categories box, with the title you want, with the categories inside it that you want.

The only problem I will have if I disable the original categories box and use the more_categories instead is that I have different images for the the headers of the boxes.

Any way around this?

Thanks

Mark
Lifes a bitch, then you marry one, then you die!

#49   gty

gty
  • Members
  • 67 posts
  • Real Name:Chad

Posted 23 September 2005 - 07:15 AM

how do you get the catagories show the sub catagories wih out clicking it?

#50   mark27uk3

mark27uk3
  • Members
  • 1,547 posts
  • Real Name:Mark
  • Gender:Male
  • Location:24-7 Mobile Accessories

Posted 23 September 2005 - 09:40 PM

Hi,

I am hoping for a bit of help as I am now quite lost!

I am trying to acheive different header images for different boxes, I have tried to use the code from the array to acheive this but I either end up with all boxes with the same header image or no images at all.

This is the code from the array

    $_infoBox[] = array(
      'categories' => array(
        $_categories['category1_id'],
        $_categories['category2_id'],
        $_categories['category3_id'],
        $_categories['category4_id'],
        $_categories['category5_id'],
        $_categories['category6_id'],
        $_categories['category7_id'],
        $_categories['category8_id'],
        $_categories['category9_id'],
        $_categories['category10_id'],
        $_categories['category11_id'],
        $_categories['category12_id'],
        $_categories['category13_id'],
        $_categories['category14_id'],
        $_categories['category15_id'],
        $_categories['category16_id'],
        $_categories['category17_id'],
        $_categories['category18_id'],
        $_categories['category19_id'],
        $_categories['category20_id'],
        $_categories['category21_id'],
        $_categories['category22_id'],
        $_categories['category23_id'],
        $_categories['category24_id'],
        $_categories['category25_id'],
      ),
      'name'    => $_categories['infobox_name'],
      'enabled' => $_categories['enabled']
    );

and this is the code I have so far (minus my feable attempts at filling the if statement)

<table width=162 border=0 cellpadding=0 cellspacing=0>
<?php
   if (*********************) {
?>
         <tr>
            <td>
               <table width=162 border=0 cellpadding=0 cellspacing=0>
             <tr>
          <td colspan=3>
           <img src="images/boxes/table_simfree.gif" width=162 height=18></td>
     </tr>
<?php
   }elseif (*********************) {

?>
          <tr>
            <td>
               <table width=162 border=0 cellpadding=0 cellspacing=0>
            <tr>
        <td colspan=3>
          <img src="images/boxes/table_categories.gif" width=162 height=25></td>
     </tr>
<?php
   }elseif (********************) {

?>
          <tr>
            <td>
               <table width=162 border=0 cellpadding=0 cellspacing=0>
            <tr>
        <td colspan=3>
         <img src="images/boxes/table_unlock.gif" width=162 height=25></td>
     </td>

<?php
}
?>
</table></td></tr>

If anyone could help with this then it would help me a great deal and save me lots of hair!

Thanks

Mark
Lifes a bitch, then you marry one, then you die!

#51   Mark-UK

Mark-UK
  • Members
  • 489 posts
  • Real Name:Mark

Posted 27 September 2005 - 10:19 PM

Is this working ok now, really after something like this, i want to.

OK so at the moment my sites top level categories is like this.


fishing equipment
fishing clothing
outdoor wear
outdoor equipment
womens clothing

Now how can I make it so the different arease are seperated by a header with that sections topic, so it would be like this.

FISHING EQUIPMENT (this would be in a coloured bar)and non clickable text
fishing equipment
fishing clothing
OUTDOOR PURSUITS (this would be in a coloured bar)and non clickable text
outdoor clothing
outdoor equipment
WOMANS CLOTHING (this would be in a coloured bar)and non clickable text
horse riding
general clothing
footwear

So rather then have all top level categories underneath each other the different industries are seperated by a header bar coloured with the type of sport or industry in in text on it as a title.

Can I do this

thanks

#52   mark27uk3

mark27uk3
  • Members
  • 1,547 posts
  • Real Name:Mark
  • Gender:Male
  • Location:24-7 Mobile Accessories

Posted 27 September 2005 - 10:29 PM

Hi,

Do you mean like like this?

Mark
Lifes a bitch, then you marry one, then you die!

#53   Mark-UK

Mark-UK
  • Members
  • 489 posts
  • Real Name:Mark

Posted 27 September 2005 - 10:32 PM

Yes possibly, if you wanted could you get the categories to hav sub categories too just out of interest, how did you get that.

thanks

#54   jcall

jcall
  • Members
  • 3,092 posts
  • Real Name:Jared Call
  • Gender:Male
  • Location:Saratoga Springs, UT

Posted 28 September 2005 - 07:36 AM

View Postmark27uk3, on Sep 23 2005, 03:40 PM, said:

I am trying to acheive different header images for different boxes, I have tried to use the code from the array to acheive this but I either end up with all boxes with the same header image or no images at all.

Step 1:
  Let's just make sure that we can get different images for each box.  To simplify things at this stage, let's assume that the images will reside in the /images directory, and that the images are named the same as the box title.  In other words, the box image for box1 will be named box1.gif, and reside at http://yourdomain.com/images/box1.gif.  The box image for nextbox would be named nextbox.gif.

In includes/boxes/more_categories.php, find this:
  function tep_categories_box($boxId,&$infoBox,$follow_cPath,&$cPath_array)
  {
	global $languages_id;

	$info_box_contents = array();
	$info_box_contents[] = array('text' => $infoBox['name']);

and add one line to the end, so that it reads like this:
  function tep_categories_box($boxId,&$infoBox,$follow_cPath,&$cPath_array)
  {
	global $languages_id;

	$info_box_contents = array();
	$info_box_contents[] = array('text' => $infoBox['name']);

	echo '<img src="/images/' . $infoBox['name'] . '.gif">';

Save that and upload it.  Refresh your shop page in your browser.  Assuming you have the correct .gif files in the /images directory, you now have an image just above each More Categories infobox.

Step 2:
  Now, since you are much better graphic artists than I, and have created header graphics that replace the functionality of the infobox header anyway, remove the line (immediately after the code we edited above) that says:
new infoBoxHeading($info_box_contents, false, false);
or
new infoBoxHeading($info_box_contents, true, false);
.  Upload and refresh.

Viola!  You now have unique header images for each more_categories infobox (assuming that you're one of the graphic artists I alluded to earlier, or that you know one)!

The next step would be to store each category box image name in the database (extending the existing table definition by one field), and reference it directly, instead of assuming that not only the image name is the same as the box name, but that the image is a .gif.

Any takers?  I'm happy to do it, but have been REALLY busy lately.  The solution posted here is just a hack, really, and ought to be done properly by putting it into the database.  On second thought, the hack is fine.  The whole contrib is a hack anyway, so why not?   :D

-jared

#55   Mark-UK

Mark-UK
  • Members
  • 489 posts
  • Real Name:Mark

Posted 29 September 2005 - 03:59 PM

Do the top level categories still open up to sub level categories when using this contribution or can you ONLY have top level categories that dont expand.

#56   jcall

jcall
  • Members
  • 3,092 posts
  • Real Name:Jared Call
  • Gender:Male
  • Location:Saratoga Springs, UT

Posted 29 September 2005 - 04:08 PM

You can use it with subcategories, but you cannot assign a subcategory a box of its own.

-jared

#57   Mark-UK

Mark-UK
  • Members
  • 489 posts
  • Real Name:Mark

Posted 29 September 2005 - 04:12 PM

OK cool cheers, any new examples of sites with this working please thanks. I want categories like www.countrysupplies.com, seperated by headers , dont really want seperate boxes for each industry i have  but 1 continuos box with the different areas seperated by header in colour with title of that industry in it then clickable categories below.

whats best way to do this please. dont want text header to be clickable link either.

any ideas please.

Edited by Mark-UK, 29 September 2005 - 04:14 PM.


#58   jcall

jcall
  • Members
  • 3,092 posts
  • Real Name:Jared Call
  • Gender:Male
  • Location:Saratoga Springs, UT

Posted 29 September 2005 - 04:30 PM

Mark, I'll PM you the URL to another site where I can give you an example.

To remove the spacing between the infoboxes, to make them look like just one box, you can edit more_categories.php to change this:
	echo "<tr>\n<td>\n";

	tep_categories_box(
	  $i,
	  $_infoBox[$i],
	  ($infoBox == $i && tep_not_null($cPath)) ? true : false,
	  $cPath_array
	);

	echo "\n</td>\n</tr>\n";

to this:
//	echo "<tr>\n<td>\n";

	tep_categories_box(
	  $i,
	  $_infoBox[$i],
	  ($infoBox == $i && tep_not_null($cPath)) ? true : false,
	  $cPath_array
	);

//	echo "\n</td>\n</tr>\n";

That should do it.

Remember that after you've installed this (which is not hard, BTW), it is not enabled by default. It does not change the *default* behavior of your store.  You can disable the "main" default categories box, but it's still enabled by default.  You can add up to 25 category boxes, but you have to enable each of them.

It's not as risky of an install as it might seem. (but back up anyway - -it's good standard practice)

-jared

#59   Mark-UK

Mark-UK
  • Members
  • 489 posts
  • Real Name:Mark

Posted 03 October 2005 - 02:14 PM

Cna i add this contribution  despite alreday having 10 top evel categories.

I mean can I add it then move the categtories i wnat to the boxes i want or do you have to start afresh and add categories again etc after instillation of this contribution.

#60   mark27uk3

mark27uk3
  • Members
  • 1,547 posts
  • Real Name:Mark
  • Gender:Male
  • Location:24-7 Mobile Accessories

Posted 03 October 2005 - 02:36 PM

You do not need to re-add your categories, they will show up in the drop down boxes in admin/more categories.

Mark
Lifes a bitch, then you marry one, then you die!