Magento Multiple Authorize.net Gateways - magento

I have a CAD and USD gateway accounts for processing credit card payments, both from a payment provider with support for the Authorize.net API. I've successfully configured one using Magento's built-in Authorize.net support... but how can I configure a second Authorize.net Gateway for use in my store?

You can reuse the existing authorize.net gateway if you assign separate websites to each currency. They don't need to be actually separate websites with their own domain, just to be designated as websites in the System > Manage Stores menu. Then in Configuration change the Configuration Scope drop down box in the top left to select each website in turn, on the Currency Setup section allow just one currency and in Payment Methods section you can have your specific gateway accounts to match.
This way lets you continue to use the same products for all stores and as long as the base currency is unchanged then it will also continue to convert between currencies automatically.

This can be done, but basically requires you to duplicate the Authorize module and change all the namespaces. This will take some fiddling, but start by copying the app/code/core/Mage/Paygate module to somewhere like app/code/local/Yourcompany/Paygatecad and proceed to rename the classes (Mage_Paygate_Model_Authorizenet becomes Yourcompany_Paygatecad_Model_Authorizenet, etc). Be careful of case-sensitive file and class names, I suggest you use all leading capital followed by lowercase.
Create a Yourcompany_Paygatecad.xml module declaration in app/etc/modules, and duplicate the layout and template files in adminhtml and frontend to use your new module name. You'll also need to edit the system.xml and config.xml so that the config values don't conflict in namespace. grep is your friend.
After all that, you should get a new Payment Method in the System>Config>Payment Methods that you can configure with your CAD details, and the blocks should render in the Checkout flow.
As you've probably gathered from what I've said, there's a fair few changes to be made to avoid conflicts, and you'll need to test this really well. But it should work. I'm not aware of any alternative approach to achieve this... I've done this successfully when I've wanted two different set of options for another payment method and it worked, but that was for a community extension, not Magento core, not that it should really matter where you're copying it from.
--------EDIT-----
Ideally, what you should do is copy and modify only the etc and sql files. That way the
original Mage_Paygate Models and controllers will still be used (gives you best protection for upgrades/patches) and you just update the config values to point to the CAD instance. I can't confirm whether this will work, but I would try that if at all possible.
HTH,
JD

Related

Magento custom model override

I'm new to Magento, so forgive my lack of knowledge. I am following a tutorial to integrate the contacts in Magento and import it to SugarCRM. The tutorial changes the core functions of Magento, but I would like to write a module and leave the core intact. I can easily find information about overriding controllers, models, helper, etc. But I have a question.
Imagining, for example, each time a user registers on my website, his contact information is exported to SugarCRM. In the save contact phase, in my module I know that I can write a specific code and tell that it would need to be run after or before some specific core-functions of Magento are done to save the contacts.What I really don't understand is, how will Magento know that I have a module that will perform me certain actions when I'm creating a new account?
The way magento handle this is by using events/observers. For instance, if you needed to send order information to another system after an order has been placed, you could create a custom module which observe sales_order_place_after.
Read more # http://codemagento.com/2011/04/observers-and-dispatching-events/
To get a list of events see https://magento.stackexchange.com/questions/153/where-can-i-find-a-complete-list-of-magento-events
For how to create an module with observer see https://stackoverflow.com/a/12696681/1191288

Modify an Order via the API prior to Invoicing?

In the default Magento 1.7 install is it possible to modify an order via the API prior to it being invoiced? I know there is no mechanism to do this in the Admin without a module but wasn't sure if the new API connections may allow this to happen.
To clarify, the idea here is someone places an order and then decided that they want to add something else to the order. Ideally I would like to push this change via the API from our other inventory system as our CSRs do not use the Magento interface to handle invoicing or shipment details.
I'm afraid this is not possible with the default Magento API. See the Sales Order API documentation. You may hold or cancel the order but not edit its information.
If you edit an order in the Magento backend and save it, the old order is cancelled and a new order is created. These orders are recognisable by a special number format ("-[versionnumber]" is appended to the order number), see the Managing and Editing Orders documentation.
You may want to mimic this behaviour using the default Magento API.
Get the information from the current order.
Create a new cart, fill it with the corrected information and create a new order for this cart (see the Checkout/Cart API documentation for necessary methods).
Cancel the old order.
It won't be trivial, but it should be possible.

