信用卡付款交货

时间:2012-12-05 11:49:37

标签: magento-1.7 magento

magento结帐页中,我希望Credit card payment on deliverythe cash on delivery一样

有人实施此信用卡付款,请帮助我

另请提供相关链接

提前致谢

1 个答案:

答案 0 :(得分:4)

只需编码,是的,可以这样做。

基本上你只需要这样的模型: 付款模块的基本结构是(我将显示基本付款的示例,其中包含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');
}
}

另一个是Yourpaymentmodule_Block_Info_Pay,这个来自管理员订单明细。

<?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>

就是这样。