Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can I insert html into catagories box?


qwick

Recommended Posts

Ok. I figured out how to put my html code into the categories.php file but now the buttons do not show until you mouseover them. something wrong in the html/javascript code? Help!!!!! I almost have it. You can see it here U.S. Telphonics

The code looks like this:

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

 

 

 

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

 

}

 

 

 

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><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, 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();

 

 

 

new infoBox($info_box_contents);

print "<HTML>

 

<head>

<title>U.S. TELPHONICS - Business Telephone Equipment Sales</title>

</head>

<script LANGUAGE=\"JavaScript\"><!--

imgsrc=new Array();

imgsrc[1]=\"../../webimg/buttons/a_front1.gif\";

imgsrc[2]=\"../../webimg/buttons/p_front1.gif\";

imgsrc[3]=\"../../webimg/buttons/a_front2.gif\";

imgsrc[4]=\"../../webimg/buttons/p_front2.gif\";

imgsrc[5]=\"../../webimg/buttons/a_front3.gif\";

imgsrc[6]=\"../../webimg/buttons/p_front3.gif\";

imgsrc[7]=\"../../webimg/buttons/a_front4.gif\";

imgsrc[8]=\"../../webimg/buttons/p_front4.gif\";

imgsrc[9]=\"../../webimg/buttons/a_front5.gif\";

imgsrc[10]=\"../../webimg/buttons/p_front5.gif\";

imgsrc[11]=\"../../webimg/buttons/a_front6.gif\";

imgsrc[12]=\"../../webimg/buttons/p_front6.gif\";

imgsrc[13]=\"../../webimg/buttons/a_front7.gif\";

imgsrc[14]=\"../../webimg/buttons/p_front7.gif\";

imgsrc[15]=\"../../webimg/buttons/a_front8.gif\";

imgsrc[16]=\"../../webimg/buttons/p_front8.gif\";

imgsrc[17]=\"../../webimg/buttons/a_front9.gif\";

imgsrc[18]=\"../../webimg/buttons/p_front9.gif\";

imgsrc[19]=\"../../webimg/buttons/a_front10.gif\";

imgsrc[20]=\"../../webimg/buttons/p_front10.gif\";

 

img =new Array();

for (i=0; i< imgsrc.length; i++) {

img=new Image();

img.src=imgsrc;

}

function change(number, picture) {

{

document[picture].src=img[number].src;

}

}

// -->

</SCRIPT>

 

<TABLE border=\"0\" Cellpadding=\"0\" Cellspacing=\"0\" align=\"left\" >

<TR><TD align=\"left\">

<a TARGET=\"_top\" ONMOUSEOVER=\"change('1','m1')\" ONMOUSEOUT=\"change('2','m1')\" name=\"m1\" href=\"http://ustelphonics.com/index.php?cPath=21\"><IMG NAME=\"m1\" SRC=\"p_front1.gif\" BORDER=\"0\" vspace=\"0\" hspace=\"0\"></a></TD></TR>

<TR><TD align=\"left\">

<a TARGET=\"_top\" ONMOUSEOVER=\"change('3','m2')\" ONMOUSEOUT=\"change('4','m2')\" name=\"m2\" href=\"http://ustelphonics.com/index.php?cPath=22\"><IMG NAME=\"m2\" SRC=\"p_front2.gif\" BORDER=\"0\" vspace=\"0\" hspace=\"0\"></a></TD></TR>

<TR><TD align=\"left\">

<a TARGET=\"_top\" ONMOUSEOVER=\"change('5','m3')\" ONMOUSEOUT=\"change('6','m3')\" name=\"m3\" href=\"http://ustelphonics.com/index.php?cPath=23\"><IMG NAME=\"m3\" SRC=\"p_front3.gif\" BORDER=\"0\" vspace=\"0\" hspace=\"0\"></a></TD></TR>

<TR><TD align=\"left\">

<a TARGET=\"_top\" ONMOUSEOVER=\"change('7','m4')\" ONMOUSEOUT=\"change('8','m4')\" name=\"m4\" href=\"http://ustelphonics.com/index.php?cPath=24\"><IMG NAME=\"m4\" SRC=\"p_front4.gif\" BORDER=\"0\" vspace=\"0\" hspace=\"0\"></a></TD></TR>

<TR><TD align=\"left\">

<a TARGET=\"_top\" ONMOUSEOVER=\"change('9','m5')\" ONMOUSEOUT=\"change('10','m5')\" name=\"m5\" href=\"http://ustelphonics.com/index.php?cPath=25\"><IMG NAME=\"m5\" SRC=\"p_front5.gif\" BORDER=\"0\" vspace=\"0\" hspace=\"0\"></a></TD></TR>

<TR><TD align=\"left\">

<a TARGET=\"_top\" ONMOUSEOVER=\"change('11','m6')\" ONMOUSEOUT=\"change('12','m6')\" name=\"m6\" href=\"http://ustelphonics.com/index.php?cPath=26\"><IMG NAME=\"m6\" SRC=\"p_front6.gif\" BORDER=\"0\" vspace=\"0\" hspace=\"0\"></a></TD></TR>

<TR><TD align=\"left\">

<a TARGET=\"_top\" ONMOUSEOVER=\"change('13','m7')\" ONMOUSEOUT=\"change('14','m7')\" name=\"m7\" title=\"Repair Services\" href=\"../../repair/index.html\"><IMG NAME=\"m7\" SRC=\"p_front7.gif\" BORDER=\"0\" vspace=\"0\" hspace=\"0\"></a></TD></TR>

<TR><TD align=\"left\">

<a TARGET=\"_top\" ONMOUSEOVER=\"change('15','m8')\" ONMOUSEOUT=\"change('16','m8')\" name=\"m8\" title=\"We Buy Excess Inventory\" href=\"../../purchase/index.html\"><IMG NAME=\"m8\" SRC=\"p_front8.gif\" BORDER=\"0\" vspace=\"0\" hspace=\"0\"></a></TD></TR>

<TR><TD align=\"left\">

<a TARGET=\"_top\" ONMOUSEOVER=\"change('17','m9')\" ONMOUSEOUT=\"change('18','m9')\" name=\"m9\" href=\"http://ustelphonics.com/index.php?cPath=27\"><IMG NAME=\"m9\" SRC=\"p_front9.gif\" BORDER=\"0\" vspace=\"0\" hspace=\"0\"></a></TD></TR>

<TR><TD align=\"left\">

<a TARGET=\"_top\" ONMOUSEOVER=\"change('19','m10')\" ONMOUSEOUT=\"change('20','m10')\" name=\"m10\" title=\"About Us\" href=\"../../about/about.html\"><IMG NAME=\"m10\" SRC=\"p_front10.gif\" BORDER=\"0\" vspace=\"0\" hspace=\"0\"></a></TD></TR>

</TABLE>

 

</BODY>

</HTML>\n";

 

 

 

new infoBox($info_box_contents);

?>

 

</td>

 

</tr>

 

<!-- categories_eof //-->

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