doupingpeng7567 2013-01-03 03:09
浏览 78
已采纳

如何在magento中复制authorize.net模块?

I've been stuck on this for a couple of days now. For some reason, duplicating the Magento Authorize.net (Mage_Paygate) module just doesn't work on the front-end. I've managed to duplicate the module and have it show up with its own configuration options in the back-end, but I can't get the payment method to show up on front-end during check out.

So far I've tried copying the module and changing every single instance of the model names to avoid conflict, I've done this multiple times from scratch so I'm confident that it's not an issue of an invalid class call...

There's some kind of magic button that I'm missing. I'm really hoping to hear from someone who's successfully duplicated a core payment module, specifically Authorize.net

I need to create duplicates for accounting purposes. There is no other solution than to duplicate the authorize.net modules.

Thanks

EDIT: Some insight into why I need multiple copies of the authorize.net module: My company processes high volume sales, more than most merchant services will allow. The idea is that we will have several authorize.net modules pre-loaded with multiple authorize.net API credentials that each correspond to a different merchant, so that when one of the merchants caps out we can disable that payment method and enable the next one.

The reason I can't just switch the information in a single authorize.net module is that we need the funds for each credit card to be deposited into separate bank accounts - ECC, the software we use to transfer data from magento to quickbooks, accepts the payment method based on the Title field. In order to differentiate which credit card processor we are transferring funds for, we append a (ACRONYM) to the title field. When this title field changes, ECC poops itself because it suddenly doesn't know where the funds came from for the transactions it's downloading.

We've tried various things and feel that making copies of an authorize.net module would be the best solution. Thanks.

  • 写回答

2条回答 默认 最新

  • drqn5418 2013-01-06 08:07
    关注

    I managed to figure it out, here's what I did in case anyone else runs into this, it's very handy to be able to duplicate payment and shipping modules that follow different rules without having to rely on store view changes:

    Create new module Namespace_Modulename , I used Mage_Paygate1 until my concept was proven. Copy the etc folder from the module you'd like to duplicate Copy the main model file, in my case Mage/Paygate/Model/Authorizenet.php

    Edit the system.xml: change group name so that a new block of configuration options will appear in the admin panel config, leave the module="" alone. We're going to refer to the original module files rather than copy them. I used authorizenet1.

    Change the label node if you'd like, for clarity. In my case I named my copies Authorize.net (processor name)

    Edit config.xml: Module name, change to Namespace_Modulename, I used Mage_Paygate1.

    Make sure there is a blocks declaration if the original config.xml didn't have one. We want to refer to the blocks folder in the original module, ie:

    <blocks>
    <directpost><class>Mage_Paygate_Block</class></directpost>
    </blocks>
    

    change the node in the bottom under

    <default><section> (<default><payment>) to the group name used in system.xml 
    (authorizenet1)
    

    Make sure the model node is correctly pointing to the new module, not the old. (paygate1/authorizenet)

    Now edit the new model, (Authorizenet.php):

    rename the Class to match the new Namespace_Modulename (Mage_Paygate1)

    Make sure the $_code equals your group name from the config.xml file (authorize1)

    That's what worked for me. The idea is to only copy the pieces that change the module's configuration and just recycle all of the original code.

    There's probably an even cleaner way to do this but I'm no magento master by any means, so I very much welcome any advice on how to future-proof this sort of hack.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
  • ¥15 Arcgis相交分析无法绘制一个或多个图形
  • ¥15 关于#r语言#的问题:差异分析前数据准备,报错Error in data[, sampleName1] : subscript out of bounds请问怎么解决呀以下是全部代码:
  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)