How can I make duplicates of authorize.net module in magento? - php

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.

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.

Along with below code we need to change the model also, in config.xml. if you not make below change new payment method will not displayed in checkout
<models>
<authorizenet1>
<class>Mage_Paygate1_Model</class>
</authorizenet1>
</models>

Related

Joomla PHP code

I'm new in using Joomla and i need your help please.
I'm newly working in a company. The company bought a web shop from other company and the web shop is live now.
One button in one of the pages is responsible to place an order and the action for this button is to send an email with all the data about the orders to my company.
Now my task is to develop an API which does the following:
when clicking on that button the information should be handles in certain way and sent to other system which our company have and this system is used by my company to handle the different orders.
My problem is that i can't find the php page that contains the code which is creating these orders email in order to change it.
Is there is any tool or plugin which might help or do you have any idea how to handle this situation?
Hint: I'm not able to get any support from the company who programmed the web shop
It is very hard to tell you what to do when we don't even know which Joomla e-commerce extension you are using. Nevertheless, there are things that you can do to find out which file is doing the actual processing of the order.
However, before even doing that, you will need to define what "order processing" means. Is it when the order is saved to the database? Is it when the order is approved by the payment gateway?
In the first case, you will need to look up for code saving the data to the database (which is likely in the models folder of the extension - it might also be in the controllers), in the latter case, you will need to look up for the code processing the payment (which is likely in the controllers folder or the helpers folder).
Note that some "advanced" e-commerce extensions trigger events when an order is processed that you can use in a plugin in order to do what you want.

Yii2 module independency

We're developing an Yii2 php appliction, which can be seen as a AirBNB clone for sake of simplicity. I'm trying to devide the application into modules, but keep getting ugly dependencies no matter how I twist or try. Couple of examples:
There is a booking and an item module, when displaying an item, the booking module is also to be used to disable dates when an item is already booked.
On the confirm booking page, a credit card form is implemented which belongs to the payment module, which couples the modules really tightly.
The homepage should display items, which depend on the item module for generating the right image url's etc.
How can we keep this kind of things decoupled?
For anybody looking at the same problem, I currently solved it by keeping every strictly decoupled. Modules can either make a call to a custom made WidgetRequester, which sees is a requested widget exists in another module, and returns it if it does, which solves the problem of pages with multiple module dependencies (an item page with a booking form i.e.).
Modules can also trigger normal Yii events, which can be picked up by other modules in their Bootstrap file, and process the events to their own liking.

Magento backend shipping selection

Heyhey,
I made a pretty kickass Magento 1.6 module to select a store and time to come pick stuff up at the shop, and it works fine in the front end. It doesn´t however appear in the backend, and the backend order creation system needs to have the same functionality.
How do I enable my module for backend order creation?
I'll supply any details needed!
Kind regards,
Alex
in the file:
/app/design/adminhtml/default/default/layout/sales.xml
around line 497 (on my version, which is Enterprise 1.10.0.1)
you should find
<adminhmtl_sales_order_create_index>
I strongly believe that has the information on what you want. Your module will need it's own layout xml file that references these areas to insert its own content. Then, you will need to hook into the order create event with an observer to run your own code to deal with the data. This may already be happening, as I'm not sure if the backend code creating the order is any different from the front end.
Hope this helps as a jumping off point.

Magento new user registration - inject own code

I'm trying to make a loose connection between a Magento installation and another application. In particular, there are only two things I care about at the moment - customers and their purchases. What I edited thus far is the file app/code/core/Mage/Customer/controllers/AccountController.php - function createPostAction() is augmented to send the customer's info to the other application. Another modification was made in success.phtml file to send out the details of the order once it's placed.
The problem I'm having is that if a user just places items in a cart (as a guest) and then registers as part of the checkout process - the customer's record in the second application is never created. It only works if the user first explicitly registers, and then checks out separately.
I suppose AccountController.php may be the wrong file to modify to achieve my desired result, which file should I use instead?
Edit: I am not including the code samples, as it's largely irrelevant - the problem is not with the code, but with the fact that it's apparently in the wrong place. Where would be a good place to add custom code which should run when a new customer is registered?
This is a bit tricky to do cleanly in Magento but possible to achieve. I've had the same task a while ago and solved using observers
First you need to create an observer which listens controller_action_postdispatch event:
<events>
<controller_action_postdispatch>
<observers>
<yourmodule_anything>
<type>singleton</type>
<class>yourmodule/observer</class>
<method>someMethod</method>
</yourmodule_anything>
</observers>
</controller_action_postdispatch>
</events>
Then in your observer method you can check action names as follows
<?php
$action = $observer->getEvent()->getControllerAction();
if ($action->getFullActionName() == 'customer_account_createpost') {
if (Mage::getSingleton('customer/session')->isLoggedIn()) { // this check allows to determine if customer session was created which means successfull registration
}
}
Something similar can be done for checkout registration. In general observers are great (and proper) way to extend Magento functionality. Read more about them here
Anton S is right - you should check if Magento is firing an event when this occurs. If so, your code should respond to that event.
If that is not the case, or you need custom logic to run before the account is created, please consider overriding/overloading the controller using a custom module: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_overload_a_controller
This keeps the original core code intact. It essentially tells Magento to use your custom controller instead. If the method it needs to execute is not found in your controller, it will use the code from the core instead.

Add my own shipping methods in oscommerece

I want to add an own shipping method during checkout_shipping.php. Something like a dropdown list, from that the customer will select his shipping method and enter his own account no in a textbox. How should I implement this?
Hey, I'm currently working on a project that involves OScommerce. I agree with Keyo, but I know that sometimes is not that it easy to migrate ;)
The payment methods are contribution, if you would like to build your own you have to build two files (at least, because there is one of the files that is the language)
Here you have direct access to a payment module made for mercadopago Argentina (like PayPal)
http://addons.oscommerce.com/info/6504
If you check the zip file you are going to see that the files have to be added in the catalog - include
then you have the one I already told (language)
and modules - payment.
I made a few payment methods my self, it's not hard, but you have to remember that OScommerce is like 6 years old, so the code is not the best ;)
I hope this helps.
P.S. If you want more payment methods you can look here:
addons.oscommerce.com/category/Payment_Modules

Categories