Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Categories Box Images (support)


241

Recommended Posts

What does it do:

 

This modification to the code allows the category and sub-category images to be used in the categories box.

If a category or sub-category has no image then the textual name is shown.

The code can be ammended to give both a category or sub-category image and textual name.

I have included some files that can be used as replacements, these files if used require to be renamed categories.php and would replace the file in catalog/includes/boxes/categories.php

 

categories_main_images.php -- This gives main category images only.

categories_main_images_text.php -- This gives main category images with text.

categories_main_sub_images.php -- This gives main category and sub-category images.

categories_main_sub_images_text.php -- This gives main category images with text and sub-category images with text.

 

If you use the contribution please leave feedback positive,negative,suggestions or codes to include.

 

*** Download the contribution from here: ***

 

Categories Box Images

Edited by 241

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

  • 1 month later...

Great Mod any hints on what to look for if the sub categories wont display if cache is enabled but then everything displays if cache is turned off.

 

Does this happen on stock ms2?

 

Regards and thanks

crshNbrn

crshNbrn living on the edge.....

Link to comment
Share on other sites

Great Mod any hints on what to look for if the sub categories wont display if cache is enabled but then everything displays if cache is turned off.

Does this happen on stock ms2?

 

Yes this happens with stock ms2 and therefore is not an issue brought about by use of this contribution.

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

  • 2 months later...

Great Mod. V. Useful. - much improves the look and feel of the site.

 

In your sample catagories screenshot.gif you can see that for each field the text on the right is vertically aligned to the bottom of the image on the left i.e.

 

IMAGE1

IMAGE1

IMAGE1 Text1

 

IMAGE2

IMAGE2

IMAGE2 Text2

 

 

I have implemented the mod successfully, but...

I'm looking to valign the text to the right hand side of the image centrally i.e.

 

IMAGE1

IMAGE1 Text1

IMAGE1

 

IMAGE2

IMAGE2 Text2

IMAGE2

 

I've tried valign in css and it doesn't shift it, so a bit stuck for the answer here.

 

Hope the above makes sense!!

 

Cheers,

G

 

:thumbsup:

 

 

What does it do:

 

This modification to the code allows the category and sub-category images to be used in the categories box.

If a category or sub-category has no image then the textual name is shown.

The code can be ammended to give both a category or sub-category image and textual name.

I have included some files that can be used as replacements, these files if used require to be renamed categories.php and would replace the file in catalog/includes/boxes/categories.php

 

categories_main_images.php -- This gives main category images only.

categories_main_images_text.php -- This gives main category images with text.

categories_main_sub_images.php -- This gives main category and sub-category images.

categories_main_sub_images_text.php -- This gives main category images with text and sub-category images with text.

 

If you use the contribution please leave feedback positive,negative,suggestions or codes to include.

 

*** Download the contribution from here: ***

 

Categories Box Images

Link to comment
Share on other sites

  • 3 weeks later...
I am trying to figure out how to make the text appear under the pics instead of beside them.  Then add an "enter" between that text and the next image.

 

Any suggestions?

 

HERES MY SITE- you'll probably notice my quandry if it hasn't been fixed yet

 

you could place a <br> tag between the image and textual parts of the code

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

you could place a <br> tag between the image and textual parts of the code

I have used that contribution, and my images are all squished tightly into the menu. I would like to get rid of the number beside the image, and have the image go across the whole column. They are really really small!

Any help would be appreciated. It looks good on your menu.

 

Julie

 

http://www.noteworthyinkonline.com/shop/catalog/index.php

Link to comment
Share on other sites

I have used that contribution, and my images are all squished tightly into the menu.  I would like to get rid of the number beside the image, and have the image go across the whole column.  They are really really small!

Any help would be appreciated. It looks good on your menu.

 

Julie

 

http://www.noteworthyinkonline.com/shop/catalog/index.php

 

still looking for a link that works, numbers I would guess are just the standard counts which can be turned off in the admin

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Steve..Do you have any idea why my link won't work?  It works when I click on it.

Julie

 

I allways get a cannot find server, this may be due to my firewall because of something on your site, however I normally get a warning of what is causing the issue.

 

Nope does not appear to be my firewall, are you hosting this from your local machine

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

I allways get a cannot find server, this may be due to my firewall because of something on your site, however I normally get a warning of what is causing the issue.

 

Nope does not appear to be my firewall, are you hosting this from your local machine

 

No.. it is at inter-networks.net. There is a little flash and javascript on the site, and the oscommerce shopping cart. That is it.

