Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Php Code Error


zakya

Recommended Posts

Hello,

I am having big problem with the index.php. I believe there is error in the coding but can find any as I really don't understand php.

Please help me check the below code from my catalog/index.php

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html dir="LTR" lang="en">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Solarissa</title>

<base href="http://localhost/solarissa/">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<!--

 

-->

<table width=100% cellspacing=0 cellpadding=0 align=center>

<tr><td bgcolor=#292929 width=100% height=316 align=center valign=top>

<table cellspacing=0 cellpadding=0 width=100% align=center>

<tr><td width=100% align=center>

<table cellspacing=0 cellpadding=0 border=0 width=706 valign=top>

<tr><td class=bg1 width=706 height=36 valign=top>

<table cellspacing=0 cellpadding=0 border=0 width=706 height=36>

<tr><td><img src=images/m01.gif width=9 height=36 border=0></td>

<td width=134 align=center><span class=ch1>Shopping cart</span> <a class=ml1 href=<?=tep_href_link('shopping_cart.php')?>><?=$cart->count_contents()?> items</a></td>

<td background=images/m04.gif width=1></td>

<td width=109 align=center>

<? // LANGUAGES

if (!isset($lng) || (isset($lng) && !is_object($lng))) {

include(DIR_WS_CLASSES . 'language.php');

$lng = new language;

}

$languages_string = '';

reset($lng->catalog_languages);

while (list($key, $value) = each($lng->catalog_languages)) {

$languages_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . tep_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a> ';

}

 

echo $languages_string;

 

?>

</td>

<td background=images/m04.gif width=1></td>

<td width=245 align=center>

 

<? // SEARCH ?>

<table cellspacing=0 cellpadding=0 >

<form> <?=tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get')?>

<tr><td><span class=ch1>Site search:</span></td>

<td width=126 align=center>

<?=tep_draw_input_field('keywords', '', 'size="20" maxlength="50" onclick="this.value=\'\'" value="keyword" class=se1 ') . ' ' . tep_hide_session_id()?></td>

<td><input type=image src=images/m08.gif width=28 height=20></td></tr>

</form>

</table>

<? // END SEARCH ?>

 

</td>

<td background=images/m04.gif width=1></td>

<td width=197 align=center>

<table cellspacing=0 cellpadding=0>

<tr><td width=80><span align=center class=ch1>Curencies:</span></td>

<td>

 

<?

// CURRENCIES

 

echo tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get');

 

reset($currencies->currencies);

$currencies_array = array();

while (list($key, $value) = each($currencies->currencies)) {

$currencies_array[] = array('id' => $key, 'text' => $value['title']);

}

 

$hidden_get_variables = '';

reset($HTTP_GET_VARS);

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

if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {

$hidden_get_variables .= tep_draw_hidden_field($key, $value);

}

}

 

echo tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit(); style="width: 99px; background-color: #727272; font-size: 9px; color: #FFFFFF;"') . $hidden_get_variables . tep_hide_session_id();

echo '</form>';

?>

</td></tr>

</table>

</td>

<td><img src=images/m02.gif width=9 height=36 border=0></td></tr>

</table>

</td></tr>

<tr><td width=706 valign=top>

<table cellspacing=0 cellpadding=0 width=706 height=225>

<tr><td width=239 style="padding-left: 10px"><a href=<?=tep_href_link('index.php')?>><img src=images/m09.jpg width=164 height=111 border=0></a></td>

<td background=images/m11.gif width=307 ><img src=images/m10.gif width=307 height=204 border=0></td>

<td background=images/m12.gif width=160 align=center><a href=<?=tep_href_link('index.php','cPath=38')?>><img src=images/m13.gif width=121 height=186 border=0></a></td></tr>

</table>

</td></tr>

</table>

</tr></td>

<tr><td height=55 class=bg2 align=center><a href=<?=tep_href_link('index.php')?>><img src=images/m15.gif width=94 height=55 border=0></a><a href=<?=tep_href_link('products_new.php')?>><img src=images/m16.gif width=145 height=55 border=0></a><a href=<?=tep_href_link('account.php')?>><img src=images/m17.gif width=177 height=55 border=0></a><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/m18.gif width=161 height=55 border=0></a><a href=<?=tep_href_link('checkout_shipping.php')?>><img src=images/m19.gif width=129 height=55 border=0></a></td></tr>

