7

This is a known issue caused by PHP 5.3.9 and max_input_vars that by default it is set to 1000.

The solution 2 proposed here it is the best in my opinion but doesn't work: for some strange reason it limit the category to 527 products.

For that reason I'm posting this question with related corrected answer

1
  • Maybe the limit is not 527. Maybe you reach the max_post_size
    – Marius
    Aug 2 '13 at 11:17
11

As described in the question this issue has been addressed here but the answer was not working fine for me.

I'm adding here a complete working solution (method 2).

this is the code that is working fine for me:

            $cat_products_split = explode('&', $data['category_products']);
            foreach ($cat_products_split as $row) {
                $arr = explode('=', $row);
                if (count($arr) == 2) {
                    $products[$arr[0]] = $arr[1];
                }
            }

- HERE THE STEPS TO FIX IT -

1. Creation of a new module

let create a module CategoryFix in local.

Here the config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <MYNAMESPACE_CategoryFix>
            <version>0.1.0</version>
        </MYNAMESPACE_CategoryFix>
    </modules>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <!--FOR THE USE OF OUR CONTROLLER BEFORE THE CORE ONES -->
                        <categoryfix before="Mage_Adminhtml">MYNAMESPACE_CategoryFix_Adminhtml</categoryfix>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

2. Override the category controller ( saveAction())

Controller file: /MYNAMESPACE/CategoryFix/Adminhtml/Catalog/CategoryController

<?php

require_once 'Mage/Adminhtml/controllers/Catalog/CategoryController.php';
class MYNAMESPACE_CategoryFix_Adminhtml_Catalog_CategoryController extends Mage_Adminhtml_Catalog_CategoryController
{  
    /**
     * Category save
     */
    public function saveAction()
    {
     // 1. COPY HERE THE CODE FROM THE ORIGINAL SAVEACTION() METHOD
     // 2. COMMENT THIS LINE: `parse_str($data['category_products'], $products);`
     // USE THE CODE REPORTED ABOVE  
    }
 }
1
  • /MYNAMESPACE/CategoryFix/controllers/Adminhtml/Catalog/CategoryController.php worked for me
    – Alan
    Jun 21 '17 at 12:14
3

I added this to the .htaccess file in Magento root:

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

After setting that Magento allowed me to have more than 1001 products in one category.

1
  • take care your solution make your server more vulnerable to DDoS attack
    – Fra
    Apr 21 '15 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.