Skip to main content

Thread: OSCommerce broke


i have ubuntu 10.10 web server in basement running oscommerce 3.x web storefront software. load products onto upstairs office computer. every 2 months or so, i'll go down ubuntu server , check security updates , patches. did , after reboot, oscommerce broken. webstore "home page" takes 10 minutes load. comes in text mode (old style web blue underlined hyperlinks) , has no product graphics. i'm not sure update did (it may have replaced mysql , php files. seems though oscommerce can't find needs load. chugs away @ index.php file copy , pasted below:

in advance

zip

index.php

<?php
/*
$id$

oscommerce, open source e-commerce solutions
http://www.oscommerce.com

copyright (c) 2010 oscommerce

released under gnu general public license
*/

require('includes/application_top.php');

// following cpath references come application_top.php
$category_depth = 'top';
if (isset($cpath) && tep_not_null($cpath)) {
$categories_products_query = tep_db_query("select count(*) total " . table_products_to_categories . " categories_id = '" . (int)$current_category_id . "'");
$categories_products = tep_db_fetch_array($categories_products_query);
if ($categories_products['total'] > 0) {
$category_depth = 'products'; // display products
} else {
$category_parent_query = tep_db_query("select count(*) total " . table_categories . " parent_id = '" . (int)$current_category_id . "'");
$category_parent = tep_db_fetch_array($category_parent_query);
if ($category_parent['total'] > 0) {
$category_depth = 'nested'; // navigate through categories
} else {
$category_depth = 'products'; // category has no products, display 'no products' message
}
}
}

require(dir_ws_languages . $language . '/' . filename_default);

require(dir_ws_includes . 'template_top.php');

if ($category_depth == 'nested') {
$category_query = tep_db_query("select cd.categories_name, c.categories_image " . table_categories . " c, " . table_categories_description . " cd c.categories_id = '" . (int)$current_category_id . "' , cd.categories_id = '" . (int)$current_category_id . "' , cd.language_id = '" . (int)$languages_id . "'");
$category = tep_db_fetch_array($category_query);
?>

<h1><?php echo $category['categories_name']; ?></h1>

<div class="contentcontainer">
<div class="contenttext">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<?php
if (isset($cpath) && strpos('_', $cpath)) {
// check see if there deeper categories within current category
$category_links = array_reverse($cpath_array);
for($i=0, $n=sizeof($category_links); $i<$n; $i++) {
$categories_query = tep_db_query("select count(*) total " . table_categories . " c, " . table_categories_description . " cd c.parent_id = '" . (int)$category_links[$i] . "' , c.categories_id = cd.categories_id , cd.language_id = '" . (int)$languages_id . "'");
$categories = tep_db_fetch_array($categories_query);
if ($categories['total'] < 1) {
// nothing, go through loop
} else {
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id " . table_categories . " c, " . table_categories_description . " cd c.parent_id = '" . (int)$category_links[$i] . "' , c.categories_id = cd.categories_id , cd.language_id = '" . (int)$languages_id . "' order sort_order, cd.categories_name");
break; // we've found deepest category customer in
}
}
} else {
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id " . table_categories . " c, " . table_categories_description . " cd c.parent_id = '" . (int)$current_category_id . "' , c.categories_id = cd.categories_id , cd.language_id = '" . (int)$languages_id . "' order sort_order, cd.categories_name");
}

$number_of_categories = tep_db_num_rows($categories_query);

$rows = 0;
while ($categories = tep_db_fetch_array($categories_query)) {
$rows++;
$cpath_new = tep_get_path($categories['categories_id']);
$width = (int)(100 / max_display_categories_per_row) . '%';
echo ' <td align="center" class="smalltext" width="' . $width . '" valign="top"><a href="' . tep_href_link(filename_default, $cpath_new) . '">' . tep_image(dir_ws_images . $categories['categories_image'], $categories['categories_name'], subcategory_image_width, subcategory_image_height) . '<br />' . $categories['categories_name'] . '</a></td>' . "\n";
if ((($rows / max_display_categories_per_row) == floor($rows / max_display_categories_per_row)) && ($rows != $number_of_categories)) {
echo ' </tr>' . "\n";
echo ' <tr>' . "\n";
}
}

// needed new products module shown below
$new_products_category_id = $current_category_id;
?>
</tr>
</table>

<br />

<?php include(dir_ws_modules . filename_new_products); ?>

</div>
</div>

<?php
} elseif ($category_depth == 'products' || isset($http_get_vars['manufacturers_id'])) {
// create column list
$define_list = array('product_list_model' => product_list_model,
'product_list_name' => product_list_name,
'product_list_manufacturer' => product_list_manufacturer,
'product_list_price' => product_list_price,
'product_list_quantity' => product_list_quantity,
'product_list_weight' => product_list_weight,
'product_list_image' => product_list_image,
'product_list_buy_now' => product_list_buy_now);

asort($define_list);

$column_list = array();
reset($define_list);
while (list($key, $value) = each($define_list)) {
if ($value > 0) $column_list[] = $key;
}

$select_column_list = '';

($i=0, $n=sizeof($column_list); $i<$n; $i++) {
switch ($column_list[$i]) {
case 'product_list_model':
$select_column_list .= 'p.products_model, ';
break;
case 'product_list_name':
$select_column_list .= 'pd.products_name, ';
break;
case 'product_list_manufacturer':
$select_column_list .= 'm.manufacturers_name, ';
break;
case 'product_list_quantity':
$select_column_list .= 'p.products_quantity, ';
break;
case 'product_list_image':
$select_column_list .= 'p.products_image, ';
break;
case 'product_list_weight':
$select_column_list .= 'p.products_weight, ';
break;
}
}

// show products of specified manufacturer
if (isset($http_get_vars['manufacturers_id'])) {
if (isset($http_get_vars['filter_id']) && tep_not_null($http_get_vars['filter_id'])) {
// asked show specific category
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, null) specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) final_price " . table_products . " p left join " . table_specials . " s on p.products_id = s.products_id, " . table_products_description . " pd, " . table_manufacturers . " m, " . table_products_to_categories . " p2c p.products_status = '1' , p.manufacturers_id = m.manufacturers_id , m.manufacturers_id = '" . (int)$http_get_vars['manufacturers_id'] . "' , p.products_id = p2c.products_id , pd.products_id = p2c.products_id , pd.language_id = '" . (int)$languages_id . "' , p2c.categories_id = '" . (int)$http_get_vars['filter_id'] . "'";
} else {
// show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, null) specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) final_price " . table_products . " p left join " . table_specials . " s on p.products_id = s.products_id, " . table_products_description . " pd, " . table_manufacturers . " m p.products_status = '1' , pd.products_id = p.products_id , pd.language_id = '" . (int)$languages_id . "' , p.manufacturers_id = m.manufacturers_id , m.manufacturers_id = '" . (int)$http_get_vars['manufacturers_id'] . "'";
}
} else {
// show products in given categorie
if (isset($http_get_vars['filter_id']) && tep_not_null($http_get_vars['filter_id'])) {
// asked show specific catgeory
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, null) specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) final_price " . table_products . " p left join " . table_specials . " s on p.products_id = s.products_id, " . table_products_description . " pd, " . table_manufacturers . " m, " . table_products_to_categories . " p2c p.products_status = '1' , p.manufacturers_id = m.manufacturers_id , m.manufacturers_id = '" . (int)$http_get_vars['filter_id'] . "' , p.products_id = p2c.products_id , pd.products_id = p2c.products_id , pd.language_id = '" . (int)$languages_id . "' , p2c.categories_id = '" . (int)$current_category_id . "'";
} else {
// show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, null) specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) final_price " . table_products_description . " pd, " . table_products . " p left join " . table_manufacturers . " m on p.manufacturers_id = m.manufacturers_id left join " . table_specials . " s on p.products_id = s.products_id, " . table_products_to_categories . " p2c p.products_status = '1' , p.products_id = p2c.products_id , pd.products_id = p2c.products_id , pd.language_id = '" . (int)$languages_id . "' , p2c.categories_id = '" . (int)$current_category_id . "'";
}
}

