Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Division by Zero Error???? HELP!


busybuds

Recommended Posts

:'(

 

I am getting an error on the homepage of the site:

 

Warning: Division by zero in /home/busybuds/public_html/ecommerce/os/catalog/index.php on line 33

 

 

Here are the lines from 28-34.

 

Line 28: require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

Line 29:

Line 30: ?>

Line 31:

Line 32:<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

Line 33:<html <?php echo HTML_PARAMS; ?>>

Line 34:<head>

 

The URL is:

http://busybuds.com/ecommerce/os/catalog/index.php

 

I am very new to PHP and am not a programmer so layman's terms would be much appreciated. I have done a search on the forum for this error and I'm getting an error on my search phrase "division by zero error".

 

Any help would be a godsend...

 

Thanks,

Linda

www.busybuds.com

Link to comment
Share on other sites

You haven't posted the right lines - it's hard to tell by line counting, since the php interpreter doesn't count lines in the way you'd expect normally.

 

Post the first 50 lines of this file.

 

Here they are...thanks:

 

<?php

/*

$Id: index.php,v 1.1 2004/08/25 22:44:42 akhan Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// the following cPath references come from application_top.php

$category_depth = 'top';

if (isset($cPath) && tep_not_null($cPath)) {

$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

$cateqories_products = tep_db_fetch_array($categories_products_query);

if ($cateqories_products['total'] > 0) {

$category_depth = 'products'; // display products

} else {

$category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where 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 the categories

} else {

$category_depth = 'products'; // category has no products, but display the 'no products' message

}

}

}

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?> ">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

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

</head>

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

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

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

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

 

Linda

www.busybuds.com

Link to comment
Share on other sites

I'm thinking this line might be the problem:

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

 

maybe FILENAME_DEFAULT is zero for some reason and it's trying to evaulate as a numeric.

 

add this line just before the above line

echo "filename_default=" . FILENAME_DEFAULT;

 

 

this will output this so you can see what its value is.

Link to comment
Share on other sites

The above is a path and not a PHP divide statement.

 

www.busybuds.com is not an oscommerce store. I don't know of any "division" calculations in the catalog/index.php standard file.

 

Can you post a link to the oscommerce site you are having the problem with?

 

Tom

Link to comment
Share on other sites

I'm thinking this line might be the problem:

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

 

maybe FILENAME_DEFAULT is zero for some reason and it's trying to evaulate as a numeric.

 

add this line just before the above line

echo "filename_default=" . FILENAME_DEFAULT;

this will output this so you can see what its value is.

 

 

filename_default=index.php

Warning: Division by zero in /home/busybuds/public_html/ecommerce/os/catalog/index.php on line 34

 

is now the error on the page.

 

Thanks,

Linda

www.busybuds.com

Link to comment
Share on other sites

Probably a problem in your index.php language file.

Can you post the contents of this file:

 

includes/languages/english/index.php

 

 

<?php

/*

$Id: index.php,v 1.1 2004/08/25 23:11:33 akhan Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

define('TEXT_MAIN', 'Whether you are looking for the perfect gift, a memorable favor or a unique way to promote your business, we have something for you.<br><br>

We offer many items that you can personalize unlike any that you have seen before.<br><br>Most designs can be customized to fit your occasion even if you see it under a different category, so its a great idea to look around. We can also create a custom design to your specifications at no additional charge.<br><br>We accept most major Credit Cards through PayPal who handle 35 million members worldwide,

so you can be comfortable of a secure and reliable transaction.<br><br>Check back often as there will be new items and designs added on a regular basis.

 

<br><br><table border="0" width="100%" cellspacing="5" cellpadding="2"><tr><td class="main" valign="top">' . '</td><td class="main" valign="top"><b></b><br><br></td></tr><td class="main" valign="top">' . '</td><td class="main" valign="top"><b></b><br><br><br><br><nobr class="messageStackSuccess">'/' ->Define</nobr> or <nobr class="messageStackSuccess">Tools->File Manager</nobr> modules.<br><br><nobr>define(\'TEXT_MAIN\', \'<span class="messageStackSuccess"></span>\');</nobr><br><br><br><br><nobr>define(\'TEXT_MAIN\', \'\');</nobr><br><br></td></tr><tr><td class="main" valign="top">' .'</td><td class="main" valign="top"><b></td></tr><tr><td class="main" valign="top">' . '</td><td class="main" valign="top"><b></b><br><br><br><br></td></tr></table><br>');

define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');

define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Upcoming Products');

define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected');

 

if ( ($category_depth == 'products') || (isset($HTTP_GET_VARS['manufacturers_id'])) ) {

define('HEADING_TITLE', '');

define('TABLE_HEADING_IMAGE', '');

define('TABLE_HEADING_MODEL', 'Model');

define('TABLE_HEADING_PRODUCTS', 'Product Name');

define('TABLE_HEADING_MANUFACTURER', 'Manufacturer');

define('TABLE_HEADING_QUANTITY', 'Quantity');

define('TABLE_HEADING_PRICE', 'Price');

define('TABLE_HEADING_WEIGHT', 'Weight');

define('TABLE_HEADING_BUY_NOW', 'Buy Now');

define('TEXT_NO_PRODUCTS', 'There are no products to list in this category.');

define('TEXT_NO_PRODUCTS2', 'There is no product available from this manufacturer.');

define('TEXT_NUMBER_OF_PRODUCTS', 'Number of Products: ');

define('TEXT_SHOW', '<b>Show:</b>');

define('TEXT_BUY', 'Buy 1 \'');

define('TEXT_NOW', '\' now');

define('TEXT_ALL_CATEGORIES', 'All Categories');

define('TEXT_ALL_MANUFACTURERS', 'All Manufacturers');

} elseif ($category_depth == 'top') {

define('HEADING_TITLE', 'What\'s New Here?');

} elseif ($category_depth == 'nested') {

define('HEADING_TITLE', 'Categories');

}

?>

 

Thanks,

Linda

www.busybuds.com

Link to comment
Share on other sites

wow, what a mess!

<br><br><table border="0" width="100%" cellspacing="5" cellpadding="2"><tr><td class="main" valign="top">' . '</td><td class="main" valign="top"><b></b><br><br></td></tr><td class="main" valign="top">' . '</td><td class="main" valign="top"><b></b><br><br><br><br><nobr class="messageStackSuccess">'/' ->Define</nobr> or <nobr class="messageStackSuccess">Tools->File Manager</nobr> modules.<br><br><nobr>define(\'TEXT_MAIN\', \'<span class="messageStackSuccess"></span>\');</nobr><br><br><br><br><nobr>define(\'TEXT_MAIN\', \'\');</nobr><br><br></td></tr><tr><td class="main" valign="top">' .'</td><td class="main" valign="top"><b></td></tr><tr><td class="main" valign="top">' . '</td><td class="main" valign="top"><b></b><br><br><br><br></td></tr></table><br>');

 

This line is where the problem is

 

Edit:

Have you tried to add a template system of some sort? If not, I suggest you get hold of the original index.php file and start again.

Link to comment
Share on other sites

wow, what a mess!

<br><br><table border="0" width="100%" cellspacing="5" cellpadding="2"><tr><td class="main" valign="top">' . '</td><td class="main" valign="top"><b></b><br><br></td></tr><td class="main" valign="top">' . '</td><td class="main" valign="top"><b></b><br><br><br><br><nobr class="messageStackSuccess">'/' ->Define</nobr> or <nobr class="messageStackSuccess">Tools->File Manager</nobr> modules.<br><br><nobr>define(\'TEXT_MAIN\', \'<span class="messageStackSuccess"></span>\');</nobr><br><br><br><br><nobr>define(\'TEXT_MAIN\', \'\');</nobr><br><br></td></tr><tr><td class="main" valign="top">' .'</td><td class="main" valign="top"><b></td></tr><tr><td class="main" valign="top">' . '</td><td class="main" valign="top"><b></b><br><br><br><br></td></tr></table><br>');

 

This line is where the problem is

 

Told you I was new :blush:

 

What do I need to do...delete it? :(

 

Thanks for all your help...I really, really appreciate it.

 

Linda

www.busybuds.com

Link to comment
Share on other sites

Told you I was new  :blush:

 

What do I need to do...delete it?  :(

 

Thanks for all your help...I really, really appreciate it.

 

Linda

www.busybuds.com

 

oops...missed the last part of your message...I will get the original and try again.

Thank you so much for your help.

 

Linda

www.busybuds.com

Link to comment
Share on other sites

Original index.php file below: I suggest backing up the one you have now (so you don't lose all your text and can copy and paste again), and try again using this file.

 

 

<?php

/*

$Id: index.php,v 1.1 2003/06/11 17:38:00 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

define('TEXT_MAIN', 'This is a default setup of the osCommerce project, products shown are for demonstrational purposes, <b>any products purchased will not be delivered nor will the customer be billed</b>. Any information seen on these products is to be treated as fictional.<br><br><table border="0" width="100%" cellspacing="5" cellpadding="2"><tr><td class="main" valign="top">' . tep_image(DIR_WS_IMAGES . 'default/1.gif') . '</td><td class="main" valign="top"><b>Error Messages</b><br><br>If there are any error or warning messages shown above, please correct them first before proceeding.<br><br>Error messages are displayed at the very top of the page with a complete <span class="messageStackError">background</span> color.<br><br>Several checks are performed to ensure a healthy setup of your online store - these checks can be disabled by editing the appropriate parameters at the bottom of the includes/application_top.php file.</td></tr><td class="main" valign="top">' . tep_image(DIR_WS_IMAGES . 'default/2.gif') . '</td><td class="main" valign="top"><b>Editing Page Texts</b><br><br>The text shown here can be modified in the following file, on each language basis:<br><br><nobr class="messageStackSuccess">[path to catalog]/includes/languages/' . $language . '/' . FILENAME_DEFAULT . '</nobr><br><br>That file can be edited manually, or via the Administration Tool with the <nobr class="messageStackSuccess">Languages->' . ucfirst($language) . '->Define</nobr> or <nobr class="messageStackSuccess">Tools->File Manager</nobr> modules.<br><br>The text is set in the following manner:<br><br><nobr>define(\'TEXT_MAIN\', \'<span class="messageStackSuccess">This is a default setup of the osCommerce project...</span>\');</nobr><br><br>The text highlighted in green may be modified - it is important to keep the define() of the TEXT_MAIN keyword. To remove the text for TEXT_MAIN completely, the following example is used where only two single quote characters exist:<br><br><nobr>define(\'TEXT_MAIN\', \'\');</nobr><br><br>More information concerning the PHP define() function can be read <a href="http://www.php.net/define" target="_blank"><u>here</u></a>.</td></tr><tr><td class="main" valign="top">' . tep_image(DIR_WS_IMAGES . 'default/3.gif') . '</td><td class="main" valign="top"><b>Securing The Administration Tool</b><br><br>It is important to secure the Administration Tool as there is currently no security implementation available.</td></tr><tr><td class="main" valign="top">' . tep_image(DIR_WS_IMAGES . 'default/4.gif') . '</td><td class="main" valign="top"><b>Online Documentation</b><br><br>Online documentation can be read at the <a href="http://wiki.oscommerce.com" target="_blank"><u>osCommerce Wiki Documentation Effort</u></a> site.<br><br>Community support is available at the <a href="http://www.oscommerce.com/forums" target="_blank"><u>osCommerce Community Support Forums</u></a> site.</td></tr></table><br>If you wish to download the solution powering this shop, or if you wish to contribute to the osCommerce project, please visit the <a href="http://www.oscommerce.com" target="_blank"><u>support site of osCommerce</u></a>. This shop is running on osCommerce version <font color="#f0000"><b>' . PROJECT_VERSION . '</b></font>.');

define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');

define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Upcoming Products');

define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected');

 

if ( ($category_depth == 'products') || (isset($HTTP_GET_VARS['manufacturers_id'])) ) {

define('HEADING_TITLE', 'Let\'s See What We Have Here');

define('TABLE_HEADING_IMAGE', '');

define('TABLE_HEADING_MODEL', 'Model');

define('TABLE_HEADING_PRODUCTS', 'Product Name');

define('TABLE_HEADING_MANUFACTURER', 'Manufacturer');

define('TABLE_HEADING_QUANTITY', 'Quantity');

define('TABLE_HEADING_PRICE', 'Price');

define('TABLE_HEADING_WEIGHT', 'Weight');

define('TABLE_HEADING_BUY_NOW', 'Buy Now');

define('TEXT_NO_PRODUCTS', 'There are no products to list in this category.');

define('TEXT_NO_PRODUCTS2', 'There is no product available from this manufacturer.');

define('TEXT_NUMBER_OF_PRODUCTS', 'Number of Products: ');

define('TEXT_SHOW', '<b>Show:</b>');

define('TEXT_BUY', 'Buy 1 \'');

define('TEXT_NOW', '\' now');

define('TEXT_ALL_CATEGORIES', 'All Categories');

define('TEXT_ALL_MANUFACTURERS', 'All Manufacturers');

} elseif ($category_depth == 'top') {

define('HEADING_TITLE', 'What\'s New Here?');

} elseif ($category_depth == 'nested') {

define('HEADING_TITLE', 'Categories');

}

?>

Link to comment
Share on other sites

Thank you soooo much for your help....it's fixed. :thumbsup:

 

Being so new, it's hard to know what file each change is effecting.

 

Is there a way to print out a chart of some sorts of all the files and how they are linked?

 

Thanks again,

Linda

www.busybuds.com

Link to comment
Share on other sites

Not really, but the more you play around with it, the more familiar you'll become with how it all works. After a couple of months you should be able to troubleshoot problems in a matter of seconds. Don't expect miracles if you are new though - it takes time!

Link to comment
Share on other sites

Not really, but the more you play around with it, the more familiar you'll become with how it all works. After a couple of months you should be able to troubleshoot problems in a matter of seconds. Don't expect miracles if you are new though - it takes time!

 

A couple of months...I want to know all this yesterday...just kidding!

 

Thank you so much for helping me solve my first problem that I couldn't figure out myself.

I'm sure there will be many more.

 

Thanks again,

Linda

www.busybuds.com

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...