Jump to content
Sign in to follow this  
jcall

[Contribution] More Category Boxes

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

 

-jared

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

Mark, I installed it last night, was rather quick, just half an hour.

 

What I would like to ask the experts, where can I turn off the category miniimages?

 

Thanks for advice.

Joe

Share this post


Link to post
Share on other sites

Hi Joe,

 

I think you may have installed the version by alfher, I am not too sure but you could try commenting out these lines.

 

// CategoryBox Enhancement
if (tep_has_category_subcategories($counter, 'image')) {
  $categories_string .= tep_image(DIR_WS_IMAGES . $tree[$counter]['image'], $tree[$counter]['name'], '30', '30');
}
else {
  $categories_string .= tep_image(DIR_WS_IMAGES . $tree[$counter]['image'], $tree[$counter]['name'], '30', '30');
}
if (isset($cPath_array) && in_array($counter, $cPath_array)) {
  $categories_string .= '</b>';
}	
// CategoryBox Enhancement

 

Mark


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

Share this post


Link to post
Share on other sites

Thanks Mark, that was the point.

 

For those having the same question.

Search in the file catalog/includes/boxes/more_categories.php from line 34.

 

Joe

Share this post


Link to post
Share on other sites

How can I get a menu category system like www.countrysupplies.com where the categories are in one box and seperated by a colourd title bar.

 

Also can i make sub categories stay on main page in the middle when a top level category is clicked on the left menu.

Share this post


Link to post
Share on other sites

Mark, have you tried my instructions that I posted earlier? You can remove the spacing above and below the infoboxes that way. You then edit the stylesheet.css to make the infoboxheading a different color.

 

-jared

Share this post


Link to post
Share on other sites

Hi not yet no as i need to sort it out if it will make it like the link i wnat but it wont will it as my box has curved edges so you will have no spaces but indents on the side of the category box where they have had the space removed, the menu on the one i linked too has no spaces , if i add multiple boxes and remove space you will be able to tell wont you as my category box has curved corners?

Share this post


Link to post
Share on other sites

Hi all,

 

I installed the "More Category Boxes With images" contribution.

But I think the Category Boxes With images look not good.

 

How can I remove the images?

 

Thanks in advance :)

Share this post


Link to post
Share on other sites

I tried to replace the there files with "More Category Boxes" contribution:

 

admin/more_categories.php

admin/includes/languages/english/more_categories.php

includes/boxes/more_categories.php

 

 

But after that, this images become X... :blink:

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  

×