Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can box content be combined?


Recommended Posts

Posted

I was wondering, can the content of multiple boxes be combined into one larger box with simple HR seperators?

For example, I'd like to combine Categories, Links and Information into a single box on the left of my store with HR spacers between the sections. Is this possible? I have been searching posts for the last hour, and I can't seem to find anything. Help would be greatly appreciated. I have tried just making a new box and putting the content of the other boxes into it, but that didn't work, I kept getting all sorts of screwy errors. If there is a way to merge various boxes together, it would be a great help to me.

Thank you

Briana

DELETE MY ACCOUNT NOW

Posted

Ok, In case anyone else was wondering, I did figure out a way to combine boxes with an HR seperator. I created a new file called "categories2.php" for this, but I assume you could use the original categories box, and add the other box content to it. This is only the left column, I still need to work on the right one. Here's the code:

 

Categories2.php

 

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

 changed August 2003, by Nils Petersson
 contribution "Category Box Enhancement", version 1.1

*/

 function tep_show_category($counter) {

// BoF - Contribution Category Box Enhancement 1.1
global $tree, $categories_string, $cPath_array, $cat_name;

for ($i=0; $i<$tree[$counter]['level']; $i++) {
  $categories_string .= "  ";
}
$cPath_new = 'cPath=' . $tree[$counter]['path'];
if (isset($cPath_array) && in_array($counter, $cPath_array) && $cat_name == $tree[$counter]['name']) { //Link nicht anklickbar, wenn angew?hlt
		 $categories_string .= '<a href="';
		 $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';																	 	 //Link nicht anklickbar, wenn angew?hlt
} else {						 																					 //Link nicht anklickbar, wenn angew?hlt
$categories_string .= '<a href="';
$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';
}									 																						 //Link nicht anklickbar, wenn angew?hlt
if (tep_has_category_subcategories($counter)) {
  $categories_string .= tep_image(DIR_WS_IMAGES . 'pointer_blue.gif', '');
}
else {
  $categories_string .= tep_image(DIR_WS_IMAGES . 'pointer_blue_light.gif', '');
}

if (isset($cPath_array) && in_array($counter, $cPath_array)) {
  $categories_string .= '<b>';
}

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

// display category name
$categories_string .= $tree[$counter]['name'];

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

if (isset($cPath_array) && in_array($counter, $cPath_array)) {
  $categories_string .= '</b>';
}
// 	EoF Category Box Enhancement

$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 //-->

********Notice a change here - I added this line so you could see, it's not actually in the code********
	  <tr>
		<td><center><b><font color="000080" face="Verdana" size="2">Navigation</font></b></center>
		</td>
	  </tr>
	  <tr>
		<td><hr color="#6699FF" size="1">
		</td>
	  </tr>
********Notice a change here - I added this line so you could see, it's not actually in the code********
	  <tr>
		<td>

<?php

// BoF - Contribution Category Box Enhancement 1.1
if (isset($cPath_array)) {
	for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) {
			$categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'");
			if (tep_db_num_rows($categories_query) > 0)
			$categories = tep_db_fetch_array($categories_query);
	}
$cat_name = $categories['categories_name'];
}
// EoF Category Box Enhancement
// display category name

 $info_box_contents = array();

 $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);

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

