Magento: Create New Payment Method – Cash On Delivery

About: How To Create a Magento Custom Module and A “Cash On Delivery” Payment Method
Who’s Interested: Informative to the semi-technically savvy
What: Custom Magento Payment Method

So I’ve seen more and more people raising awareness about desire to create a new payment method that allows orders to be paid via “cash on delivery” or “on pickup” by customer. Is this helpful to companies who sell to local clients? Absolutely.

So in offering a solution, I’ll go ahead and outline what files need to be created and why with hopes to help educate the intigued learner in how to create a Magento Custom Module as well. The benefit in knowing how to do this is modifying existing Magento functionality in a way that it will not be overwritten upon a successful Magento upgrade.

Thus, I’ll jump in. The following 5 files will be created (relative to one’s Magento root folder):
 

  • config.xml
  • system.xml
  • PaymentMethod.php
  • mysql4-install-0.1.0.php
  • NewModule.xml

Here are their contents (with comments) and relative paths:

app/code/local/Mage/NewModule/etc/config.xml (below)

<?xml version="1.0"?>
<!--
/**
* Elias Interactive
*
* @title	  Magento -> Custom Payment Module for Cash On Delivery
* @category   Mage
* @package    Mage_Local
* @author	  Lee Taylor / Elias Interactive -> lee [at] eliasinteractive [dot] com
* @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*/

-->

<config>
<global>
<!-- declare model group for new module -->
<models>
<!-- model group alias to be used in Mage::getModel('newmodule/...') -->
<newmodule>
<!-- base class name for the model group -->
<class>Mage_NewModule_Model</class>
</newmodule>
</models>

<!-- declare resource setup for new module -->
<resources>
<!-- resource identifier -->
<newmodule_setup>
<!-- specify that this resource is a setup resource and used for upgrades -->
<setup>
<!-- which module to look for install/upgrade files in -->
<module>Mage_NewModule</module>
</setup>
<!-- specify database connection for this resource -->
<connection>
<!-- do not create new connection, use predefined core setup connection -->
<use>core_setup</use>
</connection>
</newmodule_setup>
<newmodule_write>
<use>core_write</use>
</newmodule_write>
<newmodule_read>
<use>core_read</use>
</newmodule_read>
</resources>
</global>

<!-- declare default configuration values for this module -->
<default>
<!-- 'payment' configuration section (tab) -->
<payment>
<!-- 'newmodule' configuration group (fieldset) -->
<newmodule>
<!-- by default this payment method is inactive -->
<active>1</active>
<!-- model to handle logic for this payment method -->
<model>newmodule/paymentMethod</model>
<!-- order status for new orders paid by this payment method -->
<order_status>1</order_status>
<!-- default title for payment checkout page and order view page -->
<title>Cash On Delivery</title>
</newmodule>
</payment>
</default>
</config>

app/code/local/Mage/NewModule/etc/system.xml (below)

<?xml version="1.0"?>
<!--
/**
* Elias Interactive
*
* @title	  Magento -> Custom Payment Module for Cash On Delivery
* @category   Mage
* @package    Mage_Local
* @author	  Lee Taylor / Elias Interactive -> lee [at] eliasinteractive [dot] com
* @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*/

-->

<config>
<sections>
<!-- payment tab -->
<payment>
<groups>
<!-- newmodule fieldset -->
<newmodule translate="label" module="paygate">
<!-- will have title 'Cash On Delivery' -->
<label>Cash On Delivery</label>
<!-- position between other payment methods -->
<sort_order>670</sort_order>
<!-- do not show this configuration options in store scope -->
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<fields>
<!-- is this payment method active for the website? -->
<active translate="label">
<!-- label for the field -->
<label>Enabled</label>
<!-- input type for configuration value -->
<frontend_type>select</frontend_type>
<!-- model to take the option values from -->
<source_model>adminhtml/system_config_source_yesno</source_model>
<!-- field position -->
<sort_order>1</sort_order>
<!-- do not show this field in store scope -->
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</active>
<order_status translate="label">
<label>New order status</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status</source_model>
<!--<source_model>adminhtml/system_config_source_order_status_new</source_model>-->
<!--<source_model>adminhtml/system_config_source_order_status_processing</source_model>-->
<sort_order>4</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</order_status>
<allowspecific translate="label">
<label>Payment from applicable countries</label>
<frontend_type>allowspecific</frontend_type>
<sort_order>50</sort_order>
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</allowspecific>
<specificcountry translate="label">
<label>Payment from Specific countries</label>
<frontend_type>multiselect</frontend_type>
<sort_order>51</sort_order>
<source_model>adminhtml/system_config_source_country</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</specificcountry>