Julie.. So, I'm fairy new at this and the structure of oscommerce is slowly sinking in. I managed to add some things to the right column. Okay.. I can't find where the sizes of the categories images are set. Looking..looking. I have seen where some people have these javascript menus on the side. How does that integrate with the php of the categories menu? I'm sort of missing the big picture there I think.

julie

Link to comment
Share on other sites

  • 1 year later...

Hi Everyone.

 

I know this is a really old thread, so hopefully someone still knows about it.

 

Does anyone know how to make the sub categories appear with smaller images than the parent categories? I have tried to do it with my extremely limited PHP skill, to no avail. I am sure it wouldn't be too hard with the right commands.

 

I am using the images no text version.

 

 <?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 (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 function tep_show_category($counter) {
global $tree, $categories_string, $cPath_array;

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
if (tep_not_null($tree[$counter]['image'])) {
$categories_string .= tep_image(DIR_WS_IMAGES . $tree[$counter]['image'], $tree[$counter]['name'], '30', '30');
}else{
$categories_string .= $tree[$counter]['name'];
}
if (isset($cPath_array) && in_array($counter, $cPath_array)) {
  $categories_string .= '</b>';
}

//	if (tep_has_category_subcategories($counter)) {
//	 $categories_string .= '->';
//	}

$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 .= '<br>';

if ($tree[$counter]['next_id'] != false) {
  tep_show_category($tree[$counter]['next_id']);
}
 }
?>
<!-- categories //-->
	  <tr>
		<td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);

 new infoBoxHeading($info_box_contents, true, false);

 $categories_string = '';
 $tree = array();

 $categories_query = tep_db_query("select c.categories_id, c.categories_image, 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'],
					'image' => $categories['categories_image'],
											'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, c.categories_image, 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'],
					   'image' => $row['categories_image'],
										   '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); 

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

 new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- categories_eof //-->

 

Many thanks,

 

Rob

Rob Bell - Inspired Graphix

Customising osCommerce in Australia, and the world!

View my profile for web and email links.

 

I'm sorry, but i cannot offer Free support via PM etc, and osCommerce forums prohibit me from putting any reference to paid support in my signauture.

However viewing my profile may provide links to my website or something like that which you may find useful.

Link to comment
Share on other sites

Hi All,

 

Not that i think anyone is reading this post, but incase you stumble accross it, i found the solution to my above problem.

 

Take the code that defines the image size

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

 

All you have to do is remove the numbers from the image size. So this line

 $tree[$counter]['name'], '30', '30');

ends up as

 $tree[$counter]['name']);

 

I can't believe it was that simple. Ah well. *hits self on forehead*

 

Rob

Rob Bell - Inspired Graphix

Customising osCommerce in Australia, and the world!

View my profile for web and email links.

 

I'm sorry, but i cannot offer Free support via PM etc, and osCommerce forums prohibit me from putting any reference to paid support in my signauture.

However viewing my profile may provide links to my website or something like that which you may find useful.

Link to comment
Share on other sites

  • 4 months later...

I have a client that uses the category.php file of this contribution that allows the category menu to have a image to the left of the category name.

 

Does anyone know how to vertically center the image and text (align="absmiddle") ?

 

I have tried CSS class y1 but that is being overided by some 'higher power', must be in the categories.php file somewhere.

Any ideas?

 

Thanks,

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

I have a client that uses the category.php file of this contribution that allows the category menu to have a image to the left of the category name.

 

Does anyone know how to vertically center the image and text (align="absmiddle") ?

 

I have tried CSS class y1 but that is being overided by some 'higher power', must be in the categories.php file somewhere.

Any ideas?

 

Thanks,

Never mind...figured it out.

Made the following change in the boxes/category.php file:

	$categories_string .= tep_image(DIR_WS_IMAGES . $tree[$counter]['image'], $tree[$counter]['name'], '60', '60',' align="middle" ') . $tree[$counter]['name'];

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

OK. Just in case anyone needs this...

 

I needed to add some space between the category image and the category text. Here is what I did:

 

In the categories.php file,

Find this code:

// category image mod end
 while ($categories = tep_db_fetch_array($categories_query))  {
$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],

Change it to:

// category image mod end THE   BELOW IS THE SPACE ADDED BETWEEN THE IMAGE AND THE TEXT
 while ($categories = tep_db_fetch_array($categories_query))  {
$tree[$categories['categories_id']] = array('name' => '  ' . $categories['categories_name'],

You will notice that all I did was add the following spacers:

'  ' .

Sometimes it is the easy things that can make for a long night. :lol:

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

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