Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,839
    Plugin Contributions
    31

    Default admin products_to_categories: copy products as linked flags empty TO cat as invalid

    When copying linked products from one category to another:
    the From Category is checked for the existence of products to copy, ok
    the To Category is checked for the existence of products too: not ok. It should check for the existence of the To Category and that there are no subcategories, it doesn't matter if there are no products in there.

    Suggestion
    from
    PHP Code:
    $check_category_to $db->Execute("select products_id from " TABLE_PRODUCTS_TO_CATEGORIES " where categories_id='" $copy_to_linked "' limit 1");

            
    // check if from is valid category
            
    if ($check_category_from->RecordCount() < 1) {
              
    $zv_invalid_copy_linked 'true';
              
    $zv_complete_message_linked .= WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED $copy_from_linked '&nbsp;';
            } else {
              
    $zv_complete_message_linked .= SUCCESS_COPY_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED $copy_from_linked '&nbsp;';
            }

            
    // check if to is valid category
            
    if ($check_category_to->RecordCount() < 1) {
              if (
    zen_childs_in_category_count($copy_to_linked) > 0) {
                
    $zv_invalid_copy_linked 'true';
                
    $zv_complete_message_linked .= WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED $copy_to_linked '&nbsp;';
              }
              
    $zv_complete_message_linked .= WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED_MISSING $copy_to_linked '&nbsp;';
            } else {
              
    $zv_complete_message_linked .= SUCCESS_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED $copy_to_linked '&nbsp;';
            } 
    to
    PHP Code:
    $check_category_to $db->Execute("select categories_id from " TABLE_CATEGORIES " where categories_id='" $copy_to_linked "' limit 1");

            
    // check if from is valid category
            
    if ($check_category_from->RecordCount() < 1) {
              
    $zv_invalid_copy_linked 'true';
              
    $zv_complete_message_linked .= WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED $copy_from_linked '&nbsp;';
            } else {
              
    $zv_complete_message_linked .= SUCCESS_COPY_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED $copy_from_linked '&nbsp;';
            }

            
    // check if to is valid category
            
    if ($check_category_to->RecordCount() > 0) {
              if (
    zen_childs_in_category_count($copy_to_linked) > 0) {
                
    $zv_invalid_copy_linked 'true';
                
    $zv_complete_message_linked .= WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED $copy_to_linked '&nbsp;';
              }
              
    $zv_complete_message_linked .= SUCCESS_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED $copy_to_linked '&nbsp;';
            } else {
                
    $zv_invalid_copy_linked 'true';
                
    $zv_complete_message_linked .= WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED_MISSING $copy_to_linked '&nbsp;';
            } 
    and add more information in the constants:
    to
    PHP Code:
    define('WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_FROM_LINKED''Invalid Category (no products) to link Products From: ');
    define('WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED''Invalid Category (has subcategories) to link Products To: ');
    define('WARNING_COPY_ALL_PRODUCTS_TO_CATEGORY_TO_LINKED_MISSING''WARNING: Copy not allowed to Invalid (missing) Category to Link: '); 
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

  2. #2
    Join Date
    Sep 2008
    Location
    WA
    Posts
    555
    Plugin Contributions
    0

    Default Re: admin products_to_categories: copy products as linked flags empty TO cat as inval

    Hi Steve

    I remember reading that this was done on purpose in order to keep the link manager cleaner. They don't want a bunch of categories that are empty showing up on the link manager. So they only let those with at least one product. That is why you always need to add a product to a category before you can use it in the link manager.

    I don't remember where I read this though and I looked for an hour, lol. I was hoping to find more info on it.

    Linda

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,839
    Plugin Contributions
    31

    Default Re: admin products_to_categories: copy products as linked flags empty TO cat as inval

    Yes I thought I had raised this issue already years ago but I couldn't find it either.

    I understand your point but, this particular functionality is really divorced from the main tabular display of linked categories as the copy-from and copy-to categories are completely unrelated to the selected product, it just happens to be on the same admin page.

    So I stand by my claim that the current code which flags an empty category as invalid is not right.

    Offtopic
    Whether empty categories are shown or not is something that should be an option on this page. I think the current code is lacking and so I got Multiple Categories Link Manager-Sorted coded for me to improve it. I'm currently updating it and so have finally got round to looking at the bug of this thread.
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

  4. #4
    Join Date
    Sep 2008
    Location
    WA
    Posts
    555
    Plugin Contributions
    0

    Default Re: admin products_to_categories: copy products as linked flags empty TO cat as inval

    I like the idea of a switch too. Wonder when 1.6 is coming, do you know? And I wonder what will be in it.

    Also, what code is followed when not using multiple link manager to just copy/link one product into another category? I'm just learning how it all links together and couldn't find this part. It is prob right in front of my face but I can't see it. Thanks.

    Linda

 

 

Similar Threads

  1. copy all products from one category to another (not linked)
    By jonnyboy22 in forum General Questions
    Replies: 1
    Last Post: 26 Oct 2011, 03:49 PM
  2. admin, products_to_categories.php lang define
    By torvista in forum Bug Reports
    Replies: 0
    Last Post: 16 Dec 2010, 02:29 PM
  3. Can Category products be duplicated or linked to sub-cat?
    By kidzcomfort in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 1 Sep 2009, 02:07 AM

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