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 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services