将列添加到 Magento 管理目录 >管理产品
您好,我想在目录中添加一列> >管理产品部分(不是产品,而是产品列表),此列需要列出该产品已识别的任何相关产品 - 可能按 SKU 或名称 - 没有偏好。
我为制造商添加了一个列,但忘记了从哪里获得代码。
谢谢
Hi I want to add a column to the catolg > manage products section (not the product but the list of products), this column needs to list any related products the product has identified with it - maybe by sku or name - no preferance there.
I added a column for manufacturer but forgot where i obtained the code from.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最近(事实上是昨天)必须在同一个网格中添加一列。部分是因为这是不好的做法,而且主要是因为另一个模块已经使用了它自己的覆盖,我不想完全替换或覆盖该类。相反,这是一种通过事件修改产品网格的简洁方法。
app/code/local/My/Module/etc/config.xml
app/code/local/My/Module/Model/Adminhtml/Observer
I recently (yesterday in fact) had to add a column to the same grid. Partly because it is poor practice and mostly because another module had already used it's own override, I didn't want to replace or override the class completely. Instead here is a clean way to modify the product's grid via events.
app/code/local/My/Module/etc/config.xml
app/code/local/My/Module/Model/Adminhtml/Observer
为了改进clockworkgeek的答案https://stackoverflow.com/a/5994209/1025437:
我决定不使用观察员们,在我看来,这些事件太过全球性,导致我们的观察员被多次召集。在您自己的模块 config.xml 中使用以下重写:
以下文件包含
类似内容:
在此示例中,在列
price
之后添加名为special_price
的属性。由于该属性具有 store 范围,因此添加了对 store 的检查。To improve on answer https://stackoverflow.com/a/5994209/1025437 by clockworkgeek:
I decided not to use the observers, in my opinion those events are too global and lead to our observer being called many times. Using the following rewrite in your own module config.xml:
With the following file in
containing something like:
In this example, an attribute named
special_price
is added after columnprice
. Since this attribute has a store scope, the check for store is added.