magento产品编辑页面categories显示不全

在产品编辑页面.选择所属分类时,有时候会发现某个分类明明有子分类,但就是没显示出来。

 

这是magento自身的问题,几率很少,应该跟缓存有关系。

 

解决办法:

在phpmyadmin后台执行如下sql语句:

 

1
2
3
4
5
6
7
8
9
10
11
12
CREATE TABLE catalog_category_entity_tmp LIKE catalog_category_entity;
INSERT INTO catalog_category_entity_tmp SELECT * FROM catalog_category_entity;

UPDATE catalog_category_entity cce
SET children_count =
(
SELECT count(cce2.entity_id)-1 as children_county
FROM catalog_category_entity_tmp cce2
WHERE PATH LIKE CONCAT(cce.path,'%')
);

DROP TABLE catalog_category_entity_tmp;

 

The children_count field in Magento can sometimes become inaccurate if you have created a category via the PHP API and set an entity_id whilst doing so. It is due to part of the after_save mechanism which overrides the children_count parameter (even if explicitly set via $_category->setChildrenCount()).

For the majority of the admin area, an inaccurate children count won’t normally pose an issue, however, upon using the AJAX category tree (Eg. in product edit, promotional rules etc.) – any category with an inaccurate children count may not display the expand icon.

坚持原创技术分享,您的支持将鼓励我继续创作!