Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] More Category Boxes


Guest

Recommended Posts

Hi,

 

I have installed More Category Boxes on my web site.

 

Im trying to make this include the theme i have bougt for my site.

 

Tried to make it work, but dont get it all to work.

 

Here is the code for the original file that i want to implement sow that the design is right on the More Categoy Boxes script.

[/

<?php

/*

$Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

function tep_show_category($counter) {

global $tree, $categories_string, $cPath_array;

 

$categories_string .= '<tr><td class="infoBoxContents" height="18">';

 

if ($tree[$counter]['parent'] == 0) {

$categories_string .= tep_image(DIR_WS_IMAGES . 'theme/arrow.jpg') . '  ';

}

 

for ($i=0; $i<$tree[$counter]['level']; $i++) {

$categories_string .= "   ";

}

 

$categories_string .= '<a href="';

 

if ($tree[$counter]['parent'] == 0) {

$cPath_new = 'cPath=' . $counter;

} else {

$cPath_new = 'cPath=' . $tree[$counter]['path'];

}

 

$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '<b>';

}

 

// display category name

$categories_string .= $tree[$counter]['name'];

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '</b>';

}

 

 

$categories_string .= '</a>';

 

if (SHOW_COUNTS == 'true') {

$products_in_category = tep_count_products_in_category($counter);

if ($products_in_category > 0) {

$categories_string .= ' (' . $products_in_category . ')';

}

}

 

$categories_string .= '</td></tr><tr><td height="1" bgcolor="E5E4E4"></td></tr>';

 

if ($tree[$counter]['next_id'] != false) {

tep_show_category($tree[$counter]['next_id']);

}

}

?>

<!-- categories //-->

<tr>

<td><?php echo tep_image(DIR_WS_IMAGES . 'theme/box_top.jpg'); ?></td>

</tr>

<tr>

<td background="images/theme/box_bg.jpg">

 

<table width="90%" align="center" cellpadding="0" cellspacing="0">

<tr><td height="5"></td></tr>

<?php

$categories_string = '';

$tree = array();

 

$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'];

}

}

 

//------------------------

if (tep_not_null($cPath)) {

$new_path = '';

reset($cPath_array);

while (list($key, $value) = each($cPath_array)) {

unset($parent_id);

unset($first_id);

$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 = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

if (tep_db_num_rows($categories_query)) {

$new_path .= $value;

while ($row = tep_db_fetch_array($categories_query)) {

$tree[$row['categories_id']] = array('name' => $row['categories_name'],

'parent' => $row['parent_id'],

'level' => $key+1,

'path' => $new_path . '_' . $row['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $row['categories_id'];

}

 

$parent_id = $row['categories_id'];

 

if (!isset($first_id)) {

$first_id = $row['categories_id'];

}

 

$last_id = $row['categories_id'];

}

$tree[$last_id]['next_id'] = $tree[$value]['next_id'];

$tree[$value]['next_id'] = $first_id;

$new_path .= '_';

} else {

break;

}

}

}

tep_show_category($first_element);

 

echo $categories_string;

?>

</table></td>

</tr>

<tr>

<td><?php echo tep_image(DIR_WS_IMAGES . 'theme/box_bottom.jpg'); ?></td>

</tr>

<tr>

<td height="10"></td>

</tr>

<!-- categories_eof //-->

 

Hope somebody can help me :D

 

The script is just fantastic when you want seperate categories.

 

Thanks :thumbsup:

 

Best Regards

Thomas B

Link to comment
Share on other sites

  • 1 month later...

Hi.

 

The question was asked now several times in this thread. But there has never been an answer to it:

 

The category names of the boxes are only in ONE language (there's only one box in the admin menu for it).

How can you use is as multi-lingual? I mean that the category names OF THE BOXES show different names depending on the language you've chosen.

 

 

Cheers mates for your help :blush:

Link to comment
Share on other sites

  • 2 weeks later...

@jvdmaas - I haven't seen the problem with the tables being moved down, but if you use the Web Developer extension with Firefox you should be able to tell what's going on table-wise.

 

@kevinz - Look for this code near the end of includes/more_categories.php:

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

 

Add another one of those and it should do what you need. Modify it as needed for your desired look/feel.

 

@delpierras - Sorry, this contrib isn't yet multi-language capable.

 

-jared

Link to comment
Share on other sites

  • 4 weeks later...

Hi all!

 

Has any one managed to display dategory name in main content (in the product listing page) using the More Category Boxes contribution?. I don't have anything appearing there.

 

Actually, there is a contribution which does that (Display Category Name In Main Content), it is a simple line of code:

 

In /catalog/index.php, find this code (line 232 in clean osCommerce v2.2 MS)

 

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

 

and change to :

 

<td class="pageHeading"> <?php // hacked to display current category name in main content area! echo $tree[$current_category_id]['name']; ?>

 

But I did not managed to make it work with More Category Boxes.

 

Doublesam

 

 

Secondary question: would it be very difficult to have the box heading titles multilingual?

 

Thanks for the help.

Link to comment
Share on other sites

  • 4 weeks later...

hiya, have a quick question, is there a way to make each new category box a drop down? does anyone know of a contribution that will do this?

 

my client has a coin site, and has many subs, causing the load time to sometimes be too long, so i am looking for a mod where i can create seperate drop downs for each category

Link to comment
Share on other sites

  • 4 weeks later...

This is a very nice contribution! I got only one problem. I like to have a pulldown menu in the new category boxes. I tried and it works. But now I get an pull down menu of all the categories and not the one I had choosen to put in my new category boxes.

 

Does anyone got an solution?

 

I thought it will be a mix of those:

 

$info_box_contents = array();

-------------------------

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

 

and

 

$info_box_contents[] = array('form' => '<form action="' . tep_href_link(FILENAME_DEFAULT) . '" method="get">' . tep_hide_session_id(),

'align' => 'left',

'text' => tep_draw_pull_down_menu('cPath', tep_get_paths(array(array('id' => '', 'text' => PULL_DOWN_DEFAULT))), $cPath, 'onchange="this.form.submit();"')

);

 

 

---------------------

 

 

Thanks in advance

Edited by Simpel
Link to comment
Share on other sites

Hi there,

 

is there an easy way in which the display order of the categories can be changed? I currently have 3 and I wasnt to temporarily add a new on at the top.

 

Any ideas?

 

Cheers

 

Stubbsy

Link to comment
Share on other sites

  • 4 weeks later...

Hi Jared,

Great contrib.

I need one category box in the left column and one in the right column.

 

I can do that by enabling default "normal" category in the left and modifying "More Category Boxes" to column_right.php but then what is listed in the right box must also be in the left box - correct?

 

Is it possible to disable default category box and modify your code to assign category1 to left and category2 to right?

Or..

Is it possible to install 2 "More Category Boxes" and rename all instances of the second to more-categories2?

Or..

Any other way?

 

It is for two retail stores under one roof wanting to share a website but have it as seperate as possible.

Thanks for any suggestions.

-Tim

Link to comment
Share on other sites

  • 3 weeks later...

I need some help here.

 

I have just installed this at www.empireairsoft.com and its working great with firefox browser. However when you use internet exploror, every catagory has a red X next to it like an image is missing.

 

How do I fix this so it displays right in IE too.?

Link to comment
Share on other sites

Ok well, its calling for some images that it wasnt looking for before this mod.

 

It's looking for the fallowing:

 

catalog/images/arrw1_L.gif

catalog/images/arrw2_L.gif

 

Are these something that are suppose to be in with the contribution? Is there a way to disable it calling for them?

Link to comment
Share on other sites

  • 1 month later...

Hi there,

 

i'm trying to develop this a little and add title text to the link which is produced for the each category. I have been given a pointer on where to start, but cannot seem to get it working correctly.

 

Basically what I am trying to achieve is to add the name of the category as the title of the link. e.g. if my first category is called 'motocross gear' then the link would actually look like this

<a href="http://www.mysite.com/motocross-gear.html?infoBox=1" title="motocross gear">motocross gear</a>

 

Can anyone help?

 

Cheers

 

Dave

Link to comment
Share on other sites

  • 1 month later...

I've had this contrib installed for some time now.

Works a treat and installed and worked first time.

 

I have a new need now and as part of my research I searched here hoping I would find someone had already solved my query and I wouldn't have to re-invent the wheel.

 

Turns out the only reference was someone else asking the same question

 

 

Hi Jared,

Great contrib.

I need one category box in the left column and one in the right column.

 

I can do that by enabling default "normal" category in the left and modifying "More Category Boxes" to column_right.php but then what is listed in the right box must also be in the left box - correct?

 

Is it possible to disable default category box and modify your code to assign category1 to left and category2 to right?

Or..

Is it possible to install 2 "More Category Boxes" and rename all instances of the second to more-categories2?

Or..

Any other way?

 

It is for two retail stores under one roof wanting to share a website but have it as seperate as possible.

Thanks for any suggestions.

-Tim

 

Can anyone point me in the right direction?

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 1 month later...
Hi Jared,

 

Back again :blush:

 

I have installed ultimate SEO by chemo and am now having an issue with the "?infobox=0" being tagged onto the end of my .html urls. It probably is something I should ask on ultimate seo's as well but thought I'd query you first.

 

The other clash with the seo contrib is that all categories show in all boxes regardless of where I have them assigned in the admin. Not good :( :( I feel like crying. I *need* both contribs.

 

I'll search around both contribs to see if I can find where they seem to be rubbing eachother the wrong way.

 

Look forward to your thoughts.

Sheri

 

 

Hi Sheri,

 

it's a long time ago since you wrote this but....

 

did you solve the problem with Ultimate SEO and More Categories and get both to work.

 

Or is here anyone who did it right??

 

My problem is that the subcategories in a second box will not be shown if i click it. The subcategories in box1 do.

 

I replace in more_categories.php

 

$categories_string .= tep_href_link(FILENAME_DEFAULT, 'infoBox=' . $boxId . '&' . $cPath_new) . '">';

 

with

 

$categories_string .= tep_href_link(FILENAME_DEFAULT, '&' . $cPath_new) . '">';

 

the "?infobox=0" disappeared and my USEO Urls didn't change.

 

But after that the subcategories don't appear in box2.

When I don't change the a.m. code , it will work fine but the URLs change and that's not what we like.... :-(

 

I hope that someone can help me

 

greetings from Germany

 

Bernd

Link to comment
Share on other sites

  • 4 weeks later...

I have created 6 categories - 1, 2, 3, 4, 5, 6

001.jpg

In more categories have chosen box1 - 1, 2 and 3 category, and in box2 have chosen 4, 5 and 6 category

002.jpg

003.jpg

 

In the catalogue categories are displayed:

box1

1

2

3

 

box2

1 <--- WRONG, it should not be here!

4

5

6

004.jpg

 

All made under the instruction in a file readme.txt

Help me please

Link to comment
Share on other sites

from the readme:

 

"If you don't want cat-one to show up in that category box along with cat-three and cat-four, you MUST change ALL of the remaining slots in that infobox to either cat-three or cat-four."

 

so you shouldn't select cat 1 to be included in the Box 2 as you have it. you should set all the catergories for box 2 to 4,5, or 6

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