<title translate="label">
<label>Title</label>
<frontend_type>text</frontend_type>
<sort_order>2</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</title>
</fields>
</newmodule>
</groups>
</payment>
</sections>
</config>

app/code/local/Mage/NewModule/Model/PaymentMethod.php (below)

<?php
/**
* Elias Interactive
*
* @title	  Magento -> Custom Payment Module for Cash On Delivery
* @category   Mage
* @package    Mage_Local
* @author	  Lee Taylor / Elias Interactive -> lee [at] eliasinteractive [dot] com
* @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*/

class Mage_NewModule_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract
{
protected $_code  = 'newmodule';
//protected $_formBlockType = 'payment/form_checkmo';
//protected $_infoBlockType = 'payment/info_cod';

/**
* Assign data to info model instance
*
* @param   mixed $data
* @return  Mage_Payment_Model_Method_Checkmo
*/
public function assignData($data)
{
$details = array();
if ($this->getPayableTo()) {
$details['payable_to'] = $this->getPayableTo();
}
if ($this->getMailingAddress()) {
$details['mailing_address'] = $this->getMailingAddress();
}
if (!empty($details)) {
$this->getInfoInstance()->setAdditionalData(serialize($details));
}
return $this;
}

public function getPayableTo()
{
return $this->getConfigData('payable_to');
}

public function getMailingAddress()
{
return $this->getConfigData('mailing_address');
}

}

app/code/local/Mage/NewModule/sql/newmodule_setup/mysql4-install-0.1.0.php (below)

<?php
// here are the table creation/updates for this module

app/etc/modules/NewModule.xml (below)

<?xml version="1.0"?>
<!--
/**
* Elias Interactive
*
* @title	  Magento -> Custom Payment Module for Cash On Delivery
* @category   Mage
* @package    Mage_Local
* @author	  Lee Taylor / Elias Interactive -> lee [at] eliasinteractive [dot] com
* @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*/
-->
<config>
<modules>
<!-- declare Mage_NewModule module -->
<mage_NewModule>
<!-- this is an active module -->
<active>true</active>
<!-- this module will be located in app/code/local code pool -->
<codePool>local</codePool>
<!-- specify dependencies for correct module loading order -->
<depends>
<mage_Payment />
</depends>
<!-- declare module's version information for database updates -->
<version>0.1.0</version>
</mage_NewModule>
</modules>
</config>

Again, this serves as a basic configuration for a new payment method that allows Cash On Delivery and is written as a Magento Custom Module. Modifying these files may be necessary, though this should be a good outline to get you started. Any help needed, post here and we’ll get some dialogue going to find solutions for your needs.

Or simply download the files here:

Elias: Cash On Delivery (Magento Payment Method)

 

 

