我在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'));
}
}
我认为我的问题在于模型和阻止类型的路径,但我认为我花了太多时间来调试问题,而且看不清了。
任何人都能看到错误的位置?
答案 0 :(得分:1)
声明模块的块:
spApp.controller('spListCtrl', function($scope, $http, $q) {
$http.post("https://tools.site.com/_api/lists/getbytitle('PersonalFilter')/items", {
'Title': 'TEST'
}, {
headers: {
'Accept': 'application/json; odata=verbose',
'X-RequestDigest': $("#__REQUESTDIGEST").val()
}
}).success(function(data, status, headers, config) {
console.log("YES");
}).error(function(data, status, headers, config) {});
});