<tr><td bgcolor=#585858 height=35 align=center>

<table cellspacing=0 cellpadding=0 width=706>

<tr><td width=9 height=35><img src=images/m20.gif width=9 height=35></td>

<td background=images/m22.gif width=688>

<table cellspacing=0 cellpadding=0 width=688 valign=top>

<tr><td width=111 align=center><a href=<?=tep_href_link('specials.php')?> class=ml2>specials</a></td>

<td width=2 height=12><img src=images/m23.gif width=2 height=12></td>

<td width=113 align=center><a href=<?=tep_href_link('advanced_search.php')?> class=ml2>search</a></td>

<td width=2 height=12><img src=images/m23.gif width=2 height=12></td>

<td width=133 align=center><a href=<?=tep_href_link('contact_us.php')?> class=ml2>contact us</a></td>

<td width=2 height=12><img src=images/m23.gif width=2 height=12></td>

<td width=177 align=center><a href=<?=tep_href_link('create_account.php')?> class=ml2>create an account</a></td>

<td width=2 height=12><img src=images/m23.gif width=2 height=12></td>

<td width=146 align=center><?=(!tep_session_is_registered('customer_id') ? '<a href='.tep_href_link('login.php').' class=ml2>Customer Login</a>' : '<a href='.tep_href_link('logoff.php').' class=ml2>Sign Out</a>')?></td></tr>

</table>

</td>

<td width=9 height=35><img src=images/m21.gif width=9 height=35></td></tr>

</table>

</td></tr>

<tr><td bgcolor=#585858 height=2>

</table>

</td></tr>

<tr><td width=100% height=100% align=center valign=top>

<table bgcolor=#232323 cellspacing=0 cellpadding=0 border=0 width=706>

<tr><td width=216 valign=top>

<table cellspacing=0 cellpadding=0>

<tr><td background=images/m24.gif width=216 height=10></td></tr>

<tr><td background=images/m26.gif style="padding-left: 23px"><span class=ch2>browse by categories</span></td></tr>

<tr><td background=images/m25.gif height=8></td></tr>

<tr><td height=1></td></tr>

<tr><td width=216>

<table cellspacing=0 cellpadding=0 class=bg3>

<tr><td background=images/m27.gif width=216 height=10></td></tr>

<tr><td height=11></td></tr>

<? // ---- CATEGORIES

 

function tep_show_category($counter) {

global $tree, $categories_string, $cPath_array;

 

if(!$tree[$counter]['level']){

 

$categories_string .= $categories_string ? '<tr><td height=1 style="padding-left: 20px"><img src=images/m30.gif width=168 height=1 border=0></td></tr><tr><td height=4></td></tr>' : '';

 

$categories_string .= '<tr><td style="padding-left: 23px"><img src=images/m29.gif width=6 height=5 border=0 align=absmiddle><span class=ch3></span><a class=ml3 href=';

 

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

$cPath_new = 'cPath=' . $counter;

} else {

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

}

$categories_string .= tep_href_link('index.php', $cPath_new) . '>';

// display categry name

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

$categories_string .= '</a></td></tr><tr><td height=4></td></tr> ';

 

}else{ // SUBCATEGORY

 

$categories_string .= '<tr><td style="padding-left: 23px"><img src=images/m29.gif width=6 height=5 border=0 align=absmiddle><span class=ch3></span>';

 

for($i=0;$i<$tree[$counter]['le vel'];$i++)

$categories_string .= '     ';

 

$categories_string .= '    <a class=ml3 style="font-weight:normal;" href=';

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

$cPath_new = 'cPath=' . $counter;

} else {

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

}

$categories_string .= tep_href_link('index.php', $cPath_new) . '>-';

// display category name

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

$categories_string .= '</a></td></tr><tr><td height=4></td></tr>';

}

 

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

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

}

}

 

define(TABLE_CATEGORIES, "categories");