if ( (!isset($http_get_vars['sort'])) || (!preg_match('/^[1-8][ad]$/', $http_get_vars['sort'])) || (substr($http_get_vars['sort'], 0, 1) > sizeof($column_list)) ) {
($i=0, $n=sizeof($column_list); $i<$n; $i++) {
if ($column_list[$i] == 'product_list_name') {
$http_get_vars['sort'] = $i+1 . 'a';
$listing_sql .= " order pd.products_name";
break;
}
}
} else {
$sort_col = substr($http_get_vars['sort'], 0 , 1);
$sort_order = substr($http_get_vars['sort'], 1);

switch ($column_list[$sort_col-1]) {
case 'product_list_model':
$listing_sql .= " order p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'product_list_name':
$listing_sql .= " order pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
break;
case 'product_list_manufacturer':
$listing_sql .= " order m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'product_list_quantity':
$listing_sql .= " order p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'product_list_image':
$listing_sql .= " order pd.products_name";
break;
case 'product_list_weight':
$listing_sql .= " order p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'product_list_price':
$listing_sql .= " order final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
}
}

$catname = heading_title;
if (isset($http_get_vars['manufacturers_id'])) {
$image = tep_db_query("select manufacturers_image, manufacturers_name catname " . table_manufacturers . " manufacturers_id = '" . (int)$http_get_vars['manufacturers_id'] . "'");
$image = tep_db_fetch_array($image);
$catname = $image['catname'];
} elseif ($current_category_id) {
$image = tep_db_query("select c.categories_image, cd.categories_name catname " . table_categories . " c, " . table_categories_description . " cd c.categories_id = '" . (int)$current_category_id . "' , c.categories_id = cd.categories_id , cd.language_id = '" . (int)$languages_id . "'");
$image = tep_db_fetch_array($image);
$catname = $image['catname'];
}
?>

