magento目录产品数据可以批量导入超入1001条的产品,但如果对产品目录进行保存,就会发现只有1001条的产品了,
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); } 可以解决之一个方案在某些情况下,产品变0的问题 (责任编辑:好模板) |