Magento:如果父类别为空,则显示子类别中的产品

发布于 2024-08-21 16:29:50 字数 133 浏览 1 评论 0原文

我有以下类别

汽车零件 (0) 轮胎 (0) 轮辋 (5)

现在,在产品列表中,显然汽车零件和轮胎列表返回 0 个产品。但对于用户来说,这很尴尬。如果类别为空,是否可以显示子项目?

亲切的问候

I have the following categories

Car parts (0)
Tires (0)
Rims (5)

Now in the product listing obviously the car parts en tires listing returns 0 products. But for the user this is ankward. Is it possible to show child items if a category is empty?

Kind regards

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

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

发布评论

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

评论(2

巷子口的你 2024-08-28 16:29:50

您是否已在管理界面中将该类别标记为锚类别?这应该允许子类别的产品显示在父类别列表中。

希望有帮助。

谢谢,

Have you marked the category as an anchor category in the administrative interface? That should allow child categories' products to show up in the parent category listing.

Hope that helps.

Thanks,
Joe

世界如花海般美丽 2024-08-28 16:29:50

我自己花了几个小时寻找这个问题的答案,终于找到了解决方案。

由于许多网站和问题给出的解决方案是“将父类别设置为‘isanchor=yes’或‘尝试重新索引您的产品’,您可能会发现这些都不起作用。但是,您需要将这些结合起来:

1. 首先,将要显示其子类别产品的类别设置为“是锚定->是”(管理中的“目录”>“管理类别”)。
您现在将看到该类别包含所有子类别总共包含的产品数量。

2. 要在您的网站上显示此内容,您现在必须重新索引数据。在管理中,转到“系统”>“索引管理并勾选“类别产品”复选框。点击“发送”,它将重新索引。

瞧,您的产品会显示在您希望显示的位置。一个缺点是页面现在还将显示“分层导航”,但如果您不希望这样做,您可以简单地将包含此内容的 div 设置为 display:none在CSS中。

我们将这一切归功于我找到它的这个网站:
http:// /sheldonrcohen.com/Blog/tabid/88/EntryId/12/Magento-parent-category-not-showing-sub-category-products.aspx

谢谢谢尔顿·科恩! :)

I've been looking for hours for an answer to this myself, and finally found the solution.

As many sites and questions give the solution "set the parent category to 'is anchor=yes' or 'try re-indexing your products', you might find that neither of these work. However, you need to combine these:

1. First, set the categories of which you want to show its sub-categories' products, to 'is anchor -> Yes'. (Catalog > Manage categories' in admin)
You will now see that this category has the number of products all the sub-categories together contain.

2. To show this on your website, you have to reindex the data now. In admin, go to System > Index Management and tick the 'Category products' checkbox. Hit 'send' and it'll reindex.

Voilà, your products show where you want them to show. One downside is that the page will now also show 'layered navigation', but if you don't want this you can simply set the div that contains this to display:none in CSS.

We owe it all to this site where I found it:
http://sheldonrcohen.com/Blog/tabid/88/EntryId/12/Magento-parent-category-not-showing-sub-category-products.aspx

Thanks Sheldon Cohen! :)

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