如果用户以访客用户身份访问结帐时,我尝试编写一个小扩展程序以停用付款方式(称为IsrInvoice)。
/app/etc/modules/Shiftmint_Disable_GuestInvoice.xml
public static int getPoints()
{
int age = -1;
boolean continueLoop = true;
while (continueLoop)
{
String inputStr = JOptionPane.showInputDialog("Enter point x1: ");
try {
age = Integer.parseInt (inputStr);
continueLoop = false;
}
catch (NumberFormatException e)
{
JOptionPane.showMessageDialog(null, "Age must be an integer!!");
}
}
return age;
}
/app/code/local/Shiftmint/Disable_GuestInvoice/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Shiftmint_Disable_GuestInvoice>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Payment/>
</depends>
</Shiftmint_Disable_GuestInvoice>
</modules>
</config>
/app/code/local/Shiftmint/Disable_GuestInvoice/Model/Observer.php
<?xml version="1.0"?>
<config>
<modules>
<Shiftmint_Disable_GuestInvoice>
<version>0.0.1</version>
</Shiftmint_Disable_GuestInvoice>
</modules>
<frontend>
<models>
<Shiftmint_Disable_GuestInvoice>
<class>Shiftmint_Disable_GuestInvoice_Model</class>
</Shiftmint_Disable_GuestInvoice>
</models>
<events>
<payment_method_is_active>
<observers>
<Shiftmint_Disable_GuestInvoice>
<type>singleton</type>
<class>Shiftmint_Disable_GuestInvoice/Observer</class>
<method>paymentMethodIsActive</method>
</Shiftmint_Disable_GuestInvoice>
</observers>
</payment_method_is_active>
</events>
</frontend>
</config>
有人知道我做错了什么,因为它不起作用!有没有办法测试加载的内容?
非常感谢您的建议, 斯蒂芬
答案 0 :(得分:0)
您不需要编写代码来停用访客结帐。它的magento内置功能。为了您登录,请转到左侧销售部分的系统菜单&gt;配置&gt;结帐按钮&gt;右侧的Checkout Options面板。展开“结帐选项”面板后,您会看到一个下拉菜单“允许访客结帐”;只需将其设置为否。一旦你这样做,它下面会出现一个标记为要求客户登录结账的下拉菜单;将其设置为Yes并单击右上角的Save Config按钮。