2
我在使用Magento自定義付款方式時遇到了一些困難。 我不斷收到此錯誤:
invalid blocktype
這是我到目前爲止所。
MobilePay
---------->Block
----------------->Form
----------------------->Default.php
---------->etc
----------------->config.xml
----------------->system.xml
---------->Model
----------------->Mobilepay.php
如default.php
<?php
class DevilfishMedia_MobilePay_Block_Form_Default extends Mage_Payment_Block_Form
{
protected $_instructions;
protected function _construct()
{
parent::_construct();
$this->setTemplate('payment/form/mobilepay.phtml');
}
public function getInstructions()
{
if (is_null($this->_instructions)) {
$this->_instructions = $this->getMethod()->getInstructions();
}
return $this->_instructions;
}
}
config.xml中
<?xml version="1.0"?>
<config>
<default>
<payment>
<mobilepay>
<active>1</active>
<model>mobilepay/mobilepay</model>
<order_status>processing</order_status>
<title>MobilePay</title>
</mobilepay>
</payment>
</default>
<modules>
<DevilfishMedia_MobilePay>
<version>0.1.0</version>
</DevilfishMedia_MobilePay>
</modules>
<global>
<helpers>
<mobilepay>
<class>DevilfishMedia_MobilePay_Helper</class>
</mobilepay>
</helpers>
<models>
<mobilepay>
<class>DevilfishMedia_MobilePay_Model</class>
<resourceModel>mobilepay_mysql4</resourceModel>
</mobilepay>
<payment>
<rewrite>
<method_abstract>DevilfishMedia_MobilePay_Model_Payment_Method_Abstract</method_abstract>
</rewrite>
</payment>
</models>
</global>
</config>
的system.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<sections>
<payment>
<groups>
<mobilepay translate="label" module="mobilepay">
<label>MobilePay</label>
<sort_order>100</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</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>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</active>
<order_status translate="label">
<label>Ny ordre status</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status_processing</source_model>
<sort_order>2</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</order_status>
<title translate="label">
<label>Titel</label>
<frontend_type>text</frontend_type>
<sort_order>3</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</title>
<instructions translate="label">
<label>Beskrivelse</label>
<frontend_type>textarea</frontend_type>
<sort_order>4</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</instructions>
</fields>
</mobilepay>
</groups>
</payment>
</sections>
Mobilepay.php
<?php
class DevilfishMedia_Mobilepay_Model_Mobilepay extends Mage_Payment_Model_Method_Abstract
{
protected $_code = 'mobilepay';
protected $_formBlockType = 'form_default';
protected $_canUseInternal = true;
protected $_canUseCheckout = true;
protected $_canUseForMultishipping = true;
public function getInstructions()
{
return trim($this->getConfigData('instructions'));
}
}
我認爲我的問題是模型和路徑blocktype,但我認爲我花了太多的時間來調試問題,不能再看清楚了。
任何人都能看到錯誤在哪裏?
非常感謝。現在好了:) – puntable