Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14
  1. #11
    Join Date
    Nov 2004
    Location
    Glasgow, Scotland
    Posts
    251
    Plugin Contributions
    0

    Default Re: Product - Master Category problem

    OK I've done some more testing and now know the cause - and the solution!

    Firstly apologies to my client - this problem is caused by deleting any linked product - not just the one in the master category so it will happen even if you are doing everything correctly.

    Secondly I was having this problem with the Moku contribution Product-Book product type so I was beginning to suspect that this was a contribution error rather than a core problem. This doesn't happen with a Product-General product type but it does with a Product-Music product type and the Product-Music type product is part of the core distribution so I will explain the cause, the fix and the recovery strategy for this product type.

    THE CAUSE:

    The problem lies in

    /admin/includes/modules/product_music/delete_product_confirm.php

    This is a copy of this file

    /admin/includes/modules/delete_product_confirm.php

    which is the default file that is used if there is no product type specific file available.

    There is a section set aside in the middle of the code where the product specific code is to be placed and for the music product file this section contains code which deletes the product type specific data stored in the product_music_extra table and the media_to_products table.

    What happens when a linked product is deleted is that this section of code is run and the product type specific data is deleted regardless that the master category copy of the product still exists. When a subsequent attempt is made to edit the product some of the data is found to be missing and the error described above occurs.

    THE FIX:

    The non- code way of preventing this is to use Multiple Categories Link Manager when linking and un-linking products. The link to this is at the bottom of the sidebox that opens when the copy icon is clicked next to the product listing (the blue spot with the letter 'c') Here products can be link and unlinked to as many categories as required without this problem ever occuring - and without the Master Category copy being deleted by mistake.

    To correct the code in

    /admin/includes/modules/product_music/delete_product_confirm.php

    the problem is that the code placed between the

    --PRODUCT_TYPE_SPECIFIC_INSTRUCTIONS_GO__BELOW_HERE--

    and

    --PRODUCT_TYPE_SPECIFIC_INSTRUCTIONS_GO__ABOVE__HERE--

    should not actually go there at all!

    This is the last section of the code in this file:

    Code:
        // if not linked to any categories, do delete:
        if ($count_categories->fields['total'] == '0') {
          zen_remove_product($product_id, $delete_linked);
        }
    
      } // endif $do_delete_flag
    
      // if this is a single-product delete, redirect to categories page
      // if not, then this file was called by the cascading delete initiated by the category-delete process
      if ($action == 'delete_product_confirm') zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
    The product type specificcode should actually be placed between the markers as shown here:

    Code:
        // if not linked to any categories, do delete:
        if ($count_categories->fields['total'] == '0') {
          zen_remove_product($product_id, $delete_linked);
    
    --PRODUCT_TYPE_SPECIFIC_INSTRUCTIONS_GO__BELOW_HERE--
    
    
    --PRODUCT_TYPE_SPECIFIC_INSTRUCTIONS_GO__ABOVE__HERE--
    
        }
    
      } // endif $do_delete_flag
    
      // if this is a single-product delete, redirect to categories page
      // if not, then this file was called by the cascading delete initiated by the category-delete process
      if ($action == 'delete_product_confirm') zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));

    THE RECOVERY STRATEGY

    The problem products_id needs to be placed into the product_music_extra table of the database using the following sql

    Code:
    INSERT INTO `product_music_extra` ( `products_id` , `artists_id` , `record_company_id` , `music_genre_id` ) 
    VALUES (
    'xxx', '0', '0', '0'
    );
    Replace 'xxx' with the appropriate products_id.

    It would appear that the media-to_products table is not used so this can be ignored.

    Once this is done the problem will be cleared and it will be possible to edit the product again. The product type specific data that was lost can now be re-entered using the edit screen.

    Looks like I've found a bug!

    Hope this helps if you have come across this problem.

    Regards,

    Alan

  2. #12
    Join Date
    Nov 2008
    Location
    Slovenija
    Posts
    119
    Plugin Contributions
    0

    red flag Re: Product - Master Category problem

    I have 4 languages.
    I have a categories, a subcategories and products.
    When i click on one subcategory for the Slovene language, i have "no products find" , but for other languages it works.

    What could it be?

    And when I click to some subcategory it bring me to one different product in different category.

    In past I installed Easy populate, but than I did a Full Back Up.

    Please Help

  3. #13
    Join Date
    Nov 2008
    Location
    Slovenija
    Posts
    119
    Plugin Contributions
    0

    Default Re: Product - Master Category problem

    I correct what i write before. In all the languages I have probelms.

  4. #14
    Join Date
    Nov 2008
    Location
    Slovenija
    Posts
    119
    Plugin Contributions
    0

    Default Re: Product - Master Category problem

    Quote Originally Posted by Jeet Kune Do View Post
    I have 4 languages.
    I have a categories, a subcategories and products.
    When i click on one subcategory for the Slovene language, i have "no products find" , but for other languages it works.

    What could it be?

    And when I click to some subcategory it bring me to one different product in different category.

    In past I installed Easy populate, but than I did a Full Back Up.

    Please Help
    Problem resolved with turning off Simple SEO.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Product Master Category: ID# 0
    By Sunabac in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 8 Aug 2017, 03:18 PM
  2. v138a lost product due to master category
    By tjmuse in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 6 Dec 2012, 01:57 AM
  3. How can I link a product to a master category?
    By PudzPud in forum Setting Up Categories, Products, Attributes
    Replies: 9
    Last Post: 2 Jul 2010, 03:44 PM
  4. Replies: 10
    Last Post: 30 Apr 2010, 04:46 PM
  5. Code to Get Master Category ID of a Product
    By gems14k in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 23 Dec 2006, 04:57 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