由于PHP从5.3.9开始增加一个变量 max_input_vars 用来限制提交的表单数量,后台分类下保存产品不能超过1000个,修改方法如下:
1、修改php.ini中的max_input_vars,改为自己想要的值,然后重启PHP;
2、修改/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php的saveAction(该方法本人没有测试),下面代码:
if (isset($data['category_products']) &&
!$category->getProductsReadonly()) {
$products = array();
parse_str($data['category_products'], $products);
$category->setPostedProducts($products);
}
替换为:
if (isset($data['category_products']) &&
!$category->getProductsReadonly()) {
$products = array();
$records = preg_split('/&/',$data['category_products'],-1,PREG_SPLIT_NO_EMPTY);
if(count($records) > 0){
foreach($records as $record){
$record = trim($record);
if(preg_match('/([0-9]*)=([0-9]*)/',$record,$matches)){
$products[$matches[1]] = $matches[2];
}
}
}
$category->setPostedProducts($products);
}