<h1><?php echo $catname; ?></h1>

<div class="contentcontainer">

<?php
// optional product list filter
if (product_list_filter > 0) {
if (isset($http_get_vars['manufacturers_id'])) {
$filterlist_sql = "select distinct c.categories_id id, cd.categories_name name " . table_products . " p, " . table_products_to_categories . " p2c, " . table_categories . " c, " . table_categories_description . " cd p.products_status = '1' , p.products_id = p2c.products_id , p2c.categories_id = c.categories_id , p2c.categories_id = cd.categories_id , cd.language_id = '" . (int)$languages_id . "' , p.manufacturers_id = '" . (int)$http_get_vars['manufacturers_id'] . "' order cd.categories_name";
} else {
$filterlist_sql= "select distinct m.manufacturers_id id, m.manufacturers_name name " . table_products . " p, " . table_products_to_categories . " p2c, " . table_manufacturers . " m p.products_status = '1' , p.manufacturers_id = m.manufacturers_id , p.products_id = p2c.products_id , p2c.categories_id = '" . (int)$current_category_id . "' order m.manufacturers_name";
}
$filterlist_query = tep_db_query($filterlist_sql);
if (tep_db_num_rows($filterlist_query) > 1) {
echo '<div>' . tep_draw_form('filter', filename_default, 'get') . '<p align="right">' . text_show . '&nbsp;';
if (isset($http_get_vars['manufacturers_id'])) {
echo tep_draw_hidden_field('manufacturers_id', $http_get_vars['manufacturers_id']);
$options = array(array('id' => '', 'text' => text_all_categories));
} else {
echo tep_draw_hidden_field('cpath', $cpath);
$options = array(array('id' => '', 'text' => text_all_manufacturers));
}
echo tep_draw_hidden_field('sort', $http_get_vars['sort']);
while ($filterlist = tep_db_fetch_array($filterlist_query)) {
$options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
}
echo tep_draw_pull_down_menu('filter_id', $options, (isset($http_get_vars['filter_id']) ? $http_get_vars['filter_id'] : ''), 'onchange="this.form.submit()"');
echo tep_hide_session_id() . '</p></form></div>' . "\n";
}
}

include(dir_ws_modules . filename_product_listing);
?>

</div>

<?php
} else { // default page
?>

<h1><?php echo heading_title; ?></h1>

<div class="contentcontainer">
<div class="contenttext">
<?php echo tep_customer_greeting(); ?>
</div>

<?php
if (tep_not_null(text_main)) {
?>

<div class="contenttext">
<?php echo text_main; ?>
</div>

<?php
}

include(dir_ws_modules . filename_new_products);
include(dir_ws_modules . filename_upcoming_products);
?>

</div>

<?php
}

require(dir_ws_includes . 'template_bottom.php');
require(dir_ws_includes . 'application_bottom.php');
?>



Forum The Ubuntu Forum Community Ubuntu Official Flavours Support Installation & Upgrades [ubuntu] OSCommerce broke


Ubuntu

Comments

Popular posts from this blog

Joomal 3.6.3 update error - PHP temporary folder is not set - Joomla! Forum - community, help and support

Upgrade 3.4.8 to 3.5.1 failed "download package failed" - Joomla! Forum - community, help and support

Fatal error during instalation - Joomla! Forum - community, help and support