define(TABLE_CATEGORIES_DESCRIPTION, "categories_description");

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

}

}

}

$categories_string .= '';

tep_show_category($first_element);

$categories_string .= '';

 

echo $categories_string;

?>

<tr><td><img src=images/m31.gif width=216 height=23 border=0></td></tr>

</table>

</td></tr>

</table>

</td>

<td width=2></td>

<td width=488 valign=top>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<!-- body_text //-->

 

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td>

 

<table cellspacing=0 cellpadding=0 width=488 valign=top>

<tr><td background=images/m32.gif width=488 height=10></td></tr>

<tr><td background=images/m34.gif style="padding-left: 23px"><span class=ch2>featured product</span></td></tr>

<tr><td background=images/m33.gif width=488 height=8></td></tr>

<tr><td width=1></td></tr>

<tr><td width=488 valign=top>

 

<!-- new_products //-->

 

<table cellspacing=0 cellpadding=0 width=488>

<tr>

 

<td width=242>

<table cellspacing=0 cellpadding=0 width=242 class=bg4>

<tr><td background=images/m35.gif width=242 height=8 colspan=3></td></tr>

<tr><td width=4></td>

<td background=images/m38.gif width=122 height=149 align=center><a href="<A href='http://localhost/solarissa/product_info.php?products_id=201">http://localhost/solarissa/product_info.php?products_id=201"><img'>http://localhost/solarissa/product_info.php?products_id=201">http://localhost/solarissa/product_info.php?products_id=201"><img src="/solarissa/images/m39.jpg" border="0" alt="Sony Ericsson W900i" title=" Sony Ericsson W900i " width="90" height="90" vspace=0></a></td>

<td valign=top>

<table cellspacing=0 cellpadding=0 style="padding-left: 12px">

<tr><td height=3></td></tr>

<tr><td class=ch4 height=45 valign=top><a class="pr_name" href="<A href="http://localhost/solarissa/product_info.php?products_id=201">http://localhost/solarissa/product_info.php?products_id=201"> Sony Ericsson W900i</a> Donec accumsan malesuada orciec sit amet ... </td></tr>

<tr><td height=1></td></tr>

<tr><td><img src=images/m40.gif width=88 height=1></td></tr>

<tr><td height=8></td></tr>

<tr><td class=ch5 style="padding-left: 15px">$415.45</td></tr>

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

<tr><td><img src=images/m40.gif width=88 height=1></td></tr>

<tr><td height=8></td></tr>

<tr><td><a href="<A href='http://localhost/solarissa/index.php?action=buy_now&products_id=201">http://localhost/solarissa/index.php?action=buy_now&products_id=201"><img src="includes/languages/english/images/buttons/button_in_cart.gif" border="0" alt="" width="62" height="17"></a></td></tr>

<tr><td height=3></td></tr>

<tr><td><a href="<A href='http://localhost/solarissa/product_info.php?products_id=201">http://localhost/solarissa/product_info.php?products_id=201"><img'>http://localhost/solarissa/product_info.php?products_id=201">http://localhost/solarissa/product_info.php?products_id=201"><img src="includes/languages/english/images/buttons/small_view.gif" border="0" alt="" width="68" height="17"></a></td></tr>

</table>

</td>

</tr>

<tr><td background=images/m36.gif width=242 height=9 colspan=3></td></tr>

</table>

</td>

<td width=1></td>

<td width=242>

<table cellspacing=0 cellpadding=0 width=242 class=bg4>

<tr><td background=images/m35.gif width=242 height=8 colspan=3></td></tr>

<tr><td width=4></td>

<td background=images/m38.gif width=122 height=149 align=center><a href="<A href='http://localhost/solarissa/product_info.php?products_id=200">http://localhost/solarissa/product_info.php?products_id=200"><img src="/solarissa/images/m43.jpg" border="0" alt="Nokia 6270" title=" Nokia 6270 " width="90" height="90" vspace=0></a></td>

<td valign=top>

<table cellspacing=0 cellpadding=0 style="padding-left: 12px">

<tr><td height=3></td></tr>

