Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

stderr: PHP Fatal error: Call to a member function display_price()


Guest

Recommended Posts

Posted

HI

 

I am having problem with my installation, my shop front and some of product info page are not displaying properly.

 

First, I get below errors in my log:

PHP Fatal error: Call to a member function count_wishlist() on a non-object in /htdocs/catalog/includes/column_right.php on line 15

 

stderr: PHP Warning: Division by zero in /htdocs/catalog/includes/modules/specials_mod.php on line 52

 

stderr: PHP Fatal error: Call to a member function display_price() on a non-object in /htdocs/catalog/includes/modules/also_purchased_products.php on line 146

 

I noticed those problem after I installed product MSRP, Featured Products, Products in Columns (I used also_purchased_products, specials_mod, best_sellers, featured, new_products configuration files in that package) , Scrolling Specials, Scrolling New Products, wishlist 5.1.

 

My front page: left column below the Cart infobox, and all footers are disappeared. - This happened all nite yesterday, some times display ok, sometimes didnt. Whatever it was, there were above 2 error entry all the time in my error log file.

 

My product info page: whole left column and footer disappeared. It only happens on products that have been reduced via osc build-in special modual, also product quantity set to 0.

 

Please help me to determine whats wrong with my shop please.

 

column_right.php

<?php

/*

$Id: column_right.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require(DIR_WS_BOXES . 'shopping_cart.php');

 

if($wishList->count_wishlist() != '0') {

require(DIR_WS_BOXES . 'wishlist.php');

}

 

if (isset($HTTP_GET_VARS['products_id'])) include(DIR_WS_BOXES . 'manufacturer_info.php');

 

if (tep_session_is_registered('customer_id')) include(DIR_WS_BOXES . 'order_history.php');

 

if (isset($HTTP_GET_VARS['products_id'])) {

if (tep_session_is_registered('customer_id')) {

$check_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "' and global_product_notifications = '1'");

$check = tep_db_fetch_array($check_query);

if ($check['count'] > 0) {

include(DIR_WS_BOXES . 'best_sellers.php');

} else {

include(DIR_WS_BOXES . 'product_notifications.php');

}

} else {

include(DIR_WS_BOXES . 'product_notifications.php');

}

} else {

include(DIR_WS_BOXES . 'best_sellers.php');

}

 

if (isset($HTTP_GET_VARS['products_id'])) {

if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) include(DIR_WS_BOXES . 'tell_a_friend.php');

} else {

include(DIR_WS_BOXES . 'scrolling_specials.php');

}

 

require(DIR_WS_BOXES . 'reviews.php');

 

if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {

include(DIR_WS_BOXES . 'languages.php');

include(DIR_WS_BOXES . 'currencies.php');

}

?>

Posted

special_mod.php

 

<?php

/*

$Id: default_specials.php,v 2.0 2003/06/13

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- default_specials //-->

 

<tr>

</tr>

<tr>

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

<tr>

<?php

 

if (!defined('PRODUCT_LIST_COLUMNS_SPECIALS')) {

tep_db_query(

"insert into configuration

(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added)

VALUES ('Number of products per row on specials products modules', 'PRODUCT_LIST_COLUMNS_SPECIALS', '5', 'Set the number of products per row to display?', '8', '26', now());"

);

define('PRODUCT_LIST_COLUMNS_SPECIALS', '5');

}

 

if (!defined('MAX_DISPLAY_SPECIALS_PRODUCTS_MODULE')) {

tep_db_query(

"insert into configuration

(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added)

VALUES ('Maximum number display special products on speical modules', 'MAX_DISPLAY_SPECIALS_PRODUCTS_MODULE', '10', 'Set maximum number of products to display?', '8', '27', now());"

);

define('MAX_DISPLAY_SPECIALS_PRODUCTS_MODULE', '10');

}

 

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_SPECIALS_PRODUCTS_MODULE, strftime('%B')));

new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));

 

$new = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and s.status = '1' order by s.specials_date_added DESC limit " . MAX_DISPLAY_SPECIALS_PRODUCTS_MODULE);

 

$info_box_contents = array();

$row = 0;

$col = 0;

while ($default_specials = tep_db_fetch_array($new)) {

$default_specials['products_name'] = tep_get_products_name($default_specials['products_id']);

$info_box_contents[$row][$col] = array('align' => 'center',

'params' => 'class="smallText" width="'. round(100/PRODUCT_LIST_COLUMNS_SPECIALS) .'%" valign="top"',

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials["products_id"]) . '">' . tep_image(DIR_WS_IMAGES . $default_specials['products_image'], $default_specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials['products_id']) . '">' . $default_specials['products_name'] . '</a><br><s>' . $currencies->display_price($default_specials['products_price'], tep_get_tax_rate($default_specials['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($default_specials['specials_new_products_price'], tep_get_tax_rate($default_specials['products_tax_class_id'])) . '</span>');

 

$col ++;

if ($col > (PRODUCT_LIST_COLUMNS_SPECIALS-1)) {

$col = 0;

$row ++;

}

}

 

while ($col != 0 && sizeof($info_box_contents[$row]) < PRODUCT_LIST_COLUMNS_SPECIALS) {

$info_box_contents[$row][$col] = array(

'align' => 'center',

'params' => 'width="'. round(100/PRODUCT_LIST_COLUMNS_SPECIALS) .'%"',

'text' => ' '

);

 

$col ++;

}

new contentBox($info_box_contents);

?>

 

<!-- default_specials_eof //-->

Posted

also_purchased_products.php

 

<?php

/*

$Id: also_purchased_products.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

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

 

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

}

}

 

if (isset($_GET['products_id'])) {

$orders_query = tep_db_query(

"select p.products_id, p.products_image, p.products_model, p.products_quantity, p.products_weight, p.products_price, p.products_tax_class_id, m.manufacturers_name

from

" . TABLE_ORDERS_PRODUCTS . " opa,

" . TABLE_ORDERS_PRODUCTS . " opb,

" . TABLE_ORDERS . " o,

" . TABLE_PRODUCTS . " p,

" . TABLE_MANUFACTURERS ." m

where opa.products_id = '" . (int)$_GET['products_id'] . "'

and opa.orders_id = opb.orders_id

and opb.products_id != '" . (int)$_GET['products_id'] . "'

and opb.products_id = p.products_id

and opb.orders_id = o.orders_id

and p.products_status = '1'

and p.manufacturers_id = m.manufacturers_id

group by p.products_id

order by o.date_purchased desc

limit " . MAX_DISPLAY_ALSO_PURCHASED

);

$num_products_ordered = tep_db_num_rows($orders_query);

if ($num_products_ordered >= MIN_DISPLAY_ALSO_PURCHASED) {

?>

<!-- also_purchased_products //-->

<?php

 

if (!defined('PRODUCT_LIST_COLUMNS_ALSO_PURCHASED')) {

tep_db_query(

"insert into configuration

(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added)

VALUES ('Number of products per row on also purchased modules', 'PRODUCT_LIST_COLUMNS_ALSO_PURCHASED', '5', 'Set the number of products per row to display?', '8', '22', now());"

);

define('PRODUCT_LIST_COLUMNS_ALSO_PURCHASED', '5');

}

 

$info_box_contents = array();

$info_box_contents[] = array('text' => TEXT_ALSO_PURCHASED_PRODUCTS);

 

new contentBoxHeading($info_box_contents);

 

$row = 0;

$col = 0;

$info_box_contents = array();

while ($orders = tep_db_fetch_array($orders_query)) {

 

$lc_align = 'center';

$lc_text = '<table cellpadding="2" cellspacing="0" border="0">' . "\r\n";

 

foreach ($column_list as $column) {

switch($column) {

 

// Row: Products model

case 'PRODUCT_LIST_MODEL':

$lc_text .= ' <tr>' . "\r\n"

. ' <td class="main" align="center">'. $orders['products_model'] . '</td>' . "\r\n"

. ' </tr>' . "\r\n";

break;

 

// Row: Product's image

case 'PRODUCT_LIST_IMAGE':

$lc_text .= ' <tr>' . "\r\n"

. ' <td class="main" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, (isset($_GET['manufacturers_id']) ? 'manufacturers_id=' . $_GET['manufacturers_id'] : ($cPath ? 'cPath=' . $cPath : '')) . '&products_id=' . $orders['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $orders['products_image'], $orders['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' . "\r\n"

. ' </tr>' . "\r\n";

break;

 

// Row: Product's name

case 'PRODUCT_LIST_NAME':

$lc_text .= ' <tr>' . "\r\n"

. ' <td class="main" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, (isset($_GET['manufacturers_id']) ? 'manufacturers_id=' . $_GET['manufacturers_id'] : ($cPath ? 'cPath=' . $cPath : '')) . '&products_id=' . $orders['products_id']) . '">' . tep_get_products_name($orders['products_id']) . '</a></td>' . "\r\n"

. ' </tr>' . "\r\n";

break;

 

// Row: Manufacturer's name

case 'PRODUCT_LIST_MANUFACTURER':

$lc_text .= ' <tr>' . "\r\n"

. ' <td class="main" align="center"><span style="color: #666666;">'. $orders['manufacturers_name'] . '</span></td>' . "\r\n"

. ' </tr>' . "\r\n";

break;

 

// Row: Price

case 'PRODUCT_LIST_PRICE':

$orders['specials_new_products_price'] = tep_get_products_special_price($orders['products_id']);

if (tep_not_null($orders['specials_new_products_price'])) {

$lc_text .= ' <tr>' . "\r\n"

. ' <td class="main" align="center"><s>' . $currencies->display_price($orders['products_price'], tep_get_tax_rate($orders['products_tax_class_id'])) .'</s><br><span class="productSpecialPrice">'. $currencies->display_price($orders['specials_new_products_price'], tep_get_tax_rate($orders['products_tax_class_id'])) . '</span></td>' . "\r\n"

. ' </tr>' . "\r\n";

} else {

$lc_text .= ' <tr>' . "\r\n"

. ' <td class="main" align="center">' . $currencies->display_price($orders['products_price'], tep_get_tax_rate($orders['products_tax_class_id'])) . '</td>' . "\r\n"

. ' </tr>' . "\r\n";

}

break;

 

// Row: Product's quantity

case 'PRODUCT_LIST_QUANTITY':

$lc_text .= ' <tr>' . "\r\n"

. ' <td class="main" align="center">'. TABLE_HEADING_QUANTITY .': '. $orders['products_quantity'] . '</td>' . "\r\n"

. ' </tr>' . "\r\n";

break;

 

// Row: Product's weight

case 'PRODUCT_LIST_WEIGHT':

$lc_text .= ' <tr>' . "\r\n"

. ' <td class="main" align="center">'. TABLE_HEADING_WEIGHT .': '. $orders['products_weight'] . '</td>' . "\r\n"

. ' </tr>' . "\r\n";

break;

 

// Row: Buy now button

case 'PRODUCT_LIST_BUY_NOW':

$lc_text .= ' <tr>' . "\r\n"

. ' <td class="main" align="center"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $orders['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a></td>' . "\r\n"

. ' </tr>' . "\r\n";

break;

}

}

 

$lc_text .= '</table>' . "\r\n";

 

 

$info_box_contents[$row][$col] = array('align' => 'center',

'params' => 'class="smallText" width="'. round(100/PRODUCT_LIST_COLUMNS_ALSO_PURCHASED) .'%" valign="top"',

'text' => $lc_text);

 

$col ++;

if ($col > (PRODUCT_LIST_COLUMNS_ALSO_PURCHASED-1)) {

$col = 0;

$row ++;

}

}

 

while ($col != 0 && sizeof($info_box_contents[$row]) < PRODUCT_LIST_COLUMNS_ALSO_PURCHASED) {

$info_box_contents[$row][$col] = array('align' => 'center',

'params' => 'class="smallText" width="'. round(100/PRODUCT_LIST_COLUMNS_ALSO_PURCHASED) .'%" valign="top"',

'text' => ' ');

$col ++;

}

 

new contentBox($info_box_contents);

?>

<!-- also_purchased_products_eof //-->

<?php

}

}

?>

Archived

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

×
×
  • Create New...