Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    458
    Plugin Contributions
    1

    bug Master Category displays as already Ticked in the Delete Product/Links window:

    Running a fresh install of 1.5.7c, on PHP 7.4 with Responsive Classic Template.
    Just went to delete a linked product and when I click on the delete icon, the Delete Product/Links window opens up and displays the usual, however, it shows BOTH boxes as already ticked/pre-selected (The Linked categories and the Master Category).
    Even though it says next to the master category..(The Master Category (highlighted) is de-selected to prevent accidental deletion.) - https://i.imgur.com/JvAzSYX.png
    Any reason why the master is pre-selected where it shouldn't be and how to fix it?
    I almost deleted a couple of master products as I didn't pay attention.
    *Zen Cart eCommerce Solution - Putting the Dream of Owning an Online Business within reach of anyone!

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: Master Category displays as already Ticked in the Delete Product/Links window:

    Quote Originally Posted by rlexyd View Post
    Running a fresh install of 1.5.7c, on PHP 7.4 with Responsive Classic Template.
    Just went to delete a linked product and when I click on the delete icon, the Delete Product/Links window opens up and displays the usual, however, it shows BOTH boxes as already ticked/pre-selected (The Linked categories and the Master Category).
    Even though it says next to the master category..(The Master Category (highlighted) is de-selected to prevent accidental deletion.) - https://i.imgur.com/JvAzSYX.png
    Any reason why the master is pre-selected where it shouldn't be and how to fix it?
    I almost deleted a couple of master products as I didn't pay attention.
    I can confirm this unwanted behavior on zc157c.

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: Master Category displays as already Ticked in the Delete Product/Links window:

    Quote Originally Posted by lat9 View Post
    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 .= '&nbsp;&gt;&nbsp;';
            }
        }
        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
    Last edited by lat9; 18 Sep 2021 at 03:07 PM.

  4. #4
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    458
    Plugin Contributions
    1

    Default Re: Master Category displays as already Ticked in the Delete Product/Links window:

    Thank you Cindy, problem solved
    *Zen Cart eCommerce Solution - Putting the Dream of Owning an Online Business within reach of anyone!

 

 

Similar Threads

  1. v154 Can I make my image links open in the same window rather than a new window?
    By cpmacg in forum All Other Contributions/Addons
    Replies: 6
    Last Post: 15 Apr 2015, 08:59 PM
  2. Terms and Condition box already ticked
    By simai in forum Managing Customers and Orders
    Replies: 9
    Last Post: 7 Apr 2013, 07:23 PM
  3. v139h How do I delete the dead space between the category description and product listing ?
    By HeyIts007 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 9 Nov 2012, 08:30 AM
  4. Setting the Category link to display the Master Category
    By farawaynearby in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 26 Mar 2010, 01:18 PM
  5. How to set a category folder as the default master category
    By april12345 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 1 Sep 2008, 10:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR