2015-05-07 84 views
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,但我认为我花了太多的时间来调试问题,不能再看清楚了。

任何人都能看到错误在哪里?

回答

1

声明你的模块的模块:

<global> 
    <blocks> 
     <mobilepay> 
     <class>DevilfishMedia_MobilePay_Block</class> 
     </mobilepay> 
    </blocks> 
    <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> 
+0

非常感谢。现在好了:) – puntable