Hi MC - so following one of your suggestions I used cPanel to access error logs as a validator per se and whilst the latest errors shown in logs using my ftp client were dated 10 August there were errors generated right up until today's date in the file manager in cPanel - I have no idea what may be causing this but will ask my host.
Anyway here is the latest error with Categories - Always show on main page switched to 'on'
Code:
[12-Sep-2018 10:51:36 Australia/Melbourne] Request URI: /teststore/, IP address: 203.63.42.62
#1 zen_categories_ul_generator->buildBranch() called at [/home/treeofl3/public_html/teststore/includes/classes/categories_ul_generator.php:85]
#2 zen_categories_ul_generator->buildTree() called at [/home/treeofl3/public_html/teststore/includes/templates/westminster_new/templates/tpl_modules_mobile_categories_tabs.php:27]
#3 require(/home/treeofl3/public_html/teststore/includes/templates/westminster_new/templates/tpl_modules_mobile_categories_tabs.php) called at [/home/treeofl3/public_html/teststore/includes/templates/westminster_new/common/tpl_header.php:134]
#4 require(/home/treeofl3/public_html/teststore/includes/templates/westminster_new/common/tpl_header.php) called at [/home/treeofl3/public_html/teststore/includes/templates/westminster_new/common/tpl_main_page.php:182]
#5 require(/home/treeofl3/public_html/teststore/includes/templates/westminster_new/common/tpl_main_page.php) called at [/home/treeofl3/public_html/teststore/index.php:97]
[12-Sep-2018 10:51:36 Australia/Melbourne] PHP Warning: A non-numeric value encountered in /home/treeofl3/public_html/teststore/includes/classes/categories_ul_generator.php on line 58
[12-Sep-2018 10:51:36 Australia/Melbourne] PHP Fatal error: Uncaught Error: Cannot use string offset as an array in /home/treeofl3/public_html/teststore/includes/modules/westminster_new/category_row.php:39
Stack trace:
#0 /home/treeofl3/public_html/teststore/includes/templates/template_default/templates/tpl_modules_category_row.php(14): require()
#1 /home/treeofl3/public_html/teststore/includes/templates/westminster_new/templates/tpl_index_categories.php(107): require('/home/treeofl3/...')
#2 /home/treeofl3/public_html/teststore/includes/modules/pages/index/main_template_vars.php(236): require('/home/treeofl3/...')
#3 /home/treeofl3/public_html/teststore/includes/templates/westminster_new/common/tpl_main_page.php(253): require('/home/treeofl3/...')
#4 /home/treeofl3/public_html/teststore/index.php(97): require('/home/treeofl3/...')
#5 {main}
thrown in /home/treeofl3/public_html/teststore/includes/modules/westminster_new/category_row.php on line 39
here are the two files highlighted as php warnings;
includes/classes/categories_ul_generator.php
Code:
<?php
//placeholder21// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright(c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright(c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: categories_ul_generator.php 2004-07-11 DrByteZen $
// based on site_map.php v1.0.1 by networkdad 2004-06-04
//
class zen_categories_ul_generator {
var $root_category_id = 0,
$max_level = 0,
$data = array(),
$parent_group_start_string = '<ul%s>',
$parent_group_end_string = '</ul>',
$child_start_string = '<li%s>',
$child_end_string = '</li>',
$spacer_string = '
',
$spacer_multiplier = 1;
var $document_types_list = ' (3) ';
// acceptable format example: ' (3, 4, 9, 22, 18) '
function zen_categories_ul_generator($load_from_database = true)
{
global $languages_id, $db;
$this->data = array();
$categories_query = "select c.categories_id, cd.categories_name, c.parent_id
from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
where c.categories_id = cd.categories_id
and c.categories_status=1 " .
" and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
" order by c.parent_id, c.sort_order, cd.categories_name";
$categories = $db->Execute($categories_query);
while (!$categories->EOF) {
$this->data[$categories->fields['parent_id']][$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'], 'count' => 0);
$categories->MoveNext();
}
}
function buildBranch($parent_id, $level = 0, $submenu=true, $parent_link='')
{
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level+1) . '"' : '' );
if (($this->data[$parent_id])) {
foreach($this->data[$parent_id] as $category_id => $category) {
$category_link = $parent_link . $category_id;
if (($this->data[$category_id])) {
$result .= sprintf($this->child_start_string, ($submenu==true) ? ' class="submenu"' : '');
} else {
$result .= sprintf($this->child_start_string, '');
}
$result .= str_repeat($this->spacer_string, $this->spacer_multiplier * 1) . '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">';
$result .= $category['name'];
$result .= '</a>';
if (($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
$result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
}
$result .= $this->child_end_string;
}
}
$result .= $this->parent_group_end_string;
return $result;
}
function buildTree($submenu=false)
{
return $this->buildBranch($this->root_category_id, '', $submenu);
}
}
?>
includes/module/westminster_new/category_row.php
Code:
<?php
/**
* index category_row.php
*
* Prepares the content for displaying a category's sub-category listing in grid format.
* Once the data is prepared, it calls the standard tpl_list_box_content template for display.
*
* @package page
* @copyright Copyright 2003-2006 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: category_row.php 4084 2006-08-06 23:59:36Z drbyte $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
$title = '';
$num_categories = $categories->RecordCount();
$row = 0;
$col = 0;
$list_box_contents = '';
if ($num_categories > 0) {
if ($num_categories < MAX_DISPLAY_CATEGORIES_PER_ROW || MAX_DISPLAY_CATEGORIES_PER_ROW == 0) {
$col_width = floor(100/$num_categories);
} else {
$col_width = floor(100/MAX_DISPLAY_CATEGORIES_PER_ROW);
}
while (!$categories->EOF) {
if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';
$cPath_new = zen_get_path($categories->fields['categories_id']);
// strip out 0_ from top level cats
$cPath_new = str_replace('=0_', '=', $cPath_new);
// $categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);
$list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => '<div class="common-wrap"><a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'] . '</a></div>');
$col ++;
if ($col > (MAX_DISPLAY_CATEGORIES_PER_ROW -1)) {
$col = 0;
$row ++;
}
$categories->MoveNext();
}
}
?>
Hopefully this will help you to help me solve the problem.
cheers,
Mike
Bookmarks