Magentoチェックアウトページで、私は好きCredit card payment on delivery
ですthe cash on delivery
配達時にこのクレジットカード支払いを実装した人はいますか?助けてください
また、参照用のリンクを提供してください
前もって感謝します
Magentoチェックアウトページで、私は好きCredit card payment on delivery
ですthe cash on delivery
配達時にこのクレジットカード支払いを実装した人はいますか?助けてください
また、参照用のリンクを提供してください
前もって感謝します
コーディングするだけです。はい、それを行うことは可能です。
基本的には、次のようなモデルが必要です: 支払いモジュールの基本構造は次のとおりです (1 つの追加情報フィールドを持つ基本的な支払いの例を示します:
Module
------->Block
------------->Form
------------------->Pay.php
------------->Info
------------------->Pay.php
------->etc
------------->config.xml
------------->system.xml
------->Model
------------->Paymentmethodmodel.php
このモジュールに関する重要事項:
Yourpaymentmodule_Block_Form_Pay
このブロックはフロントエンド ビューを作成します。コード:
<?php
class YourPaymentModule_Block_Form_Pay extends Mage_Payment_Block_Form
{
protected function _construct(){
parent::_construct();
$this->setTemplate('yourpaymentmodule/form/pay.phtml');
}
}
もう 1 つは Yourpaymentmodule_Block_Info_Pay で、これは Admin Order Details からビューを作成します。
<?php
class YourPaymentModule_Block_Info_Pay extends Mage_Payment_Block_Info
{
protected function _construct(){
parent::_construct();
$this->setTemplate('yourpaymentmodule/form/pay.phtml');
}
protected function _prepareSpecificInformation($transport = null)
{
if (null !== $this->_paymentSpecificInformation) {
return $this->_paymentSpecificInformation;
}
$info = $this->getInfo();
$transport = new Varien_Object();
$transport = parent::_prepareSpecificInformation($transport);
$transport->addData(array(
Mage::helper('payment')->__('Additional Information') => $info->getAdditional(),
));
return $transport;
}
}
そして最後にあなたのモデルで:
<?php
class PPaymentModuleName_Model_PaymentModuleName extends Mage_Payment_Model_Method_Abstract
{
protected $_code = 'custompaymentmodule';
protected $_formBlockType = 'custompaymentmodule/form_pay';
protected $_infoBlockType = 'custompaymentmodule/info_pay';
protected $_canUseInternal = true;
protected $_canOrder = true;
public function assignData($data)
{
if (!($data instanceof Varien_Object)) {
$data = new Varien_Object($data);
}
$info = $this->getInfoInstance();
$info->setAdditionalINformation($data->getAdditionalINformation());
return $this;
}
public function canUseForCountry($country)
{
return true;
}
public function canUseForCurrency($currencyCode){
return true;
}
}
?>
あなたのphtmlファイルで、単純なフィールドか何かでデザインを作成します。
他に重要なことは、etc/modules/CustomPaymentModule.xml にあります。
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<CustomPaymentModule>
<active>true</active>
<codePool>community</codePool>
<depends>
<Mage_Payment />
</depends>
</CustomPaymentModule>
</modules>
</config>
で、これです。