【问题标题】:Credit card payment on delivery信用卡货到付款
【发布时间】:2012-12-05 11:49:36
【问题描述】:

ma​​gento 结帐页面 我想要 Credit card payment on delivery 喜欢 the cash on delivery

有人实施过这个信用卡货到付款请帮帮我

还请提供参考链接

提前致谢

【问题讨论】:

  • 你需要什么??只需注册这种付款或其他什么时候?一些商业规则??你试过什么?贴一些代码。
  • 信用卡或货到付款或两者兼有?
  • 您可以启用信用卡保存和汇票选项。这符合您的要求吗?
  • 我只想知道是否可以添加信用卡货到付款,例如货到付款
  • @rs 信用卡/货到付款是商家对客户通过货到付款完成的,因此一些客户有信用卡

标签: magento-1.7 magento


【解决方案1】:

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

基本上你只需要这样的模型: 支付模块的基本结构是(我将展示带有 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,这个是从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>

就是这样。

【讨论】:

    猜你喜欢
    • 2017-05-31
    • 2013-01-25
    • 2012-07-11
    • 2019-02-25
    • 2015-07-01
    • 2012-11-27
    • 2017-09-19
    • 1970-01-01
    • 2016-04-23
    相关资源
    最近更新 更多