Originally Posted by
lat9
I can confirm this unwanted behavior on zc157c.
Present in /admin/includes/modules/delete_product.php:
Code:
<?php
/**
* @copyright Copyright 2003-2020 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: Steve 2020 Apr 20 Modified in v1.5.7 $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
$product_categories_string = '';
$product_categories = zen_generate_category_path($pInfo->products_id, 'product');
if (!isset($category_path)) {
$category_path = '';
}
$preselect_master_category = true; // set to false to prevent accidental deletion
for ($i = 0, $n = count($product_categories); $i < $n; $i++) {
$category_path = '';
for ($j = 0, $k = count($product_categories[$i]); $j < $k; $j++) {
$category_path .= $product_categories[$i][$j]['text'];
if ($j + 1 < $k) {
$category_path .= ' > ';
}
}
if (count($product_categories) >= 1 && (int)zen_get_parent_category_id($pInfo->products_id) === (int)$product_categories[$i][count($product_categories[$i]) - 1]['id']) {
$product_categories_string .= '<div class="checkbox text-danger"><label><strong>' . zen_draw_checkbox_field('product_categories[]', $product_categories[$i][count($product_categories[$i]) - 1]['id'], $preselect_master_category) . $category_path . '</strong></label></div>';
$product_master_category_string = $category_path;
} else {
$product_categories_string .= '<div class="checkbox"><label>' . zen_draw_checkbox_field('product_categories[]', $product_categories[$i][count($product_categories[$i]) - 1]['id'], true) . $category_path . '</label></div>';
}
}
I'll open a GitHub issue to suggest that the highlighted line be changed to a value of false.
GitHub issue: https://github.com/zencart/zencart/issues/4465
Bookmarks