我在我的网站上添加了付款方式模块。付款方式在管理员配置中可见,但在付款步骤的前端则不可用。
我有一个名为config.xml
的配置文件,其代码为
<?xml version="1.0"?>
<config>
<modules>
<Goodahead_Santander>
<version>1.0.0</version>
</Goodahead_Santander>
</modules>
<global>
<models>
<goodahead_santander>
<class>Goodahead_Santander_Model</class>
<resourceModel>goodahead_santander_resource</resourceModel>
</goodahead_santander>
<goodahead_santander_resource>
<class>Goodahead_Santander_Model_Resource</class>
<entities>
<finance_id>
<table>goodahead_santander_finance_id</table>
</finance_id>
</entities>
</goodahead_santander_resource>
</models>
<resources>
<goodahead_santander_setup>
<setup>
<module>Goodahead_Santander</module>
<class>Mage_Eav_Model_Entity_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</goodahead_santander_setup>
<goodahead_santander_write>
<use>core_write</use>
</goodahead_santander_write>
<goodahead_santander_read>
<use>core_read</use>
</goodahead_santander_read>
</resources>
<blocks>
<goodahead_santander>
<class>Goodahead_Santander_Block</class>
</goodahead_santander>
</blocks>
<helpers>
<goodahead_santander>
<class>Goodahead_Santander_Helper</class>
</goodahead_santander>
</helpers>
</global>
<frontend>
<layout>
<updates>
<goodahead_santander>
<file>goodahead/santander.xml</file>
</goodahead_santander>
</updates>
</layout>
<events>
<controller_action_predispatch_checkout_cart_index>
<observers>
<goodahead_messages_postdispatch_checkout_cart_add>
<class>goodahead_messages/observer</class>
<method>addIsInCart</method>
</goodahead_messages_postdispatch_checkout_cart_add>
</observers>
</controller_action_predispatch_checkout_cart_index>
<controller_action_predispatch_checkout_onepage_savePayment>
<observers>
<goodahead_santander_controller_action_predispatch_savePayment>
<class>goodahead_santander/observer</class>
<method>onSavePaymentMethod</method>
</goodahead_santander_controller_action_predispatch_savePayment>
</observers>
</controller_action_predispatch_checkout_onepage_savePayment>
<checkout_submit_all_after>
<observers>
<goodahead_santander_checkout_submit_all_after>
<class>goodahead_santander/observer</class>
<method>sendOrderEmail</method>
</goodahead_santander_checkout_submit_all_after>
</observers>
</checkout_submit_all_after>
</events>
</frontend>
<default>
<payment>
<santander>
<active>1</active>
<model>goodahead_santander/Finanzierung</model>
<order_status>1</order_status>
<title>Finanzierung</title>
<allowspecific>0</allowspecific>
<form_block_type>0</form_block_type>
<payment_action>authorize</payment_action>
<show_bank_accounts_in_pdf>1</show_bank_accounts_in_pdf>
<show_customtext_in_pdf>1</show_customtext_in_pdf>
</santander>
</payment>
</default>
</config>
和system.xml
是
<?xml version="1.0"?>
<config>
<sections>
<payment>
<groups>
<santander translate="label" module="goodahead_santander">
<label>Finanzierung</label>
<frontend_type>text</frontend_type>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<active translate="label">
<label>Enabled</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</active>
<title translate="label">
<label>Title</label>
<frontend_type>text</frontend_type>
<sort_order>20</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</title>
<vendornumber translate="label">
<label>Vendor number</label>
<frontend_type>text</frontend_type>
<sort_order>21</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>Your account number</comment>
</vendornumber>
<vendorpassword translate="label">
<label>Vendor password</label>
<frontend_type>password</frontend_type>
<sort_order>22</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>Your account password</comment>
</vendorpassword>
<endpoint translate="label">
<label>WSDL endpoint</label>
<frontend_type>text</frontend_type>
<sort_order>23</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>WSDL endpoint URL (Given by bank)</comment>
</endpoint>
<url translate="label">
<label>Financing URL</label>
<frontend_type>text</frontend_type>
<sort_order>24</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>Financing URL (Given by bank)</comment>
</url>
<order_status translate="label">
<label>New order status</label>
<frontend_type>select</frontend_type>
<source_model>goodahead_santander/source_order_status</source_model>
<sort_order>40</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</order_status>
<sort_order translate="label">
<label>Sort order</label>
<frontend_type>text</frontend_type>
<sort_order>50</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</sort_order>
<allowspecific translate="label">
<label>Payment from applicable countries</label>
<frontend_type>allowspecific</frontend_type>
<sort_order>60</sort_order>
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</allowspecific>
<specificcountry translate="label">
<label>Payment from Specific countries</label>
<frontend_type>multiselect</frontend_type>
<sort_order>70</sort_order>
<source_model>adminhtml/system_config_source_country</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</specificcountry>
<min_order_total>
<label>Minimum Order Total</label>
<frontend_type>text</frontend_type>
<sort_order>71</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</min_order_total>
<max_order_total>
<label>Maximum Order Total</label>
<frontend_type>text</frontend_type>
<sort_order>72</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</max_order_total>
</fields>
</santander>
</groups>
</payment>
</sections>
<!-- FINANCING CALCULATOR -->
<tabs>
<goodahead translate="label" module="goodahead_santander">
<label>Goodahead</label>
<sort_order>300</sort_order>
</goodahead>
</tabs>
<sections>
<goodahead_calculator translate="label">
<label>Financing Calculator</label>
<tab>goodahead</tab>
<frontend_type>text</frontend_type>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<rates translate="label">
<label>Rates</label>
<frontend_type>text</frontend_type>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<cms_page translate="label">
<label>CMS page:</label>
<frontend_type>text</frontend_type>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>Enter CMS page url key</comment>
</cms_page>
<shipping translate="label">
<label>Shipping cost:</label>
<frontend_type>text</frontend_type>
<sort_order>20</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>Shipping cost included to calculation</comment>
</shipping>
<rates translate="label">
<label>Months and Rates:</label>
<frontend_type>text</frontend_type>
<frontend_model>goodahead_santander/adminhtml_rates</frontend_model>
<backend_model>adminhtml/system_config_backend_serialized</backend_model>
<sort_order>30</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</rates>
</fields>
</rates>
</groups>
</goodahead_calculator>
</sections>
</config>
和名为Finanzierung.php
的模型文件是
<?php
class Goodahead_Santander_Model_Finanzierung extends Mage_Payment_Model_Method_Abstract
{
protected $_code = 'santander';
// protected $_canAuthorize = true;
protected $_formBlockType = 'goodahead_santander/form';
protected $_infoBlockType = 'goodahead_santander/info';
/**
* SoapClient object
* @var SoapClient
*/
protected $_soapClient;
/**
* WSDL endpoint url
* @var string
*/
protected $_endpoint;
/**
* Parameters for SOAP request
* @var array
*/
protected $_params;
/**
* @see Mage_Payment_Model_Method_Abstract::isAvailable()
*/
public function isAvailable($quote = null)
{
if (!$this->getEndpoint()
|| !$this->_getVendorNumber()
|| !$this->_getVendorPassword()
|| !$this->getConfigData('url')
) {
return false;
}
return parent::isAvailable($quote);
}
}
?>
和布局设计文件是
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<checkout_onepage_index>
<reference name="head">
<action method="addJs"><script>goodahead/santander/calculator.js</script></action>
</reference>
</checkout_onepage_index>
<santander_redirect_index>
<reference name="content">
<block type="goodahead_santander/redirect" name="redirect" as="redirect" template="goodahead/santander/redirect.phtml" />
</reference>
</santander_redirect_index>
<checkout_cart_index>
<reference name="head">
<action method="addJs"><script>goodahead/santander/calculator.js</script></action>
</reference>
<reference name="checkout.cart">
<block type="goodahead_santander/calculator" name="goodahead.santander.calculator" as="calculator" template="goodahead/santander/calculator.phtml"/>
</reference>
</checkout_cart_index>
</layout>
请帮忙。
答案 0 :(得分:2)
<?php
class Goodahead_Santander_Model_Finanzierung extends Mage_Payment_Model_Method_Abstract
{
protected $_code = 'santander';
protected $_canUseInternal = true;
protected $_canUseCheckout = true;
}
?>
请参阅以上示例代码 $ _canUseInternal = true; //这意味着您必须在管理员中使用付款 $ _canUseInternal = true; //这意味着您必须在结帐时使用付款