Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] More Category Boxes


Guest

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

Link to comment
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

Link to comment
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
Link to comment
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

Link to comment
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.

Link to comment
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!

Link to comment
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.

Link to comment
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

Link to comment
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?

Link to comment
Share on other sites

  • 4 weeks later...

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 :)

Link to comment
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:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...