Comments

  1. timothyleetaylor says

    Branko,

    We’ve been excited about Magento for some time now. We’ve also had a chance to dialogue with you some and gain a better appreciation for your involvement in the Magento community.

    Let us both keep up making progress with Magento on behalf of the community!

    Thanks for the encouragement.

    Hope to connect again soon,
    Lee

  2. timothyleetaylor says

    Thanks Tomislav,

    Great to hear from you, and I do hope this tutorial is beneficial in your endeavor to write a custom payment module.

    I was wondering, would you suggest any other topics about Magento that you’d like to hear or know more about?

    Let’s get a list rolling and begin writing on the most valuable topics the Magento community can benefit from.

    Thanks for your input,
    Lee Taylor

  3. says

    Hehe. It was a coincidence that I found your article on Google, especially because Branko made the 1st comment. Two of us work at the same office in one small town in Osijek, Croatia and both of us came your way via separate paths :)

  4. timothyleetaylor says

    That coincidence is fun to hear about :)

    In that case since you’re working alongside Branko,I recognize much-needed topics that will benefit the Magento community have already been approached in an ongoing manner here: http://activecodeline.com/

    We’re excited for your community involvement, and are glad for the opportunity to contribute as well.

    Feel free to jot down thoughts on topics you’d like to hear about as they come to mind. Nonetheless, we’ll keep on blogging about the design, development, and marketing of Magento!

    Lee

  5. says

    hi timothy,
    As Tomislav has no suggestion I have one, if I may :)
    I’ve learned php with osc: I realize then now that I’m programing in a XXth century way. I’ve discovered Magento and love it and see this an oportunity for me for learning he XXIth century way of programing.

    I’m studying now all I can find about OOP and Zend framework: that isn’t easy but surely worth it.
    Here comes my request: where to start in order to discover Magento’s code? Is there some logic I should keep in mind when I need to find some piece of code I want to see/change?
    You know, a tutorial about Magento’s code for beginers.

    Thanks in advance. Cheers.
    david

  6. says

    Hi there “osdave”… In my modest opinion, Zend Framework is the way to go, especialy if you are interested in Magento. I too am on the path of learning and hopefully mastering Zend.

    There are people who will say Zend is fat as framework, use CodeIgniter, or PHPCake or Symphony or… Whatever the case may be, Zend is recognized as Enterprise ready, it comes with full certification program, it’s documentation is great and so on… in short; you can’t go wrong if you choose to go with Zend.

  7. timothyleetaylor says

    Hi @osdave and Branko,

    So great to have you both interacting here. I’m just catching onto the dialogue, and think Branko’s got a great perspective on jumping into Magento by initially learning the Zend framework.

    I recognize a couple ways of going about Magento customization. For theme customizations, one can often l learn by comparing the code with the frontend of the theme (via Magento theme notes AND Firefox Firebug tool). In this manner, learning theme customization techniques can be self-learned automatically by adjusting the visual part of the Magento theme.

    But I think you’re referring to Magento core code customization more specifically. And with our combined experience, we agree that learning the Zend Framework (which has made available some great tutorials and videos) is key.

    As you get familiar more with Object Oriented Programming, I believe you’re going to see GREAT value in utilizing the concepts it has to offer. Here’s a link that might get you started actually: http://devzone.zend.com/node/view/id/627

    As I understand it, Magento is written with the intention of not just utilizing the basic OOP concepts, but enhancing code re-usability and efficiency with the Zend Framework.

    They’re still making changes, as we’re all growing alongside them. Let’s keep the dialogue up, and post all kinds of thoughts/questions here and there so we can help each other out.

    All the best,
    Lee

  8. says

    hi Lee, thanks for answering.
    The link to the devzone seems very interesting for me right now, as I’m revising the base of PHP. I’ll focus on parts 7 and 11 (OOP and XML) as these are both concept I am less confident with and very important for Magento (and I guess for good PHP programing).
    So, thanks again for your time and I’ll check your future posts, keep up the good work :)
    cheers, dave

  9. says

    Hi,
    Thanks a lot for your work, but unfortunately the payment option doesn’s show up in frontend. It does in Admin->Configuration->Payment methods and I have enabled it. Also, I have refresed cache. Any idea what I did wrong? Thanks in advance!

  10. timothyleetaylor says

    Hi @Tonitobleroni,

    Thanks for your inquiry. Can I ask what version of Magento you are using? Also, you can try to manually refresh the cache by removing all contents from the following path: var/cache/

    Try that and mention what version of Magento you are using. Make sure the payment option is enabled, and we’ll see what we can troubleshoot from there.

    Thanks,
    Lee

  11. timothyleetaylor says

    @osdave,

    That sounds like a great plan for getting started. Also, once you do get an idea for the architecture of Magento (and better seeing at a high-level how everything fits together), you can attempt to go through this payment module piece by piece to see why the code is there and how it interacts with the other files inside the module.

    If you have any questions, post them here. Understanding the module may not seem as overwhelming, and it also plugs right into the Magento code with OOP concenpts (like overriding controllers with OOP practices in mind). Thanks, and all the best with your learning – as I’m doing it right with you every day =) It never stops!

    – Lee

  12. says

    Hello Lee,
    Thanks a lot for your response. I manually removed all content from the cache folder. I am using 1.1.6. I have enabled the payment option in Admin.
    Thanks in advance!

  13. timothyleetaylor says

    Hey @Tonitobleroni,

    Please visit this post and read up about some solutions others have found when dealing with this type of issue: http://www.magentocommerce.com/boards/viewthread/832/P45/#t10489

    Unfortunately, without being able to look into the code you have (as various setup options can be prohibiting this from showing up on the frontend), it is hard for me to troubleshoot. Also, some questions I might cover with you are already located within the forum post mentioned.

    Lastly, if you don’t find any solution there, you may try a quick install of another Magento store and see if the module works from the fresh install.

    I haven’t had time to go in and verify that the code be relevant for Magento version 1.1.6 yet, though I haven’t seen anyone else having a problem with this – so it’s not likely there is any upgrade issues involved.

    Thanks,
    Lee

  14. says

    Hi,

    Could you suggest me how to configure the this module in own magento application. when i putted the all files in my local system this is not overriding the default shipping method of magento.

  15. timothyleetaylor says

    Hi @sirvash,

    I’d love to recommend how to configure this module in your own Magento application, though with all the possibilities, it would probably turn into a small project rather than a couple discussions.

    In reference to the issue you mentioned, make sure you haven’t changed the name of the default shipping method of Magento. Also, I’d recommend going back and make double-checking that the files were copied into the correct folders (reference the paths in the download we have available).

    Please contact us via our contact form below if you’d like help on a project, and we’d be glad to assist you.

    Thanks!
    Lee

  16. says

    Hi @Lee,

    Special Thanks for quick solutions i am trying to update the title of ‘Cash on Delivery’ and updated the system.xml and config.xml but modification not visible on front.

    Please assist me.
    module working fine now can i update the shipping method i just wanna to save and extra value instead of the ‘Flat Tax’ on sales order table.

    Thanks
    Sirvash Sharma

  17. says

    Hi Folks,

    I see that this thread is for COD but I’m also attempting to create a Magento payment module for USAePay payment module using the Magento create payment gateway instructions.

    I am having a parser error issue with the
    app/code/local/Mage/Usaepay/Model/PaymentMethod.php file and I wonder if you could help me fix it. If yes, could I send you the php code for this file? Here is the error:

    Warning: simplexml_load_string() [function.simplexml-load-string]: Entity:
    line 133: parser error : Opening and ending tag mismatch: usaepayach line 107 and payeach in
    /home/the/domains/silverborn.com/public_html/lib/Varien/Simplexml/Config.php
    on line 500

    Thank you,
    Leslie

  18. says

    hi!
    i just want to know how can i know which file is showing the current page content of magento so that if i want to modify it then i can do it….
    And yes dear m just a beginner…

  19. says

    Hi Lee,

    I’m using magento-1.1.8. I’ve followed your steps creating 5 files in appropriate directories. But unfortunately in Admin->Configuration->Payment methods, I can’t see any update. I have refreshed cache but no results. Can you say please where I’m doing wrong ?
    Thanks in advance.

  20. timothyleetaylor says

    Hi All,

    As I see, there’s been a bit of activity that I haven’t had time to get to. My apologies here. I haven’t needed to update this for Magento’s new 1.2 version, so I haven’t tested it against the upgrades Magento has made. Unfortunately, I haven’t had time to update it – though I assume there’s some adjusting to the “system.xml” file regarding displaying correctly within the Admin->Payment Methods.

    I’ll post again when time opens up. Until then, keep testing and post your successful findings on the blog here!

    Thanks for all community contributions,
    Lee

  21. says

    Hi, I just tried your post, but it’s not shown in configuration->payment methods tab but in configuration->advanced tab. My magento version is 1.2.1.
    Can u show me the solution.
    Thanks in advance.

  22. says

    Hi,
    Thanks for this tutorial. However, when I do an order from within admin, the COD payment method is not available, even tho’ I’ve enabled in Configuration.

    I’m running ver 1.2.0.3. Any suggestions?

    Thanks,
    Eddie

  23. says

    Hola,

    Thank you very much for this tutorial! It works fantastic! Just a little question: The new payment is the first one in the frontend now. How can I change the sort order? Thanks! ela :)

  24. says

    hi timothyleetaylor,

    I am New to this both Magento and Zend Framework. I Just tried ur Steps to create a payment module. Unfortunately i cant able to succeed in it. its throwing me a warning…

    Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : XML declaration allowed only at the start of the document in E:\magento\lib\Varien\Simplexml\Config.php on line 500

    can u please tell me wr i did a mistake and how to resolve this.

    Thanks & Regards,
    Sabarish V

  25. Lee Taylor says

    Hey there @Sabarish,

    That error tends to be a result of something going wrong within your config.xml or system.xml file inside the module directory. Be sure to check unnecessary whitespace and invalid characters (which happens sometimes if copying and pasting).

    Hope you find a solution that results from digging around those two files.

    Cheers!
    Lee

  26. says

    HiYounus,

    Thanks for the Input Its works fine for me. Sorry for the late response Bcoz i was struck with other works. Again i need another input from u all guys. How to integrate the new Module with the Existing Modules. Do u have any reference link kindly let me know

    Thanks & Regards,
    Sabarish

  27. says

    thanks for this tutorial, i need a little guidance.

    I need to create a magento module that sends variables to a payment gateway page.

    Can you please guide me in this regard?

  28. says

    Hy

    I create a field

    In

    class Cerebrum_Visa_Block_Standard_Form extends Mage_Payment_Block_Form

    Ok, appear in Font-End in E-commerce

    ————
    But

    How to get the variable “visa_type” content, to Show in the E-commerce

  29. says

    What I mean is, say I have a list of user accounts maintained through the admin panel. What then if I create a group called “vips” and then only when they are logged in they can see the payment option “Cash on Delivery”.

    We would not want to deliver a heavy valuable package to someone whom we did not trust to give them the COD treatment!

  30. says

    Hi, all

    I have created new payment module. it display on admin panel as well as on frontend. now i want that when user click on place order user will redirect to new window like any iframe and in that user will enter all the details and continue….

    pls anyone help me how to do this….. pls..pls…

    thanks,

  31. says

    This is somewhat off topic, but I haven’t been able to get any help at the Magento forums.

    Sounds like you know what you’re doing, maybe you know the deal with this?

    Thanks in advance!

    Here’s my issue:

    – I added a new module using ModuleCreator.

    – Was able to activate it via Configuration -> Advanced.

    – The new module MENU tab shows up in the Admin section, but when I click on the button, it takes me to a blank page.

    – I’m using “default” theme for the backend, and a custom theme for the frontend. However, this new button takes me to a blank page styled using my custom theme.

    So my question is—where can I see this custom module admin page? Is it a php, xml or phtml file?

    I want to add content to it, and if possible, change it to “default” theme like the rest of the admin section.

  32. says

    how can i add one new form before registration page on front-end for magento ?

    when customer can click on registration first of all open new form where customer can enter city name and that city will be in system then register form will appear otherwise display sorry msg.

    pls help me

    http://mushirkureshi.blogspot.com

  33. says

    Thanks for this great tutorial! How can i set up the script to send notification mail which informs customer after “cash on delivery” order. Briefly, i need custom mail template and the required mail script for cash on delivery. I also want to be in bcc as an admin.
    Any help will be appreciated

  34. says

    Heya guys,
    first I must say I really appreciate your effort in serving Magento community! That goes for Croatian team as well!

    I am also interested in knowing whether this module works in 1.3.x. I am gonna try it anyway and let you know the results.

    However, I am still kinda confused about Magento updates. The thing is I am modifying the system quite a bit plus thinking of using lots of extensions. I mean, I am aware the system needs to stay safe, however, the possibility of having to modify code after every update makes me, well, not happy.
    Anyway, I know this is a different topic, it just bothers me extensively.

  35. says

    Hi jazkat,
    If you use your own modules to modify Mage behaviour/functionality, then you have less to worry about when upgrading. However, if you modify core code, then this is a problem when upgrading – you’ll have to use a diff tool to compare the new code against your modified version and then merge the 2 if you can.
    So if possible, figure out how to create your own module to do modifications – often ‘all’ you have to do is copy the file you want to modify into app/code/local/yourfolder and then publish it as a module, having informed Mage to use your module rather than the default.
    Best wishes,
    Eddie

  36. says

    Hi Eddie,
    thanks a lot, this makes sense. I was actually going to create my own modules and not change core files, so that means I was on the right path not to complicate my life :-)
    You put my mind at ease :-)

  37. Lee Taylor says

    Hi All,

    Glad all is well and things are getting sorted. Thanks for helping out everyone. We have been busy working on a few internal projects that we’ll look forward to presenting to the Magento community soon.

    Keep up the progress!

    Cheers!
    Lee

  38. Lee Taylor says

    Hi @Abdul,

    From the link you gave us, it looks like this kind of functionality is more related to a “product configurator” rather than an actual payment gateway. The payment gateway would need to happen once the products are added to the cart and the user is sent to the checkout process.

    All the best in finding the right solution!

    Cheers,
    Lee

  39. says

    hi! i configured the module and works fine, but i would like that my country selection for the cash on delivery availability, refers to shipping country, not the billing one. someone can help me? thanks in advance

  40. says

    Hi Men!

    I want to create a payment module which can communicate to a web service. I have problems displaying lists of coins recovered dynamically. Any idea?

    When ending the develop I publish… excuse me my english. 😛

    Regards Friends!

  41. says

    Dear Timothy,

    First of all thanks a lot for the module. I have installed it on Magento 1.3.1 and it work great. We have added an additional fee as COD charges and it works great on front end. However, the problem comes when I have to modify an existing order or create a new order. It simply does not count the additional charges and the total of the order is having only the shipping charges added. Can anyone who has faced the similar issue, guide me how to solve this issue?

    Regards.

  42. says

    I think your post does a better job explaining how to create a payment module for magento that the wiki page they have on the magento community site. Good job!

  43. says

    Totally agree with Ron above. The Magento wiki is complete crap by comparison.

    One question I have which is confusing the hell out of me, is about the PaymentMethod.php file.

    How does this file get referenced by the payment method?

    The only reference I can find to it is in the config.xml file which says:

    newmodule/paymentMethod

    there is a folder called

    app\code\local\Mage\NewModule\Model

    and inside of that there is PaymentMethod.php

    is this the same file that is referenced in config.xml ??

  44. says

    Hello,
    This is nice tutorial but can you please provide me any help on how to create credit card accepting payment module for magento.
    I followed some url’s but they all are very basic and not even with any information like how to pass hidden values from client side while checkout..How to change fields name etc…
    Please help me asap…

  45. says

    Hi, thanks for this. I’ve implemented it on v 1.2.1.2 and it works great! :-) I’ve also added a new “message” field to this module (“Please call xxxxxxx to arrange delivery time”). It shows up in admin but doesn’t show the message when I choose this payment method on checkout. Anyone can help me with this?

    Much appreciated,

    Rianti

  46. says

    Great work dear
    can any one guide me about ?
    how can i add the realted data base tables?
    or how many tables are required for this module ?

    please anser me as soon as posible ………..!

  47. says

    Hello All,

    I’m new to Magento .. and i want to develop a module
    “Vendor rating system like that of ebay”.. In Magento .. can any when suggest me where to start from .. As i had no idea regarding this .

    Any help will be great ..

    Thanks a lot in advance.

  48. says

    Hi

    I downloaded the module its working fine in magento with single admin site. When i use the module with multiple websites , am getting an error message in the backend . But the module is working fine in the frontend.Update me and let me know the what the issue is and how can i resolve this issue.

  49. says

    Hello, I am new on this. I created a module using your tutorial but after creating the module I couldn’t enter to my admin panel..it shows following error.

    Module “mage_PaymentModule” requires module “mage_Payment”

    Help is highly appreciated! Thanks!

  50. says

    I’m trying to create multiple modules using the same template but I notice the subsequesnt ones are not showing. It’s enabled and I get no errors. Is it a sort number value issue?

  51. says

    let me rephrase my question. If I need to create multiple new methods, which variable will I need to change? I changed the NewModule variable but I can only get one method to show up in the backend. The other new method shows it’s enabled in Advanced but I dont’ see it on the Payment Methods.

  52. says

    Although I am writing a custom payment module for Magento (what a learning curve!) which is a bit more complicated stuff, I would appreciate some advice. After creating the module I can setup my custom setting of the created payment method in the Payment Methods Magento admin section, but when I enable the payment method and go to the checkout, the Payment Information doesn’t contain the option for my enabled payment option. I have disabled the cache while debugging, so it can’t be the fault. cheers

  53. says

    Hello Lee,

    Many thanks for this contibution.
    I have managed to add a new payment method based on your tutorial and I am very happy with it.
    The only problem I have with any new payement modules I write from scratch is that they will cause an error in the admin panel when you attempt to check an order/change the status of an order that was placed using this payement.
    So In the admin section , if I go to sales/orders and try to edit the last order made with the newpayement I get this error:

    Warning: include(/home1/……/app/design/adminhtml/default/default/template/POD1/info.phtml) [function.include]: failed to open stream: No such file or directory in /home1/… …//app/code/core/Mage/Core/Block/Template.php on line 144

    Any idea how I can resolve that little bugger ? Is the module missing some template files in the adminhtml ?

    Thanks

    Charles G

  54. says

    Hi,

    Everyone, I’m new here and in Magento. Can you give me an idea how to integrate or create new payment module mehod PesoPay. Like what I said, I’m new in Magento and I really can’t caught an idea where and how to start creating this module. Thank you very much for the help.

  55. says

    Hi,

    I just want to ask that how and where is the module of paypal payment method where it send the buyers information and total amount of the customer’s bought product. Please help me with this. Thank you in advance.

  56. says

    Hi,

    Guys, I having a problem when I clicked “Checkout: in my magento.

    Fatal error: Call to a member function setStore() on a non-object in C:\xampp\htdocs\magento\app\code\core\Mage\Payment\Helper\Data.php on line 72

    anyone can help? Thank you

  57. says

    I need to integrate a new payment module called ‘MegaPos’ . Dont know how to move. any help would be highly appreciated.

  58. says

    my modudle going error, here show:
    Module “mage_NewModule” requires module “mage_Payment”
    Trace:
    #0 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\code\core\Mage\Core\Model\Config.php(680): Mage::throwException(‘Module “mage_Ne…’)
    #1 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\code\core\Mage\Core\Model\Config.php(645): Mage_Core_Model_Config->_sortModuleDepends(Array)
    #2 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\code\core\Mage\Core\Model\Config.php(233): Mage_Core_Model_Config->_loadDeclaredModules()
    #3 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\code\core\Mage\Core\Model\App.php(263): Mage_Core_Model_Config->init(Array)
    #4 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\Mage.php(434): Mage_Core_Model_App->init(”, ‘store’, Array)
    #5 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\Mage.php(455): Mage::app(”, ‘store’, Array)
    #6 D:\Program Files\Zend\Apache2\htdocs\magento1324\index.php(65): Mage::run()
    #7 {main}

  59. Vasashiner says

    Module “mage_NewModule” requires module “mage_Payment”
    Trace:
    #0 E:xampphtdocsvasa_magentoappcodecoreMageCoreModelConfig.php(680): Mage::throwException(‘Module “mage_Ne…’)
    #1 E:xampphtdocsvasa_magentoappcodecoreMageCoreModelConfig.php(645): Mage_Core_Model_Config->_sortModuleDepends(Array)
    #2 E:xampphtdocsvasa_magentoappcodecoreMageCoreModelConfig.php(233): Mage_Core_Model_Config->_loadDeclaredModules()
    #3 E:xampphtdocsvasa_magentoappcodecoreMageCoreModelApp.php(263): Mage_Core_Model_Config->init(Array)
    #4 E:xampphtdocsvasa_magentoappMage.php(434): Mage_Core_Model_App->init(”, ‘store’, Array)
    #5 E:xampphtdocsvasa_magentoappMage.php(455): Mage::app(”, ‘store’, Array)
    #6 E:xampphtdocsvasa_magentoindex.php(65): Mage::run()
    #7 {main}

  60. Vsven says

    Hi Guys,

    This works PERFECT!! Just one thing, you have to change the title of “NewModule.xml” to “Mage_NewModule” otherwise it doesn’t work 😉

    cheers
    vsven

  61. Mage_New says

    Hi there.. nice module. But i’m unable to get these to show up on my multilingual site.. I can only see this in the payment methods when Current Configuration scope to Default Config or Main website. When I switch to the rest of the 3 languages, I can’t see any.

    Any help?

    Using magento 1.1.4 and modern theme.

  62. Phumlani Nyati says

    I am new to this but I have disabled the cash on delivery module on my admin dashboard but it still appears on my site, how can I solve this problem? please help!!!

  63. Bharat Paghadal says

    woww, great work.

    but i want to implement this module with paymentgateway,
    so how can i implement???

  64. Zekia says

    This is a very helpful post but could you also explain which tags and file-names should be changed in order to create a second new payment method?

  65. Daisy says

    I have to place the order details to the Warehouse server using the Web-service functions, when ever a new order is placed. I want to write a module to call web-service functions. Please suggest the solution.

  66. Vahan403 says

    Hi I am new in magento and will be appreciate if you will help me.
    My question is which method executes when checkout button is pressed? 
    I am trying develop new online payment module and need redirect user to the payment gateway site when checkout is made

  67. Denisa says

    Thanks for posting! I have a question: did you create a cash in advance module? It should be something similar with this, isn’t it?
    Thanks

  68. Russel adword says

    eCommerce businesses work hard to win the attention of shoppers and bring them to their websites. At the same time, they have invested substantial budget and effort to present the most compelling shopping experience possible. From Web2.0 and social media features to engaging video ads and product configurations, each eCommerce business strives to stand out from the competition to boost sales and maintain consumer loyalty.

    http://www.cloudways.com/en/magento-managed-cloud-hosting.php

  69. magentony says

    My only discrepancy is that the COD option will be available for downloadable and virtual products, which is not logical since there is no address to deliver a virtual product to. Can you specify COD based on product type?

  70. Muhammad Ahsan Horani says

    Thank you for the article. I am having problem while following above article. My Custom payment method is not being displayed on the front end. Any suggestions ? I have done everything same as above

  71. Pankaj says

    Hi ,

    Thanks for nice article ,i have doubt that you have mention app/code/local/Mage/NewModule/etc/config.xml but when i check magento there is no such file, can you tell me whatever allcode you have mention we need to create new page into particular directory or wat else.

    2.the download link is not working , kindly check and give correct link

    Thanks

    • says

      Pankaj, the download link has been fixed. Thanks for letting me know. Please keep in mind this customization was written for an older version of Magento. YMMV.

Trackbacks

Leave a Reply

Your email address will not be published. Required fields are marked *