Magento:具有数千个值/选项的属性

发布于 2024-10-02 19:36:24 字数 462 浏览 2 评论 0原文

我正在 Magento 中创建一家书店,但无法找出处理书籍作者(这将是产品)的最佳方法。

我目前拥有的是一个名为“作者”的属性,它是多选的和一千个[测试]值。它仍然可以管理,但在编辑产品时确实会有点慢。此外,当向authors属性本身添加选项/值时,HTML中会呈现一个巨大的列表,这使得这是一个低效的解决方案。

  • 我还应该采取另一种方法吗?
  • 是否可以创建一个通过连接表与产品关联的作者对象(实体类型?)?如果是,有人可以给我解释一下这是如何完成的,或者给我指出一些好的文档吗?
  • 如果我采用作者对象方法,它仍然可以在分层导航中使用吗?
  • 如何显示单个作者的所有书籍列表?

提前致谢!

PS:我知道诸如改进导航之类的扩展,但据我所知,它向属性本身添加了诸如属性之类的内容,这不是我想要的。

对于 Google 员工:这同样适用于音乐网站或制造商的艺术家。

I'm creating a Book store in Magento and am having trouble figuring out the best way to handle the Authors of a Book (which would be the product).

What I currently have is an Attribute called "authors" which is multi-select and a thousand [test] values. It's still manageable but does get a little slow when editing a product. Also, when adding an option/value to the authors attribute itself, a huge list is rendered in the HTML making this an inefficient solution.

  • Is there another approach I should take?
  • Is it possible to create an Author object (entity type?) which is associated to a product through a join table? If yes, can someone give me an explanation about how that is done or point me to some good documentation?
  • If I'd take the Author object approach, could that still be used in the layered navigation?
  • How would I show the list of all books for a single author?

Thanks in advance!

PS: I am aware of extensions like Improved Navigation but AFAIK it adds something like attributes to attributes themselves which is not what I'm looking for.

For Googlers: The same would apply for Artists of a music site or manufacturers.

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

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

发布评论

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

评论(1

贪了杯 2024-10-09 19:36:24

如果您创建一个作者实体类型,您只会增加尝试将其添加到分层导航的工作,而且我不认为它会更快。

鉴于 Magento 的设置方式,您的方法似乎最适合该问题。您将如何在分层导航中显示 1,000 位(与实际列表相比可能相形见绌)作者?

根据要求,您可以采用非规范化字段并接受其文本的方式。这仍然允许您显示它、基于它进行搜索等,但无需渲染每个可能的艺术家来操作列表。您可以在选择合适的艺术家时添加一些代码(基本上是在后端字段中添加 AJAX 自动完成功能),以尽量减少拼写错误。

或者,您可以编写一个简单的实用程序来将新艺术家添加到系统中,而无需 Magento 加载列表的一些开销。不过,老实说,这可能在前端造成的滞后可能会超过后端的问题。

希望有帮助!

谢谢,

If you create an author entity type, you'll just increase your work trying to add it to layered navigation, and I don't see a reason why it would be faster.

Your approach seems the best fit to the problem, given the way Magento is set up. How are you going to display 1,000 (which presumably pales in comparison to the actual list) authors in layered navigation?

Depending on the requirements, you could go the route of denormalizing the field and accepting text for it. That would still allow you to display it, search based on it, etc, but would eliminate the need to render every possible artist to manipulate the list. You could add a little code around selecting the proper artist (basically add an AJAX autocomplete to the backend field) to minimize typos as well.

Alternatively, you could write a simple utility to add a new artist to the system without some of the overhead of Magento's loading the list. To be honest, though, it seems that the lag that this has the potential to create on the frontend will probably outweigh the backend trouble.

Hope that helps!

Thanks,
Joe

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