Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9289155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:06:19+00:00 2026-06-18T20:06:19+00:00

Using Magento’s back-office, after saving a category which was linked to many products, only

  • 0

Using Magento’s back-office, after saving a category which was linked to many products, only the first 1000 products (or 2000, or x000, depending on host configuration) are kept.

All other category/product links are deleted from the catalog_category_product table in the database.
This occurs even though no checkboxes have been unchecked in the products grid (Category Products tab).

No error message is displayed or logged.
Tracing data posted from the browser to the server doesn’t reveal any missing product IDs, but even if you check more products on the back-office grid, when finally saving the category, the server only keeps the first x000 and removes other IDs…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T20:06:21+00:00Added an answer on June 18, 2026 at 8:06 pm

    Though some answers can be found on other websites, I thought it was worth sharing this on StackOverflow…

    The source of the problem can be found in Mage_Adminhtml_Catalog_CategoryController, where the saveAction() method retrieves a big POSTed string (category_products, encoded like a query string), which is processed by PHP function parse_str():

    if (isset($data['category_products']) && !$category->getProductsReadonly()) {
        $products = array();
        parse_str($data['category_products'], $products);
        $category->setPostedProducts($products);
    }
    

    Alas! As from version 5.3.9 of PHP, there is a new configuration setting called max_input_vars, which limits the number of input variables that may be accepted.
    This limit is mainly applied to $_GET, $_POST and $_COOKIE superglobals, but is also used internally by the parse_str() function!
    (See PHP manual)

    Depending on the php.ini configuration of your host, the number of products linked to a category is therefore limited by this setting…

    One solution is to increase the value of max_input_vars, in php.ini or in .htaccess:

    <IfModule mod_php5.c>
        php_value max_input_vars 10000
    </IfModule>
    

    This can even be done more safely by changing this setting only for admin pages (adapt the LocationMatch pattern to your own back-office URL style):

    <LocationMatch "mymagentostore/(index\.php/)?admin/">
        <IfModule mod_php5.c>
            php_value max_input_vars 10000
        </IfModule>
    </LocationMatch>
    

    (Source)

    This only solves the problem until one of your categories reaches the new max number of products…

    Another solution would be to fix Magento’s code in order not to use the parse_str() function at this point.
    For instance, in Mage_Adminhtml_Catalog_CategoryController, saveAction() method, replace:

    parse_str($data['category_products'], $products);
    

    with:

    $cat_products_split = explode('&', $data['category_products']);
    foreach($cat_products_split as $row) {
        $arr = array();
        parse_str($row, $arr); //This will always work
        list($k, $v) = each($arr);
        if (!empty($k) && !empty($v)) {
            $products[$k] = $v;
        }
    }
    

    (Source)

    It’s hard to decide which solution is the best, since the first one makes your server more vulnerable to attacks (as the max_input_vars is meant to mitigate the possibility of denial of service attacks which use hash collisions), and the second solution makes you modify a Magento core class, which can lead to further problems in future Magento upgrades…

    Hope this is useful anyway, I struggled some time before I could find out why some categories kept loosing some products!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Magento Enterprise and only the top level category is available to
We are using Magento as our eCommerce platform. We have Oracle apps in which
I want to translate a frontend Magento store using only one csv file. So
Using Magento i want to create website where user can upload their products to
I am using magento community edition 1.7.0.2.I am not able to login to back
I am using magento to get the list of products through the REST url
I'm using Magento and M2ePro extension in order to publish and manage products on
I'm using Magento 1.5 with 3 different stores (same products, though targetted at different
I am using magento 1.7. In my home page each category has pagination and
I am using Magento and have a category under the ID 99 . I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.