Magento - Adminhtml - 新客户表单中的默认网站
我正在为我的客户开发一家在线商店,我们的 Magento 设置中只有一个网站。
在管理面板中,当我转到“添加客户”屏幕时,在“关联到网站”字段中,我看到默认选择“管理员”。我希望默认情况下有我的网站。
我认为一种可能的方法是编写一些代码: Mage_Adminhtml_Block_Customer_Edit_Tab_Account::initForm
I am developing an online store for my customer and, we only have one website in our Magento setup.
In the admin panel when I go to Add a customer screen, in the "Associate to Website" field I see "Admin" selected by default. I would like to have my website there by default.
I think one possible way would be to write some code in:
Mage_Adminhtml_Block_Customer_Edit_Tab_Account::initForm
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最简洁的方法是在数据库中设置默认值。这根本不需要更改任何代码。
上面的示例 MySQL 语句将默认的 website_id 设置为 1。
The cleanest way to do this is the just set the default value in your database. This will require no code changes at all.
The sample MySQL statement above sets your default website_id to 1.
或者您可以简单地编辑数组:
Or You can simply edit array in:
我从Lrrr的答案中得到了提示仅使用用户添加的网站填充下拉列表,即“请选择”和“管理员”不再可用作选项,方法是添加以下行:
在此函数的末尾:
理想的方法当然是覆盖上面的函数在自己的模块中,但在我们的例子中,重写上面的类会与我们安装的另一个扩展产生冲突,所以我采取了这种方式。
I took the hint from Lrrr's answer and populated the drop-down with only user added websites, that is "Please Select" and "Admin" are no more available as options there by adding the following line:
at the end of this function:
The ideal way would be of course to override the above function in one's own module, but in our case overriding the above class creates conflict for another extension that we have installed, so I took this way round.