Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Join Date
    Dec 2005
    Location
    Cincinnati Ohio
    Posts
    1,030
    Plugin Contributions
    13

    Default Copy Categories 1.6

    Copy Categories 1.6 Support Thread. For Zencart 1.5.x

    What is "Copy Categories"?

    Copy Categories is exactly what its name says, Zen Cart's default category management does not have a "Category Copy Option". Now there is.
    This allows the store owner or managers to copy categories to where needed. If a store owner has thousands of categories or sub categories then it can be very time consuming to move or type in new ones one by one. With "Copy Categories" this terminates the the manual moving or creating new categories.

    File Edits Required: BACKUP FIRST
    YOUR_ADMIN/categories.php
    YOUR_ADMIN/includes/modules/category_product_listing.php
    YOUR_ADMIN_includes/languages/english.php (Forgot To Add language Instructions in contribution. Once approved I will update the contribution and instructions)

    Down Load Link:
    Currently Under Review

    In the mean time:
    Edit /YOUR_ADMIN/categories.php (Fresh Unedited Copy)

    Find:
    Code:
     case 'move_category_confirm':
    Add Directly Before With:
    Code:
          case 'copy_category_confirm':        
          if (isset($_POST['categories_id']) && ($_POST['categories_id'] != $_POST['copy_to_category_id'])) {
            $categories_id = zen_db_prepare_input($_POST['categories_id']);
            $new_parent_id = zen_db_prepare_input($_POST['copy_to_category_id']);
            _copy_categories_tree($categories_id, $new_parent_id);
            zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id));
          } else {
            $messageStack->add_session(ERROR_CANNOT_COPY_CATEGORY_TO_CATEGORY_SELF . $cPath, 'error');
            zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
          }
          break;
    At the end of the categories.php file add the following right after
    </html>
    <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

    Code:
    <?php
    /**
     * The function recursively copies the given category and its descriptions in all languages
     * @param $categories_id category to copy
     * @param $new_parent_id destination category (it will be parent category)
     *
    */
    function _copy_categories_tree($categories_id, $new_parent_id){
        global $db;
        $db->Execute(" INSERT INTO ".TABLE_CATEGORIES." (categories_image, parent_id, sort_order, date_added, last_modified, categories_status)
        SELECT categories_image, '{$new_parent_id}' AS parent_id, sort_order, NOW() AS date_added, NOW() AS last_modified, categories_status FROM ".TABLE_CATEGORIES." WHERE categories_id = '{$categories_id}'
        ");
        $copy_id = zen_db_insert_id();
        $db->Execute(" INSERT INTO ".TABLE_CATEGORIES_DESCRIPTION." (categories_id, language_id, categories_name, categories_description)
        SELECT '{$copy_id}' AS categories_id, language_id, categories_name, categories_description  FROM ".TABLE_CATEGORIES_DESCRIPTION." WHERE categories_id = '{$categories_id}'
        ");
        $childs = $db->Execute("SELECT categories_id FROM ".TABLE_CATEGORIES." WHERE parent_id = '{$categories_id}'");
        $childids = array();
        while(!$childs->EOF){
            $childids[] = $childs->fields['categories_id'];
            $childs->MoveNext();
        }
        foreach($childids as $child){
            _copy_categories_tree($child, $copy_id);
        }
    }
    
    ?>
    Then edit YOUR_ADMIN/includes/modules/category_product_listing.php

    Find:
    Code:
                       <?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=move_category') . '">' . zen_image(DIR_WS_IMAGES . 'icon_move.gif', ICON_MOVE) . '</a>'; ?>
    Directly Below Add:
    Code:
                     <?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=copy_category') . '">' . zen_image(DIR_WS_IMAGES . 'icon_copy_to.gif', ICON_COPY_TO) . '</a>'; ?>
    Language Files: (Forgot To Add langauge Instructions in contribution. Once approved I will update the contribution and instructions)

    Edit YOUR_ADMIN/includes/languages/english.php

    Find:
    Code:
    define('TEXT_NOEMAIL', 'No Email');
    Directly Below Add:
    Code:
    define('TEXT_COPY', 'Copy Category To:');
    Once completed log into your Shop Admin go to Catalog => Categories / Products, to your right beside the "Move" icon there should be a copy icon beside it.

    Enjoy!!

    Like to donate to this do so by going here http://www.zen-cart.com/content.php?6-donate
    Last edited by knuckle-101; 11 Nov 2012 at 09:59 PM.
    PCI Certified Web Hosting - ControlScan, Security Metrics (Platinum Partner), McAfee, TrustKeeper
    Business Class Web Hosting - Linux and cPanel Powered

  2. #2
    Join Date
    Apr 2007
    Location
    Dayton, Ohio
    Posts
    672
    Plugin Contributions
    0

    Default Re: Copy Categories 1.6

    Knuckle-101,

    This mod is much needed for me, but I have one issue. Do you have a version that has copy category and then the "link to" option shows (like in the product copy to button)? Thereby allows us to link the whole category and associated products into the new location?

    The reason I ask is I do have many products as well, but I would like to nest existing categories into others via the link function instead of copy to function. So with the current plugin, I can copy all folders to another area (beautiful), but then I also need to link every existing product into these categories from the original categories. And worry about each update matching for both categories. Opening another can of worms.

  3. #3
    Join Date
    Dec 2005
    Location
    Cincinnati Ohio
    Posts
    1,030
    Plugin Contributions
    13

    Default Re: Copy Categories 1.6

    Quote Originally Posted by sports guy View Post
    Knuckle-101,

    This mod is much needed for me, but I have one issue. Do you have a version that has copy category and then the "link to" option shows (like in the product copy to button)? Thereby allows us to link the whole category and associated products into the new location?

    The reason I ask is I do have many products as well, but I would like to nest existing categories into others via the link function instead of copy to function. So with the current plugin, I can copy all folders to another area (beautiful), but then I also need to link every existing product into these categories from the original categories. And worry about each update matching for both categories. Opening another can of worms.
    You are right about opening another can worms. What your asking for would be a little more extensive requirement of development. But I do not think that it would be a good idea for stability to link categories or categories with products in them to get the products linked to your new category. First it would cause a string of confusion within the code and most likely be a larger mess then just copy the categories themselves. As you notice by default you cannot put categories into a category loaded with products. This system would most likely need by-passed just to link the products over when copied and with that it could and most likely would cause chaos with your products or possible scatter them through out the database or even delete the products entirely causing a bigger mess.

    This modification was first created by a blogger cannot recall the name and we just ported it into 1.5.x for a customer. I was aware others asked for such modification through out the Zencart forums so after we ported it into 1.5.x I posted it on the forums hoping to at least help others. As for future modifications none is planned right now but who knows it could progress in time. Never know the Zencart dev team may do something first with future releases of ZenCart. :)
    Last edited by knuckle-101; 19 Nov 2012 at 05:48 PM.
    PCI Certified Web Hosting - ControlScan, Security Metrics (Platinum Partner), McAfee, TrustKeeper
    Business Class Web Hosting - Linux and cPanel Powered

  4. #4
    Join Date
    Dec 2005
    Location
    Cincinnati Ohio
    Posts
    1,030
    Plugin Contributions
    13

    Default Re: Copy Categories 1.6

    I put the think cap on for you and remembered a thread about multiple product copying you can visit the main thread here and the download file by Ajeh here. It may or may not work with your version but it is a start to copy multiple products but the linking is still in question. Hope that helps.
    PCI Certified Web Hosting - ControlScan, Security Metrics (Platinum Partner), McAfee, TrustKeeper
    Business Class Web Hosting - Linux and cPanel Powered

  5. #5
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: Copy Categories 1.6

    For those looking to do multiple copying, duplicating of products, linking to lots of categories stuff, these are also of great use:

    http://www.zen-cart.com/showthread.p...Manager-Sorted

    http://www.zen-cart.com/showthread.p...Move-Delete%29

    It would be nice if all these functionalities were combined in one management page one day...
    Last edited by torvista; 19 Nov 2012 at 07:32 PM.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  6. #6
    Join Date
    Dec 2005
    Location
    Cincinnati Ohio
    Posts
    1,030
    Plugin Contributions
    13

    Default Re: Copy Categories 1.6

    Quote Originally Posted by torvista View Post
    For those looking to do multiple copying, duplicating of products, linking to lots of categories stuff, these are also of great use:

    http://www.zen-cart.com/showthread.p...Manager-Sorted

    http://www.zen-cart.com/showthread.p...Move-Delete%29

    It would be nice if all these functionalities were combined in one management page one day...
    I do not believe this one http://www.zen-cart.com/showthread.p...Manager-Sorted will work friendly with the modification of this thread. Exceed extreme caution if trying to combine them. I may look it over and see what can be done.. No promises anytime soon though..
    PCI Certified Web Hosting - ControlScan, Security Metrics (Platinum Partner), McAfee, TrustKeeper
    Business Class Web Hosting - Linux and cPanel Powered

  7. #7
    Join Date
    Dec 2005
    Location
    Cincinnati Ohio
    Posts
    1,030
    Plugin Contributions
    13

    Default Re: Copy Categories 1.6

    oops. wrong thread..
    Last edited by knuckle-101; 19 Nov 2012 at 08:17 PM. Reason: Multi-Tasking
    PCI Certified Web Hosting - ControlScan, Security Metrics (Platinum Partner), McAfee, TrustKeeper
    Business Class Web Hosting - Linux and cPanel Powered

  8. #8
    Join Date
    Dec 2005
    Location
    Cincinnati Ohio
    Posts
    1,030
    Plugin Contributions
    13

    Default Re: Copy Categories 1.6

    Down Load Link (Update):
    Download Fileset here http://www.zen-cart.com/downloads.php?do=file&id=1549

    Functionality Not Mentioned Inside Instruction Document: Products within the categories are also copied by default. When copying your categories all products within them are also copied over to the new category.

    Enjoy!!

    Like to donate to this do so by going here http://www.zen-cart.com/content.php?6-donate
    PCI Certified Web Hosting - ControlScan, Security Metrics (Platinum Partner), McAfee, TrustKeeper
    Business Class Web Hosting - Linux and cPanel Powered

  9. #9
    Join Date
    Mar 2015
    Posts
    165
    Plugin Contributions
    0

    Default Re: Copy Categories 1.6

    this was an awesome mod. will it be updated?

  10. #10
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: Copy Categories 1.6

    What was the key feature of this you are missing now?
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Copy Sub Categories To Multiple Main Categories
    By InSoMnIa in forum Setting Up Categories, Products, Attributes
    Replies: 18
    Last Post: 27 Jul 2012, 10:46 AM
  2. Copy Attributes to multiple categories?
    By LRS in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 31 Aug 2011, 06:16 PM
  3. How do i copy categories?
    By lizar5- in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Sep 2007, 09:58 PM
  4. Copy product to multiple categories
    By Drake in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 3 Mar 2007, 02:28 AM

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