Magento 不显示管理中的所有类别

发布于 2024-10-20 10:13:18 字数 370 浏览 4 评论 0原文

我们有一个 magento 商店,其中包含各种类别(子类别)。我们的问题是,当我们进入管理员管理左侧类别树中的类别时,我们的一些具有子类别的类别看起来与左侧的加号(+)图标正确,但当我们尝试扩展类别时,magento 却没有不显示任何项目。

ajax 调用指向这个 url:

index.php/admin/catalog_category/categoriesJson/key/09b218741dce69171825fdbf4954855d/?isAjax=true

并返回一个空数组,不会引发任何错误。前端正确显示所有类别。

Magento 版本 1.4.2.1

有什么想法吗?

we have a magento store with various categories one inside another (subcategory). Our problem is that when we enter in the admin to manage categories in the category tree on the left, some of our categories that has subcategories looks correctly with the plus (+) icon on the left but when we try to expand the category magento doesn't display any item.

The ajax call point to this url:

index.php/admin/catalog_category/categoriesJson/key/09b218741dce69171825fdbf4954855d/?isAjax=true

and it returns an empty array without throwing any error. Frontend displays all the categories correctly.

Magento version 1.4.2.1

Any idea ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

弥繁 2024-10-27 10:13:19

对于上述情况,此查询可能会有所帮助:

select c.entity_id cid, p.entity_id pid
from 
  catalog_category_entity c
  inner join catalog_category_entity p on c.parent_id = p.entity_id
where c.level != p.level+1

不过,它对我的​​类别没有帮助。

For the mentioned cases, this query could have helped:

select c.entity_id cid, p.entity_id pid
from 
  catalog_category_entity c
  inner join catalog_category_entity p on c.parent_id = p.entity_id
where c.level != p.level+1

It didn't help me with my categories, though.

窗影残 2024-10-27 10:13:18

您想要进入表catalog_category_entity

运行以下 SQL 查询:

UPDATE catalog_category_entity SET children_count =
(SELECT COUNT(*) FROM
(SELECT * FROM catalog_category_entity) AS table2
WHERE path LIKE
CONCAT(catalog_category_entity.path,"/%"));

you want to go into table catalog_category_entity

run the following SQL query:

UPDATE catalog_category_entity SET children_count =
(SELECT COUNT(*) FROM
(SELECT * FROM catalog_category_entity) AS table2
WHERE path LIKE
CONCAT(catalog_category_entity.path,"/%"));
素手挽清风 2024-10-27 10:13:18

阅读约瑟夫的答案后,我尝试在catalog_category_entity中搜索错误,发现我的树中的所有类别都具有级别1或2,除了未出现的级别7的类别。奇怪的是,级别7是无论如何,这些类别的正确级别我认为问题是 Magento 找到了级别为 2 的类别,并且它直接子级的级别为 7,并且它不将这些类别识别为父亲类别的子级。

我已将孩子的级别更改为 2,一切似乎都正常。

为什么我的树中的所有类别都是级别 1 ?我不知道 ...

After reading Joseph answer i've tried to search for errors in catalog_category_entity and founded that all the categories in my tree has level 1 or 2 except for the categories that doesn't appear that have level 7. The strange things is that level 7 is the correct level for those category anyway i think that the problem is that Magento found a category with level 2 and it direct children has lavel 7 and it doesn't recognize those category as children for the father category.

I've changed level of the children to 2 and everything seems to work.

Why all the category in my tree has level 1 ? i don't know ...

逆光飞翔i 2024-10-27 10:13:18

您是否以编程方式创建类别(而不是使用管理界面)?正如 Magento 中常见的情况一样,当数据库中某些值丢失或不正确时,条目可能根本不会显示。如果是这种情况,请查看数据库中的“良好”类别记录,并确保缺失的类别遵循正确的约定。

希望有帮助!

谢谢,

Did you create the categories programmatically (as opposed to using the admin interface)? As is often the case in Magento, when some value is missing or incorrect in the database, entries may not show up at all. If this is the case, please take a look at a "good" category record in the database and make sure that the missing categories follow the correct conventions.

Hope that helps!

Thanks,
Joe

寂寞陪衬 2024-10-27 10:13:18

就我而言,我导入了所有类别并将“级别”指定为其在树中的位置。也许这不是它的目的,因为将所有类别设置为 2 级别效果很好,并且使我的树保持完整。

我曾经在设置错误后将所有级别设置为 2 的代码:

    foreach ($categories as $category) {
        $category = $category->load($category->getId());

        $level = $category->getLevel();

        if($level > 2) {
            $category->setLevel(2);
            $category->save();
        }

    }

In my case I imported all of the categories and assigned 'level' as its position in the tree. Maybe that isn't what it's for, because setting all the categories to a level of 2 worked beautifully and kept my tree intact.

Code I used to put all levels to 2 after setting it incorrectly:

    foreach ($categories as $category) {
        $category = $category->load($category->getId());

        $level = $category->getLevel();

        if($level > 2) {
            $category->setLevel(2);
            $category->save();
        }

    }

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文