<tr><td class=ch4 height=45 valign=top><a class="pr_name" href="http://localhost/solarissa/product_info.php?products_id=200"> Nokia 6270</a> Donec accumsan malesuada orciec sit amet ... </td></tr>

<tr><td height=1></td></tr>

<tr><td><img src=images/m40.gif width=88 height=1></td></tr>

<tr><td height=8></td></tr>

<tr><td class=ch5 style="padding-left: 15px">$399.00</td></tr>

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

<tr><td><img src=images/m40.gif width=88 height=1></td></tr>

<tr><td height=8></td></tr>

<tr><td><a href="<A href='http://localhost/solarissa/index.php?action=buy_now&products_id=200">http://localhost/solarissa/index.php?action=buy_now&products_id=200"><img src="includes/languages/english/images/buttons/button_in_cart.gif" border="0" alt="" width="62" height="17"></a></td></tr>

<tr><td height=3></td></tr>

<tr><td><a href="<A href='http://localhost/solarissa/product_info.php?products_id=200">http://localhost/solarissa/product_info.php?products_id=200"><img src="includes/languages/english/images/buttons/small_view.gif" border="0" alt="" width="68" height="17"></a></td></tr>

</table>

</td>

</tr>

<tr><td background=images/m36.gif width=242 height=9 colspan=3></td></tr>

</table>

</td>

</tr>

<tr><td height=2 colspan=3></td></tr>

<tr>

<td width=242>

<table cellspacing=0 cellpadding=0 width=242 class=bg4>

<tr><td background=images/m35.gif width=242 height=8 colspan=3></td></tr>

<tr><td width=4></td>

<td background=images/m38.gif width=122 height=149 align=center><a href="<A href='http://localhost/solarissa/product_info.php?products_id=199">http://localhost/solarissa/product_info.php?products_id=199"><img'>http://localhost/solarissa/product_info.php?products_id=199">http://localhost/solarissa/product_info.php?products_id=199"><img src="/solarissa/images/m44.jpg" border="0" alt="Samsung Z500" title=" Samsung Z500 " width="90" height="90" vspace=0></a></td>

<td valign=top>

<table cellspacing=0 cellpadding=0 style="padding-left: 12px">

<tr><td height=3></td></tr>

<tr><td class=ch4 height=45 valign=top><a class="pr_name" href="<A href="http://localhost/solarissa/product_info.php?products_id=199">http://localhost/solarissa/product_info.php?products_id=199"> Samsung Z500</a> Donec accumsan malesuada orciec sit amet ... </td></tr>

<tr><td height=1></td></tr>

<tr><td><img src=images/m40.gif width=88 height=1></td></tr>

<tr><td height=8></td></tr>

<tr><td class=ch5 style="padding-left: 15px">$319.00</td></tr>

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

<tr><td><img src=images/m40.gif width=88 height=1></td></tr>

<tr><td height=8></td></tr>

<tr><td><a href="<A href='http://localhost/solarissa/index.php?action=buy_now&products_id=199">http://localhost/solarissa/index.php?action=buy_now&products_id=199"><img src="includes/languages/english/images/buttons/button_in_cart.gif" border="0" alt="" width="62" height="17"></a></td></tr>

<tr><td height=3></td></tr>

<tr><td><a href="<A href='http://localhost/solarissa/product_info.php?products_id=199">http://localhost/solarissa/product_info.php?products_id=199"><img'>http://localhost/solarissa/product_info.php?products_id=199">http://localhost/solarissa/product_info.php?products_id=199"><img src="includes/languages/english/images/buttons/small_view.gif" border="0" alt="" width="68" height="17"></a></td></tr>

</table>

</td>

</tr>

<tr><td background=images/m36.gif width=242 height=9 colspan=3></td></tr>

</table>

</td>

<td width=1></td>

<td width=242>

<table cellspacing=0 cellpadding=0 width=242 class=bg4>

<tr><td background=images/m35.gif width=242 height=8 colspan=3></td></tr>

<tr><td width=4></td>