if ( (basename($PHP_SELF) != FILENAME_PRODUCTS_NEW)) {
$info_box_contents[] = array('align' => 'left',
						   'text'  => '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, '', 'NONSSL') . '">' . BOX_INFORMATION_PRODUCTS_NEW . '</a>');
}else{
$info_box_contents[] = array('align' => 'left',
						   'text'  => '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, '', 'NONSSL') . '"><span class="errorText">' . BOX_INFORMATION_PRODUCTS_NEW . '</a></span>');
 }
 function tep_get_paths($categories_array = '', $parent_id = '0', $indent = '', $path='') {
global $languages_id;

if (!is_array($categories_array)) $categories_array = array();

$categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' 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)) {
  if ($parent_id=='0'){
$categories_array[] = array('id' => $categories['categories_id'],
								  'text' => $indent . $categories['categories_name']);
  }
  else{
$categories_array[] = array('id' => $path . $parent_id . '_' .$categories['categories_id'],
								  'text' => $indent . $categories['categories_name']);
  }

  if ($categories['categories_id'] != $parent_id) {
$this_path=$path;
if ($parent_id != '0')
  $this_path = $path . $parent_id . '_';
	$categories_array = tep_get_paths($categories_array, $categories['categories_id'], $indent . ' ', $this_path);
  }
}

return $categories_array;
 }

 new infoBox($info_box_contents);
?>

		</td>
	  </tr>

********Notice a change here - I added this line so you could see, it's not actually in the code********
	  <tr>
		<td><hr color="#6699FF" size="1">
		</td>
	  </tr>
	  <tr>
		<td><center><b><font color="000080" face="Verdana" size="2">Links</font></b></center>
		</td>
	  </tr>
********Notice a change here - I added this line so you could see, it's not actually in the code********

<!-- categories_eof //-->

<!-- information //-->
	  <tr>
		<td>
<?php
 $info_box_contents = array();

 $info_box_contents = array();
 $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_PAGE1) . '">' . BOX_LINKS_PAGE1 . '</a><br>' .
									 '<a href="' . tep_href_link(FILENAME_PAGE2) . '">' . BOX_LINKS_PAGE2 . '</a><br>' .
						 '<a href="' . tep_href_link(FILENAME_DVD1) . '">' . BOX_CATEGORIES_DVD1 . '</a><br>' .
							 '<a href="' . tep_href_link(FILENAME_ALL_PRODUCTS) . '">' . ALL_PRODUCTS_LINK . '</a>');

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

********Notice a change here - I added this line so you could see, it's not actually in the code********
	  <tr>
		<td><hr color="#6699FF" size="1">
		</td>
	  </tr>
	  <tr>
		<td><center><b><font color="000080" face="Verdana" size="2">Information</font></b></center>
		</td>
	  </tr>

********Notice a change here - I added this line so you could see, it's not actually in the code********

<!-- information_eof //-->

<!-- information //-->
	  <tr>
		<td>
<?php
 $info_box_contents = array();


 $info_box_contents = array();
 $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
									 '<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
									 '<a href="' . tep_href_link(FILENAME_ABOUT_ARTISTS) . '">' . BOX_INFORMATION_ABOUT_ARTISTS . '</a><br>' .
									 '<a href="' . tep_href_link(FILENAME_PAGE3) . '">' . BOX_INFORMATION_PAGE3 . '</a><br>' .
									 '<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a><br>' .
						 '<a href="' . tep_href_link(FILENAME_PRINT_CATALOG, '', 'NONSSL') . '" target="_BLANK">' . BOX_INFORMATION_PRINT_CATALOG .'</a>');

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

<!-- information_eof //-->

 

Column_left.php

 

<?php
/*
 $Id: column_left.php,v 1.15 2003/07/01 14:34:54 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if ((USE_CACHE == 'true') && empty($SID)) {
echo tep_cache_categories_box();
 } else {
include(DIR_WS_BOXES . 'categories2.php');
 }


?>

DELETE MY ACCOUNT NOW

Posted
I was wondering, can the content of multiple boxes be combined into one larger box with simple HR seperators?

For example, I'd like to combine Categories, Links and Information into a single box on the left of my store with HR spacers between the sections. Is this possible? I have been searching posts for the last hour, and I can't seem to find anything. Help would be greatly appreciated. I have tried just making a new box and putting the content of the other boxes into it, but that didn't work, I kept getting all sorts of screwy errors. If there is a way to merge various boxes together, it would be a great help to me.

Thank you

Briana

 

This isn't the best way, but it is the easiest. Just set your left (and/or right) column table to a certain background color and make all the infoboxes have the same color in the stylesheet.

  • 2 weeks later...
Posted

I got it figured out so that it works pretty well. I just copied and pasted everything into the left column, and with help from another thread, got the right column gone.

Thanks for the assistance, I really appreciate it.

Briana

DELETE MY ACCOUNT NOW

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...