Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP Version for OSC


hyau

Recommended Posts

I had a site running OSC on php 4.2.2

 

Now I am trying the same setup on a new server running php 4.3.2. Got a lot of problems like these below, that were fine on 4.2.2 site

 

Parse error: parse error in /home/primemas/public_html/shop/catalog/includes/boxes/categories.php on line 1

 

Fatal error: Call to undefined function: set_cat_top_bar_image() in /home/primemas/public_html/shop/catalog/includes/categories_nav.php on line 1

 

What could cause these errors?

Link to comment
Share on other sites

Source code of categories_nav.php attached. The function set_cat_top_bar_image (as highlighted) is clearly defined. Can see nothing wrong

 

 

<?

 

////////////////////////////////////////////////////////////////////////////////////////////////

//

// Function : tep_get_top_most_parent_categories

//

// Arguments : categories_id categories_id of current category

//

// Return : top most parent categories_id of categories_id

//

// Description : recursively go through the category tree to retrieve the top most parent categories id

//

////////////////////////////////////////////////////////////////////////////////////////////////

function tep_get_top_most_parent_categories($categories_id) {

$sqlstr = "SELECT parent_id FROM categories WHERE categories_id = $categories_id";

$sql = tep_db_query($sqlstr);

while ($cat = tep_db_fetch_array($sql)) {

if ($cat['parent_id'] == 0) {

return $categories_id;

} else {

if ($cat['parent_id'] != $categories_id)

tep_get_top_most_parent_categories($cat['parent_id']);

else

return $categories_id;

}

}

}

 

function set_cat_top_bar_image() {

global $cPath;

global $cPath_array;

if ($cPath) {

if (!ereg('_', $cPath))

$cPath_array = array($cPath);

 

$cid = tep_get_top_most_parent_categories($cPath_array[0]);

$categories_query = tep_db_query("select categories_extra_image1, categories_name from categories where categories_id = " . $cid);

$categories = tep_db_fetch_array($categories_query);

if ($categories['categories_extra_image1'] != '')

echo '<img src="' . $categories['categories_extra_image1'] . '" >';

else

{

if($categories['categories_name'] != '')

echo FONT_STYLE_SUB_BAR . $categories['categories_name'] . '</font>';

else

echo FONT_STYLE_SUB_BAR . '<i>CATEGORY NAME NOT AVAIALABLE</i>' . '</font>';

}

}

}

function cat_nav_bar() {

global $cPath;

global $cPath_array;

if ($cPath) {

if (!ereg('_', $cPath))

$cPath_array = array($cPath);

 

$cPath_new = '';

for($i=0;$i<sizeof($cPath_array);$i++) {

if ($cPath_new == '') {

$cPath_new .= $cPath_array[$i];

} else {

$cPath_new .= '_' . $cPath_array[$i];

}

$categories_query = tep_db_query("select categories_name from categories where categories_id = '" . $cPath_array[$i] . "'");

$categories = tep_db_fetch_array($categories_query);

if ($categories['categories_name'] != '')

echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath_new, 'NONSSL') . '" class="whitelink">' . $categories['categories_name'] . '</a> : ';

else

echo ' : <i>CATEGORY NAME NOT AVAIALABLE</i>';

}

}

}

?>

<tr>

<td valign="top" colspan="<? echo MAX_DISPLAY_CATEGORIES_PER_ROW; ?>">

<? set_cat_top_bar_image(); ?>

</td>

</tr>

<tr>

<td height="35" valign="top" colspan="<? echo MAX_DISPLAY_CATEGORIES_PER_ROW; ?>">

<?

echo FONT_STYLE_SUB_BAR;

echo 'Categories : ';

cat_nav_bar();

echo '</font>';

?>

</td>

</tr>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...