<td background=images/m38.gif width=122 height=149 align=center><a href="<A href='http://localhost/solarissa/product_info.php?products_id=198">http://localhost/solarissa/product_info.php?products_id=198"><img src="/solarissa/images/m45.jpg" border="0" alt="Motorola V3X" title=" Motorola V3X " width="90" height="90" vspace=0></a></td>

<td valign=top>

<table cellspacing=0 cellpadding=0 style="padding-left: 12px">

<tr><td height=3></td></tr>

<tr><td class=ch4 height=45 valign=top><a class="pr_name" href="http://localhost/solarissa/product_info.php?products_id=198"> Motorola V3X</a> Donec accumsan malesuada orciec sit amet ... </td></tr>

<tr><td height=1></td></tr>

<tr><td><img src=images/m40.gif width=88 height=1></td></tr>

<tr><td height=8></td></tr>

<tr><td class=ch5 style="padding-left: 15px">$345.00</td></tr>

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

<tr><td><img src=images/m40.gif width=88 height=1></td></tr>

<tr><td height=8></td></tr>

<tr><td><a href="<A href='http://localhost/solarissa/index.php?action=buy_now&products_id=198">http://localhost/solarissa/index.php?action=buy_now&products_id=198"><img src="includes/languages/english/images/buttons/button_in_cart.gif" border="0" alt="" width="62" height="17"></a></td></tr>

<tr><td height=3></td></tr>

<tr><td><a href="<A href='http://localhost/solarissa/product_info.php?products_id=198">http://localhost/solarissa/product_info.php?products_id=198"><img src="includes/languages/english/images/buttons/small_view.gif" border="0" alt="" width="68" height="17"></a></td></tr>

</table>

</td>

</tr>

<tr><td background=images/m36.gif width=242 height=9 colspan=3></td></tr>

</table>

</td>

</tr>

<tr><td height=2 colspan=3></td></tr>

<tr>

</tr>

</table>

 

<!-- new_products_eof //-->

 

</td></tr>

</table>

 

<table cellspacing=0 cellpadding=0 width=488>

 

</table>

</td>

</tr>

</table>

</td>

 

<!-- body_text_eof //-->

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

</td></tr>

</table>

</td></tr>

<tr><td width=100% height=64 valign=bottom>

<table cellspacing=0 cellpadding=0 border=0 width=100% height=64>

<tr><td height=2></td></tr>

<tr><td bgcolor=#232323 height=62 align=center>

<table cellspacing=0 cellpadding=0 border=0 width=706 height=62>

<tr><td width=216 style="padding-left: 28px"><img src=images/m53.gif width=160 height=23 border=0></td>

<td width=490 style="padding-right: 9px" align=right>

<table cellspacing=0 cellpadding=0 border=0 height=38>

<tr><td align=right class=ml5><a class=ml5 href=<?=tep_href_link('specials.php')?>>Specials</a><span class=ch6></span><img src=images/m54.gif width=1 height=12 border=0 align=absmiddle><span class=ch6></span><a class=ml5 href=<?=tep_href_link('advanced_search.php')?>>Site Search</a><span class=ch6></span><img src=images/m54.gif width=1 height=12 border=0 align=absmiddle><span class=ch6></span><a class=ml5 href=<?=tep_href_link('contact_us.php')?>>Contact Us</a><span class=ch6></span><img src=images/m54.gif width=1 height=12 border=0 align=absmiddle><span class=ch6></span><a class=ml5 href=<?=tep_href_link('create_account.php')?>>Create an account</a><span class=ch6></span><img src=images/m54.gif width=1 height=12 border=0 align=absmiddle><span class=ch6></span><?=(!tep_session_is_registered('customer_id') ? '<a href='.tep_href_link('login.php').' class=ml5>Customer Login</a>' : '<a href='.tep_href_link('logoff.php').' class=ml5>Sign Out</a>')?></a></td></tr>

<tr><td align=right class=ch7>Copyright © 2006 On Line Store. <a href=http://oscommerce.com target=_blank class=ml6>Powered by osCommerce</a></td></tr>

</table>

</td></tr>

</table>

</td></tr>

</table>

</td></tr>

</table>

<!-- footer_eof //-->

</body>

 

</html>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...