How to build a Bridge and sync magento and zoho both ways

We want to build a bridge to synchronize data both ways in magento 1.6 and zoho crm -to synchronize leads, quotes, invoices, clients (assign them a user id and password for our B2B website) -to synchronize products attributes, etc...
Examples :
Each time a client fills up a form to be registered on my website it has to create a lead on magento like the first time login form ( i already made one web to lead form, but doesn't fit well with magento design and doesn't create the account in magento...)
Each time a client asks for a quote (through a form "Request a quote") on magento, it creates an opportunity, or a quote (or a lead ?).
I would like something really simple that adapts to magento structure that's all, in fact, it's a question of pushing/pulling DB records in both softwares (magento and zoho).
So I've been looking all around the web, but if you google "Zoho Magento integration" it will only return people ready to pay for that. Since I know magento a bit, I'm willing to do it by myself.
Thanks for Your help !
You will have to create a magento connector module to handle synchronization between Magento and ZOHO CRM API ( http://zohocrmapi.wiki.zoho.com/ ).
It is not easy. But if you have some experience with Magento development and do not know how to start with it, i would suggest you to download some similiar module (e. g. http://www.magentocommerce.com/magento-connect/integrations/crm/erply-connector.html) and see how it is built. Then try to develop your own.

magento geolocation redirect

Do you know any plugin that redirects only users to certain store based on the IP (geolocation)?
I have found theese two:
http://www.magentocommerce.com/magento-connect/store-and-currency-auto-switcher.html
http://www.magentocommerce.com/magento-connect/j2t-geoloc-va-automatic-store-and-currency-switch.html
but the problem is that they change also the currency and not only the store.
As an alternative does anyone know a simple coding method to do that? (I should mention that I do not have any knowledge of geolocation so I did not try any coding at all yet)
Thank you,
Mugur
Take a look at your index.php and see how it loads a website/store.
It is relatively simple to install a geoip module on both Apache and Nginx, this module will then enable you to have a $_SERVER value for country code. You can then place a simple php switch/case block in your index.php that sets the website/store values used to call Mage.php and have whatever logic in there to suit your setup.
I don't believe the module route (even if one exists) is what you need given how straightforward it is to write the switch/case for your country->store mappings. You will also need to put in there some extra option for testing purposes, e.g. if the IP address requesting the page is your PC then show whatever store it is you need to test.
Anyway, you can always chose one of Magento's free extensions.
Geo Lock or Geo IP Locations are free and restricted versions of the first extension you linked.

Have Magento respond to several domains with the same store

I would like to have my magento install respond to two different domains, e.g.
a.mydomain.com and
b.anotherdomain.com
I need magento to respond with the same store, showing the same customers, the same catalog, same prices, etc.
The difference, of course, is that when the store is accessed through a.mydomain.com all the links and urls should use this domain as baseurl, and when it is accessed through b.anotherdomain.com all links and urls should use b.anotherdomain.com as baseurl.
Is there any way to do so? All the documentation I've found so far deal with having different stores on the same magento instance, while what I need here is to have the same store respond to two different URLs.
Thank you!
Everything I know of Magento says it was designed to prevent exactly this from happening so as not to be penalised by search engines for duplicate content.
You can, however, have multiple stores that share customers and catalog and products and prices and so on, but represent a separate domain each. In System > Manage Stores add several Stores for a single website and use the same root category for them all. Then in System > Configuration > Web assign the various domains.
easy enough, just set them both to use the same store code (or just default)
have a look in index.php
you can set the $mageRunCode to be whatever you want, you don't have to use the server environment variables method they have there, look at earlier versions of Magento to see the index.php file there.
see this old article of ours
http://www.edmondscommerce.co.uk/magento/magento-multistore-setup-in-a-nutshell/

Resources