Re: MultiSite Module Support Thread
I'm racking my brain at how to say this nicely but, those looking at posts for answers need to realize that (as in this case) some of the folks shoot themselves in the foot and then want to complain.
Unfortunately, you were using a ZC version released over eight years ago using a PHP version that was End Of Life over six years ago.
And then, that nasty host had the audacity to upgrade to PHP 5.6 which was EOL two years ago.:P They could have updated to PHP 7.2 BUT, that was EOL a month ago. Even PHP 7.3 will go EOL in a year. The good news is that you can get 1.5.7b going with PHP 5.6. However, I'd be concerned about when the host is going to be able to provide for your newer needs.
It depends on the terms and conditions of your host as to whether or not they were required to notify you of the changes in hosting. We keep track of who's using what and would never drop their coverage without notifying them ahead of time. Fortunately, other features of our servers allow us to do this without losing security.
I'm not saying everyone has to jump with every release of MySQL, PHP or Zen Cart. However, in the world of the internet and e-commerce, just two years behind can make a huge difference in the operation of your store.
One case in point was an upgrade to 1.5.7b from 1.5.3. The store owner was concerned that business was getting slower and slower. Had no idea that there were nearly 100,000 debug files in the logs folder. In 1.5.7#, it's just a simple click to have Zen Cart let you know when something goes bump in the night.
Bottom line here is that I fear you are going to try to run two stores with neither having a solid foundation. Please find a way to get to 1.5.7b with PHP 7.4 and make your foundation solid before putting two stores on it. Leave the old store running and build with the new. Don't make matters worse trying to continually put bandaids on your site.
This mod can be very helpful and, with DrByte's efforts, you'll more than likely have a working solution IF you get the foundation repairs completed.
Re: MultiSite Module Support Thread
Quote:
However, that said, attached is an updated beta of the multisite mod with the v157 updates merged into it.
I will definitely install in sandbox and try it.
Quote:
I'm racking my brain at how to say this nicely but, those looking at posts for answers need to realize that (as in this case) some of the folks shoot themselves in the foot and then want to complain.
Great advice!
Some people will not even delete old folders and/or installations and then they get hacked. They don't understand there's an open door in their server, when they do that.
Re: MultiSite Module Support Thread
Indeed. Good advice and taken.. Oh I am NOT asking for any sympathy or understanding...it was entirely within our power to avoid the disaster. It was entirely self inflicted. It just sucked worse because it happened on the holiday weekend.
Currently, the primary store has been rebuilt with Zen Cart 1.5.7b, with PHP 7.4,13 and MySQL 5.6. Just sorting out some weirdness that has occurred because of other issues that appeared. We aren't even going to try multisite until everything shakes out for a time.
Re: MultiSite Module Support Thread
ok I am using zencart 156c
of have ceon url mapping.. (latest one)
i am trying to use the fluorspar 6.1
cookies mod.
and multi-site
and i got a blank front page and the debug file below. and i have reloaded and reloaded and keep getting this debug error and blank front page.
now i put the line the code says.. hopefully it helps. and what else i need just let me know.
[10-Jan-2021 07:18:44 UTC] PHP Fatal error: Uncaught Error: Call to a member function add() on null in /home/herasonl/public_html/shop/includes/init_includes/overrides/init_sessions.php:15
$breadcrumb->add(HEADER_TITLE_CATALOG, zen_href_link(FILENAME_DEFAULT)); line 15 of init_sessions.php
Stack trace:
#0 /home/herasonl/public_html/shop/includes/autoload_func.php(48): require()
/**
* include an init_script as specified by autoloader array
*/
require($baseDir . $entry['loadFile']); line 40 of autoload
#1 /home/herasonl/public_html/shop/includes/application_top.php(170): require('/home/herasonl/...')
require('includes/autoload_func.php'); line 170
#2 /home/herasonl/public_html/shop/index.php(26): require('/home/herasonl/...')
#3 {main}
thrown in /home/herasonl/public_html/shop/includes/init_includes/overrides/init_sessions.php on line 15
require('includes/application_top.php');
[10-Jan-2021 07:18:44 UTC] Request URI: /shop/index.php?main_page=index&cPath=21, IP address: 24.113.216.190
--> PHP Fatal error: Uncaught Error: Call to a member function add() on null in /home/herasonl/public_html/shop/includes/init_includes/overrides/init_sessions.php:15
Stack trace:
#0 /home/herasonl/public_html/shop/includes/autoload_func.php(48): require()
#1 /home/herasonl/public_html/shop/includes/application_top.php(170): require('/home/herasonl/...')
#2 /home/herasonl/public_html/shop/index.php(26): require('/home/herasonl/...')
#3 {main}
thrown in /home/herasonl/public_html/shop/includes/init_includes/overrides/init_sessions.php on line 15.
Re: MultiSite Module Support Thread
Quote:
Originally Posted by
noppie
PHP Fatal error: Uncaught Error: Call to a member function add() on null in /includes/init_includes/overrides/init_sessions.php:15
$breadcrumb->add(HEADER_TITLE_CATALOG, zen_href_link(FILENAME_DEFAULT)); line 15 of init_sessions.php
That means $breadcrumb hasn't been initialized/created yet, which is expected because init_sessions loads at order 70 whereas breadcrumbs at 160.
I'm not sure why line 15 of your init_sessions would be setting a breadcrumb yet.
Re: MultiSite Module Support Thread
Quote:
Originally Posted by
DrByte
the multi-site has the init_sessions.php in the overrides file.. and it is below.. thank you
<?php
/**
* create the breadcrumb trail
* see {@link http://www.zen-cart.com/wiki/index.p...als#InitSystem wikitutorials} for more details.
*
* @package initSystem
* @copyright Copyright 2003-2019 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: Zen4All 2019 Jul 07 Modified in v1.5.6c $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
$breadcrumb->add(HEADER_TITLE_CATALOG, zen_href_link(FILENAME_DEFAULT));
/**
* add category names or the manufacturer name to the breadcrumb trail
*/
if (!isset($robotsNoIndex)) $robotsNoIndex = false;
// might need isset($_GET['cPath']) later ... right now need $cPath or breaks breadcrumb from sidebox etc.
if (isset($cPath_array) && isset($cPath)) {
for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) {
// bof Multi site
$categories_query = "select categories_name
from " . TABLE_CATEGORIES_DESCRIPTION . "
where categories_id = '" . (int)$cPath_array[$i] . "'
and categories_id!='".CATEGORIES_ROOT."'
and language_id = '" . (int)$_SESSION['languages_id'] . "'";
// bof Multi site
$categories = $db->Execute($categories_query);
if ($categories->RecordCount() > 0) {
$breadcrumb->add($categories->fields['categories_name'], zen_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));
} elseif(SHOW_CATEGORIES_ALWAYS == 0) {
// if invalid, set the robots noindex/nofollow for this page
$robotsNoIndex = true;
break;
}
}
}
/**
* add get terms (e.g manufacturer, music genre, record company or other user defined selector) to breadcrumb
*/
$sql = "select *
from " . TABLE_GET_TERMS_TO_FILTER;
$get_terms = $db->execute($sql);
while (!$get_terms->EOF) {
if (isset($_GET[$get_terms->fields['get_term_name']])) {
$sql = "select " . $get_terms->fields['get_term_name_field'] . "
from " . constant($get_terms->fields['get_term_table']) . "
where " . $get_terms->fields['get_term_name'] . " = " . (int)$_GET[$get_terms->fields['get_term_name']];
$get_term_breadcrumb = $db->execute($sql);
if ($get_term_breadcrumb->RecordCount() > 0) {
$breadcrumb->add($get_term_breadcrumb->fields[$get_terms->fields['get_term_name_field']], zen_href_link(FILENAME_DEFAULT, $get_terms->fields['get_term_name'] . "=" . $_GET[$get_terms->fields['get_term_name']]));
}
}
$get_terms->MoveNext();
}
/**
* add the products model to the breadcrumb trail
*/
if (isset($_GET['products_id'])) {
$productname_query = "select products_name
from " . TABLE_PRODUCTS_DESCRIPTION . "
where products_id = '" . (int)$_GET['products_id'] . "'
and language_id = '" . $_SESSION['languages_id'] . "'";
$productname = $db->Execute($productname_query);
if ($productname->RecordCount() > 0) {
$breadcrumb->add($productname->fields['products_name'], zen_href_link(zen_get_info_page($_GET['products_id']), 'cPath=' . $cPath . '&products_id=' . $_GET['products_id']));
}
}
?>
Re: MultiSite Module Support Thread
i just give up trying to get this to work with the fluorspar template.
i am going to use the template that came with the software.. and that is working so far..
thank you Doc byte with the multi-site update.. i used that one and so far so good. thank you for all your work.
Re: MultiSite Module Support Thread
hi you all, I am back..
I tried to add new pictures to my categories and here is what happens,.. when i put in the new pictures in and saved it.. the <--heras, Kandi---> disappears.. and when I went to the multi site tool the heras, kandi is missing also..
here is the debug
28-Apr-2021 02:34:21 UTC] Request URI: /shop/angRy-SZm-trusT/index.php?cmd=multisite&action=categories_sites, IP address: 24.113.216.190
#1 sizeof() called at [/angRy-SZm-trusT/multisite.php:209]
#2 require(/angRy-SZm-trusT/multisite.php) called at [/angRy-SZm-trusT/index.php:11]
--> PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in /angRy-SZm-trusT/multisite.php on line 209.
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((
<?php
/**
* Multisite for Zen-Cart
*
* This file should be in includes/admin/multisite.php
*
*/
require('includes/application_top.php');
$action = (isset($_GET['action']) ? $_GET['action'] : '');
/**
* Save cats/sites
*/
if (isset($action) && ($action == 'categories_sites') && isset($_GET['mode']) && ($_GET['mode'] == 'save')) {
if (isset($_GET['site'])) {
$site_param = '&site=' . $_GET['site'];
} else {
$site_param = '';
}
if (isset($_POST['site'])) {
foreach ($_POST['site'] as $multisite_cat_id => $multisite_sites) {
$multisite_query = $db->Execute("SELECT categories_description, language_id
FROM " . TABLE_CATEGORIES_DESCRIPTION . " cd
WHERE categories_id = " . (int)$multisite_cat_id);
foreach ($multisite_query as $site) {
$multisite_cat_desc = preg_replace('/<!--(.|\s)*?-->/', '', $site['categories_description']);
while ($multisite_cat_desc['0'] == "\n") {
$multisite_cat_desc = substr($multisite_cat_desc, 1);
}
if ($multisite_sites != '') {
$multisite_cat_desc = "<!--$multisite_sites-->\n$multisite_cat_desc";
}
//echo $multisite_cat_id.' -> '.$multisite_cat_desc."\n";
$sql = "UPDATE " . TABLE_CATEGORIES_DESCRIPTION . "
SET categories_description = :multisiteCategoriesDescription
WHERE language_id = " . (int)$site['language_id'] . "
AND categories_id = " . (int)$multisite_cat_id;
$sql = $db->bindVars($sql, ':multisiteCategoriesDescription', $multisite_cat_desc, 'string');
$db->Execute($sql);
}
}
}
zen_redirect(zen_href_link(FILENAME_MULTISITE, 'action=' . $_GET['action'] . $site_param));
exit;
}
?>
<!doctype html>
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta charset="<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" href="includes/stylesheet.css">
<link rel="stylesheet" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
<script src="includes/menu.js"></script>
<script src="includes/general.js"></script>
<script type="text/javascript">
function init() {
cssjsmenu('navbar');
if (document.getElementById)
{
var kill = document.getElementById('hoverJS');
kill.disabled = true;
}
}
function add_to_all_cats() {
var new_site = $('#txt_site').val();
if (new_site != '') {
var form_elements = document.forms["save_multisite"].elements;
for (var element_id in form_elements) {
if ((form_elements[element_id].name) && (form_elements[element_id].name.substr(0, 5) == " site[")) {
if (form_elements[element_id].value == '') {
form_elements[element_id].value = new_site;
} else {
var split_sites = form_elements[element_id ].value.split("-");
var found = false;
for (var i in split_sites) {
if (split_sites[i] == new_site) {
found = true;
}
}
if (!found) {
split_sites[split_sites.length] = new_site;
}
split_sites.sort();
form_elements[element_id].value = split_sites.join('-');
}
}
}
$('#txt_site').val('');
}
}
function remove_from_all_cats() {
var rmv_site = $('#txt_site').val();
if (rmv_site != '') {
var form_elements = document.forms['save_multisite'].elements;
for (var element_id in form_elements) {
if ((form_elements[element_id].name) && (form_elements[element_id].name.substr(0, 5) == 'site[')) {
var split_sites = form_elements[element_id].value.split("-");
var split_result = new Array();
var j = 0;
for (var i in split_sites) {
if (split_sites[i] != rmv_site) {
split_result[j] = split_sites[i];
j++;
}
}
split_result.sort();
form_elements[element_id].value = split_result.join('-');
}
}
$('#txt_site').val('');
}
}
</script>
</head>
<body onLoad="init()">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<div class="container-fluid">
<!-- body_text //-->
<h1><?php echo MULTISITE_TITLE; ?></h1>
<?php
//Display menu ...
?>
<div class="row text-center">
<a href="<?php echo zen_href_link(FILENAME_MULTISITE, 'action=display_config'); ?>" class="btn btn-default" role="button"><?php echo MULTISITE_CONFIG_LINK; ?></a> - <a href="<?php echo zen_href_link(FILENAME_MULTISITE, 'action=categories_sites'); ?>" class="btn btn-default" role="button"><?php echo MULTISITE_RELATIONS_LINK; ?></a>
</div>
<?php
if (isset($action)) {
switch ($action) {
case 'display_config':
?>
<div class="row text-center">
<?php echo MULTISITE_CONFIG_TEXT; ?><br><br>
<textarea name="code" class="php form-control" cols="100" rows="40" style="width:90%;">
<?php
$config_query = $db->Execute("SELECT cg.configuration_group_title,c.configuration_key,c.configuration_value,c.configu ration_title
FROM " . TABLE_CONFIGURATION . " c
LEFT JOIN " . TABLE_CONFIGURATION_GROUP . " cg ON c.configuration_group_id = cg.configuration_group_id
ORDER BY cg.sort_order, c.sort_order");
$current_group_title = '';
foreach ($config_query as $config) {
if ($config['configuration_group_title'] != $current_group_title) {
$current_group_title = $config['configuration_group_title'];
echo "\n/**\n";
echo " * $current_group_title\n";
echo " */\n";
}
echo "define('" . ($config['configuration_key'] . "','" . $config['configuration_value'] . "'); //" . str_replace("\n", ' ', $config['configuration_title']) . "\n");
}
?>
</textarea>
</div>
<?php
break;
case 'categories_sites':
if (!isset($_GET['mode']) || ($_GET['mode'] != 'save')) {
?>
<div class="row">
<div class="text-center">
<h4><?php echo MULTISITE_CATEGORIE_TITLE; ?></h4>
<p><?php echo MULTISITE_CATEGORIE_TEXT; ?></p>
</div>
<?php echo zen_draw_label(MULTISITE_CATEGORIE_ADD_LABEL, 'txt_site', ' class="control-label col-sm-3"'); ?>
<div class="col-sm-9 col-md-6">
<?php echo zen_draw_input_field('txt_site', '', 'id="txt_site" size="32" class="form-control"'); ?>
</div>
<div class="col-sm-offset-3 col-sm-9 col-md-6 text-right" style="margin-top: 5px;">
<button type="button" onclick="add_to_all_cats()" class="btn btn-default"><?php echo MULTISITE_BUTTON_ADD_ALL; ?></button>
<button type="button" onclick="remove_from_all_cats()" class="btn btn-default"><?php echo MULTISITE_BUTTON_REMOVE_ALL; ?></button>
<span class="help-block"><?php echo MULTISITE_CATEGORIE_REMINDER_TEXT; ?></span>
</div>
<?php
$multisite_category_tree = zen_get_category_tree();
//print_r($multisite_category_tree);exit;
$multisite_list = array();
if (isset($_GET['site'])) {
$filter = ' AND cd.categories_description LIKE "%-' . $_GET['site'] . '-%" ';
$site_param = '&site=' . $_GET['site'];
} else {
$filter = '';
$site_param = '';
}
$total_cats = sizeof($multisite_category_tree) - '1';
foreach ($multisite_category_tree as $multisite_key => $multisite_category) {
if ($multisite_category['id'] == '0') {
unset($multisite_category_tree[$multisite_key]); //remove the top category
} else {
$multisite_query = $db->Execute("SELECT cd.categories_description,c.categories_status
FROM " . TABLE_CATEGORIES_DESCRIPTION . " cd
INNER JOIN " . TABLE_CATEGORIES . " c ON cd.categories_id = c.categories_id
WHERE c.categories_id = " . $multisite_category['id'] . "
" . $filter);
$sites = array();
if ($multisite_query->EOF) {
unset($multisite_category_tree[$multisite_key]);
} else {
foreach ($multisite_query as $item) {
$multisite_cat_desc = $item['categories_description'];
preg_match_all('/<!--(.|\s)*?-->/', $multisite_cat_desc, $multisite_comments, PREG_PATTERN_ORDER);
$multisite_cat_sites = array();
foreach ($multisite_comments['0'] as $multisite_comment) {
this is line 209 -----> $multisite_comment = preg_replace('/\s\s+|/', '', $multisite_comment);
$multisite_cat_sites[] = substr($multisite_comment, 4, sizeof($multisite_comment) - 4); //remove html comment
}
//Add to the list of all sites
$multisite_cat_sites = implode('-', $multisite_cat_sites);
$new_sites = explode('-', $multisite_cat_sites);
foreach ($new_sites as $site) {
if ($site != '') {
$sites[$site] = '1';
}
}
}
//print_r($sites);exit;
ksort($sites);
$multisite_cat_sites = array();
foreach ($sites as $site => $value) {
$multisite_cat_sites[] = $site;
}
$multisite_category_tree[$multisite_key]['sites'] = implode('-', $multisite_cat_sites);
$multisite_category_tree[$multisite_key]['status'] = $multisite_query->fields['categories_status'];
$multisite_category_tree[$multisite_key]['cPath_parent'] = MultisiteGetcPath($multisite_category['id']);
if ($multisite_category_tree[$multisite_key]['cPath_parent'] == '0') {
$multisite_category_tree[$multisite_key]['cPath'] = $multisite_category['id'];
} else {
$multisite_category_tree[$multisite_key]['cPath'] = $multisite_category_tree[$multisite_key]['cPath_parent'] . '_' . $multisite_category['id'];
}
foreach ($sites as $site => $value) {
if (!isset($multisite_list[$site])) {
$multisite_list[$site] = '1';
} else {
$multisite_list[$site] ++;
}
}
}
}
}
arsort($multisite_list);
$display_sites = array();
$display_sites[] = '<a href="' . zen_href_link(FILENAME_MULTISITE, 'action=' . $action) . '" class="btn btn-default btn-sm" role="button">' . MULTISITE_CATEGORIE_ALL_TEXT . '</a> (' . $total_cats . ')';
foreach ($multisite_list as $site => $cat_number) {
$display_sites[] = '<a href="' . zen_href_link(FILENAME_MULTISITE, 'action=' . $action . '&site=' . $site) . '" class="btn btn-default btn-sm" role="button">' . $site . '</a> (' . $cat_number . ')';
}
?>
<div class="col-sm-12 text-center">
<?php
echo implode(' - ', $display_sites) . "<br><br>\n";
?>
</div>
<div class="col-sm-12">
<?php echo zen_draw_form('save_multisite', FILENAME_MULTISITE, 'action=' . $action . '&mode=save' . $site_param, 'post', 'enctype="multipart/form-data" class="form-horizontal"'); ?>
<div class="form-group text-right">
<button type="submit" class="btn btn-primary"><?php echo IMAGE_SAVE; ?></button>
</div>
<table class="table table-striped">
<thead>
<tr>
<th><?php echo TABLE_HEADING_MULTISITE_CATEGORIE; ?></th>
<th><?php echo TABLE_HEADING_MULTISITE_SITE; ?></th>
<th><?php echo TABLE_HEADING_ACTION; ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($multisite_category_tree as $multisite_category) {
?>
<tr>
<td>
<a href="<?php echo zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $multisite_category['cPath']); ?>">
<?php echo str_replace(' ', ' ', str_replace(' ', '_ ', $multisite_category['text'])); ?>
</a>
</td>
<td>
<?php echo zen_draw_input_field('site[' . $multisite_category['id'] . ']', $multisite_category['sites'], 'class="form-control"'); ?>
</td>
<td>
<?php
if ($multisite_category['status'] == '1') {
?>
<a target="_blank" href="<?php echo zen_href_link(FILENAME_CATEGORIES, 'action=setflag_categories&flag=0&cID=' . $multisite_category['id'] . '&cPath=' . $multisite_category['cPath_parent']); ?>'"><?php echo zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON); ?></a>
<?php
} else {
?>
<a target="_blank" href="<?php echo zen_href_link(FILENAME_CATEGORIES, 'action=setflag_categories&flag=1&cID=' . $multisite_category['id'] . '&cPath=' . $multisite_category['cPath_parent']); ?>"><?php echo zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF); ?></a>
<?php
}
?>
<a href="<?php echo zen_href_link(FILENAME_CATEGORIES, 'action=edit_category&cPath=' . $multisite_category['cPath_parent'] . '&cID=' . $multisite_category['id']); ?>">
<?php echo zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT); ?></a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<div class="form-group">
<button type="submit" class="btn btn-primary"><?php echo IMAGE_SAVE; ?></button>
</div>
<?php echo '</form>'; ?>
</div>
<?php
}
?>
</div>
<?php
break;
}
}
?>
<!-- body_text_eof //-->
</div>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php
require(DIR_WS_INCLUDES . 'application_bottom.php');
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ))))))))))
Re: MultiSite Module Support Thread
I just tried on my test site, and can not replicate your error.
In your post you say
Code:
<--heras, Kandi--->
, this should be
Code:
<!--heras-Kandi--->
Maybe that's where things go wrong?
Re: MultiSite Module Support Thread
you would not be able to because it is on the admin side. when I go to add a new photo for the categories.. the<!--heras-Kandi---> disappears.. and no photo will show.