Closed JeffMash closed 3 weeks ago
That's not the full error; it'll help if you post the overall log with the backtrace. What version of the Bootstrap template?
I sort of have a Frankenstein setup right now. I technically have Bootstrap 3.6.0 installed.......but since I moved over to a PHP 8 server (from a 7.4 server), I have been manually editing the code to make up for some of the PHP warnings I was getting.
This is the particular full warning I am getting:
[30-May-2024 08:28:29 America/Los_Angeles] Request URI: /store/index.php?main_page=best_sellers&disp_order=6&page=4, IP address: 173.252.83.23, Language id 1
#0 /home/mydomain/public_html/store/includes/modules/bootstrap/product_listing.php(410): zen_debug_error_handler()
#1 /home/mydomain/public_html/store/includes/templates/bootstrap/templates/tpl_modules_product_listing.php(12): require('/home/mydomain/...')
#2 /home/mydomain/public_html/store/includes/templates/bootstrap/templates/tpl_best_sellers_default.php(13): require('/home/mydomain/...')
#3 /home/mydomain/public_html/store/includes/templates/bootstrap/common/tpl_main_page.php(257): require('/home/mydomain/...')
#4 /home/mydomain/public_html/store/index.php(94): require('/home/mydomain/...')
--> PHP Warning: Undefined array key "manufacturers_id" in /home/mydomain/public_html/store/includes/modules/bootstrap/product_listing.php on line 410.
[30-May-2024 08:28:29 America/Los_Angeles] Request URI: /store/index.php?main_page=best_sellers&disp_order=6&page=4, IP address: 173.252.83.23, Language id 1
#0 /home/mydomain/public_html/store/includes/modules/bootstrap/product_listing.php(410): zen_debug_error_handler()
#1 /home/mydomain/public_html/store/includes/templates/bootstrap/templates/tpl_modules_product_listing.php(12): require('/home/mydomain/...')
#2 /home/mydomain/public_html/store/includes/templates/bootstrap/templates/tpl_best_sellers_default.php(13): require('/home/mydomain/...')
#3 /home/mydomain/public_html/store/includes/templates/bootstrap/common/tpl_main_page.php(257): require('/home/mydomain/...')
#4 /home/mydomain/public_html/store/index.php(94): require('/home/mydomain/...')
--> PHP Warning: Undefined array key "manufacturers_id" in /home/mydomain/public_html/store/includes/modules/bootstrap/product_listing.php on line 410.
[30-May-2024 08:28:29 America/Los_Angeles] Request URI: /store/index.php?main_page=best_sellers&disp_order=6&page=4, IP address: 173.252.83.23, Language id 1
#0 /home/mydomain/public_html/store/includes/modules/bootstrap/product_listing.php(410): zen_debug_error_handler()
#1 /home/mydomain/public_html/store/includes/templates/bootstrap/templates/tpl_modules_product_listing.php(12): require('/home/mydomain/...')
#2 /home/mydomain/public_html/store/includes/templates/bootstrap/templates/tpl_best_sellers_default.php(13): require('/home/mydomain/...')
#3 /home/mydomain/public_html/store/includes/templates/bootstrap/common/tpl_main_page.php(257): require('/home/mydomain/...')
#4 /home/mydomain/public_html/store/index.php(94): require('/home/mydomain/...')
--> PHP Warning: Undefined array key "manufacturers_id" in /home/mydomain/public_html/store/includes/modules/bootstrap/product_listing.php on line 410.
[30-May-2024 08:28:29 America/Los_Angeles] Request URI: /store/index.php?main_page=best_sellers&disp_order=6&page=4, IP address: 173.252.83.23, Language id 1
#0 /home/mydomain/public_html/store/includes/modules/bootstrap/product_listing.php(410): zen_debug_error_handler()
#1 /home/mydomain/public_html/store/includes/templates/bootstrap/templates/tpl_modules_product_listing.php(12): require('/home/mydomain/...')
#2 /home/mydomain/public_html/store/includes/templates/bootstrap/templates/tpl_best_sellers_default.php(13): require('/home/mydomain/...')
#3 /home/mydomain/public_html/store/includes/templates/bootstrap/common/tpl_main_page.php(257): require('/home/mydomain/...')
#4 /home/mydomain/public_html/store/index.php(94): require('/home/mydomain/...')
--> PHP Warning: Undefined array key "manufacturers_id" in /home/mydomain/public_html/store/includes/modules/bootstrap/product_listing.php on line 410.
It only seems to happen when they are on my bestsellers page: "/store/index.php?main_page=best_sellers&disp_order=6&page=4"
It doesn't seem to happen on normal product browsing.
I will be updating both Bootstrap and OPC soon, but thought I'd post this here in case it was an issue unrelated to my particular server.
Er, where'd that best_sellers
page come from? It's not a 'stock' Zen Cart page.
Hmmmm, I guess it's something we must have added on our own. It basically is a page that lists the top X popular items in our store. This was the PHP file located in includes/modules/pages/best_sellers/header_php.php:
<?php
/**
* Best Seller Page
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* $Id: header_php.php 165 2008-03-21 04:21:50Z yellow1912 $
*/
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$breadcrumb->add(NAVBAR_TITLE);
$disp_order_default = PRODUCT_ALL_LIST_SORT_DEFAULT;
require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_LISTING_DISPLAY_ORDER));
$order_by = !empty($order_by) ? ','.trim(str_replace("order by","",$order_by)) : $order_by;
$listing_sql = "select distinct p.products_id, p.products_image, pd.products_name, p.products_ordered, p.products_price, o.date_purchased, o.orders_id, COUNT(op.products_id), op.orders_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, zen_orders_products op, zen_orders o
where p.products_status = '1'
and p.products_ordered > 0
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_price > '0'
and (o.date_purchased >= DATE_SUB(CURDATE(), INTERVAL 14 DAY) and op.products_id = p.products_id and op.orders_id = o.orders_id)
group by pd.products_name order by COUNT(op.products_id) desc ";
$listing_sql = $db->bindVars($listing_sql, ':languageID', $_SESSION['languages_id'], 'integer');
//check to see if we are in normal mode ... not showcase, not maintenance, etc
$show_submit = zen_run_normal();
$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);
reset($define_list);
$column_list = array();
foreach ($define_list as $key => $value)
{
if ($value > 0) $column_list[] = $key;
}
?>
And here is the code in the includes/modules/sideboxes/bootstrap/best_sellers.php:
<?php
/**
* best_sellers sidebox - displays selected number of (usu top ten) best selling products
*
* @package templateSystem
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: best_sellers.php 2718 2005-12-28 06:42:39Z drbyte $
*/
// test if box should display
$show_best_sellers= true;
if (isset($_GET['products_id'])) {
if (isset($_SESSION['customer_id'])) {
$check_query = "select count(*) as count
from " . TABLE_CUSTOMERS_INFO . "
where customers_info_id = '" . (int)$_SESSION['customer_id'] . "'
and global_product_notifications = '1'";
$check = $db->Execute($check_query);
if ($check->fields['count'] > 0) {
$show_best_sellers= true;
}
}
} else {
$show_best_sellers= true;
}
if ($show_best_sellers == true) {
if (isset($current_category_id) && ($current_category_id > 0)) {
$best_sellers_query = "select distinct p.products_id, p.products_image, pd.products_name, p.products_ordered, p.products_price
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
. TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, zen_orders_products op, zen_orders o
where p.products_status = '1'
and p.products_ordered > 0
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id = p2c.products_id
and p2c.categories_id = c.categories_id
and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id)
and (o.date_purchased >= DATE_SUB(CURDATE(), INTERVAL 30 DAY))
and op.products_id = p.products_id and op.orders_id = o.orders_id
group by pd.products_name order by COUNT(op.products_id) desc
limit " . MAX_DISPLAY_BESTSELLERS;
$best_sellers = $db->Execute($best_sellers_query);
} else {
$best_sellers_query = "select distinct p.products_id, p.products_image, pd.products_name, p.products_ordered, p.products_price, o.date_purchased, o.orders_id, COUNT(op.products_id), op.orders_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, zen_orders_products op, zen_orders o
where p.products_status = '1'
and p.products_ordered > 0
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_price > '0'
and (p.products_date_added >= DATE_SUB(CURDATE(), INTERVAL 30 DAY))
and (o.date_purchased >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) and op.products_id = p.products_id and op.orders_id = o.orders_id)
group by pd.products_name order by COUNT(op.products_id) desc
limit " . MAX_DISPLAY_BESTSELLERS;
$best_sellers = $db->Execute($best_sellers_query);
}
if ($best_sellers->RecordCount() >= MIN_DISPLAY_BESTSELLERS) {
$title = BOX_HEADING_BESTSELLERS;
$box_id = 'bestsellers';
$rows = 0;
while (!$best_sellers->EOF) {
$rows++;
$bestsellers_list[$rows]['id'] = $best_sellers->fields['products_id'];
$bestsellers_list[$rows]['name'] = $best_sellers->fields['products_name'];
$bestsellers_list[$rows]['image'] = $best_sellers->fields['products_image'];
$best_sellers->MoveNext();
}
$title_link = false;
require($template->get_template_dir('tpl_best_sellers.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_best_sellers.php');
$title = BOX_HEADING_BESTSELLERS;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
}
?>
That /includes/modules/bootstrap/sideboxes
file is also a site-specific addition. The Bootstrap template just uses the Zen Cart default.
In PHP 8+, I am seeing this error:
--> PHP Warning: Undefined array key "manufacturers_id" in .../includes/modules/bootstrap/product_listing.php on line 409.
I am wondering if it needs to be defined up around line 149 when initiating the records array?