Magento Forum

Page 18 of 19
Payment method - new module tutorial
 
shilpimogha
Jr. Member
 
Total Posts:  2
Joined:  2008-08-09
 

I have installed a payment according to your instructions , but getting errors while checkout(frontend)

Warning: include(Mage\Payment\Model\Abstract.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\magento\lib\Varien\Autoload.php on line 93

Please help

 
Magento Community Magento Community
Magento Community
Magento Community
 
gangadhar
Jr. Member
 
Total Posts:  23
Joined:  2009-07-30
 

Have any one worked Securenet payment gateway.

 
Magento Community Magento Community
Magento Community
Magento Community
 
afzal ansari
Jr. Member
 
Total Posts:  1
Joined:  2010-12-24
 

Thanks body.

Hey i need to integrate billfirst payment.
can you please help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
diazwatson
Member
 
Avatar
Total Posts:  35
Joined:  2010-04-23
Spain
 

Hi everyone,

Like some other members I’m trying to create a custom payment module and after followed the wiki I get the module shown in the back-end “Payment methods” as-well “Configuration -> advanced -> advanced” But, when I go to the front end it does not show.

I am working with 1.4.2.0 Version
I have the cache disabled
and deleted all files in var/cache, several times. But nothing makes this payment method shows in the front end

Any idea what I am missing?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
fuseltd
Jr. Member
 
Total Posts:  7
Joined:  2011-03-14
 

I’ve followed the instructions here - http://www.magentocommerce.com/wiki/how-to/create-payment-method-module - to the letter as far as Database Updates. My new payment module appears in admin and I can enable it. But, the method is not appearing in the front end during checkout. Can someone please advise? I’m running version 1.5.1.0.
Many thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
BinaryBird
Jr. Member
 
Total Posts:  27
Joined:  2011-05-17
 

@ fuseltd , the wiki only helps to create a backend for base payment module. I am trying to create a payment module too. From what i noticed, we need have some .phtml files for the frontend, (app\design\frontend\default\default\template and layout) to display the option during check out. This is defined in the config.xml but i am not sure of the structure of the front end.

Could some one please explain the relation and how to add some custom fields to be displayed in the frontend? Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BinaryBird
Jr. Member
 
Total Posts:  27
Joined:  2011-05-17
 

I have been trying to get this working after reading many articles and blogs. Could some one please tell me what am i doing wrong?

1) Created the Foostor_Direcpay.xml file in app/etc/modules

<?xml version="1.0"?>
<config>
<
modules>
<
Foostor_Direcpay>
<
active>true</active>
<
codePool>local</codePool>
<
depends>
<
Mage_Payment />
</
depends>
<
version>0.1.0</version>
</
Foostor_Direcpay>
</
modules>
</
config>

2) Created the config.xml file in app/code/local/Foostor/Direcpay/etc

<?xml version="1.0"?>
<config>
<
modules>
<
Foostor_Direcpay>
<
version>0.1.0</version>
</
Foostor_Direcpay>
</
modules>
<global>
<
models>
<
direcpay>
<class>
MagentoBook_PaymentModule_Model</class>
</
direcpay>
</
models>
<
resources>
<
direcpay_setup>
<
setup>
<
module>Foostor_Direcpay</module>
</
setup>
<
connection>
<use>
core_setup</use>
</
connection>
</
direcpay_setup>
<
direcpay_write>
<
connection>
<use>
core_write</use>
</
connection>
</
direcpay_write>
<
direcpay_read>
<
connection>
<use>
core_read</use>
</
connection>
</
direcpay_read>
</
resources>
</global>
<default>
<
payment>
<
direcpay>
<
active>1</active>
<
model>direcpay/payment</model>
<
order_status>1</order_status>
<
title>Credit Card (Magento Book Payment Module)</title>
<
cctypes>AE,VI,MC,DI</cctypes>
<
payment_action>authorize</payment_action>
</
direcpay>
</
payment>
</default>
</
config>

3) created system.xml in app/code/local/Foostor/Direcpay/etc

<?xml version="1.0"?>
<config>
<
sections>
<
payment>
<
groups>
<
direcpay translate="label" module="paygate">
<
label>Direcpay</label>
<
sort_order>670</sort_order>
<
show_in_default>1</show_in_default>
<
show_in_website>1</show_in_website>
<
show_in_store>0</show_in_store>
<
fields>
<
active translate="label">
<
label>Enabled</label>
<
frontend_type>select</frontend_type>
<
source_model>adminhtml/system_config_source_yesno</source_model>
<
sort_order>1</sort_order>
<
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_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>
<
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>
<
cgi_url>
<
label>Gateway URL</label>
<
frontend_type>text</frontend_type>
<
sort_order>5</sort_order>
<
show_in_default>1</show_in_default>
<
show_in_website>1</show_in_website>
<
show_in_store>0</show_in_store>
</
cgi_url>
</
fields>
</
direcpay>
</
groups>
</
payment>
</
sections>
</
config>

At this point, i can see the module under system->configuration->Advanced in the admin panel and in payment methods, where chose enable and saved the config.

4) created Payment.php in app/code/local/Foostor/Direcpay/Model

<?php
class Foostor_Direcpay_Model_Payment extends Mage_Payment_Model_Method_Abstract
{
protected $_code 'direcpay';
protected 
$_formBlockType 'direcpay/dispfields';

}
?>

5) created Dispfields.php in app/code/local/Foostor/Direcpay/Block

<?php

class Foostor_Direcpay_Block_Dispfields extends Mage_Payment_Block_Form
{

    
protected function _construct()
    
{
        $this
->setTemplate('direcpay/form.phtml');
        
parent::_construct();
    
}

}

6) created form.phtml in app\design\frontend\default\default\template\direcpay

<?php $_code=$this->getMethodCode() ?>
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
    <
li><?php echo $this->__('You will be redirected to the Google Checkout website when you place an order.'?></li>
</
ul>

I cleared the cache, reindexed cleared by browser cache and cookies and still i dont see the payment option during check out. I enabled authorize.net too, even that does not show up. Some one please help me and point out my mistake. Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

@BinaryBird

You have declared your model in config.xml as

<models>
    <
direcpay>
               <class>
MagentoBook_PaymentModule_Model</class>
    </
direcpay>
</
models>

but you declared your class as

class Foostor_Direcpay_Model_Payment extends Mage_Payment_Model_Method_Abstract

Try

<models>
    <
direcpay>
               <class>
Foostor_Direcpay_Model</class>
    </
direcpay>
</
models>
 
Magento Community Magento Community
Magento Community
Magento Community
 
BinaryBird
Jr. Member
 
Total Posts:  27
Joined:  2011-05-17
 

Thanks for pointing out the wrong class name. I made the change as suggested. Cleared the cache and when i logged in as a user and clicked on the checkout page, i get this error :

( ! ) Fatal errorCall to a member function setMethod() on a non-object in C:\wamp\www\magento\app\code\core\Mage\Payment\Helper\Data.php on line 106
Call Stack
#    Time    Memory    Function    Location
1    0.0007    378656    {main}( )    ..\index.php:0
2    0.0070    743560    Mage
::run( )    ..\index.php:80
3    0.0251    1906640    Mage_Core_Model_App
->run( )    ..\Mage.php:627
4    0.1143    7758360    Mage_Core_Controller_Varien_Front
->dispatch( )    ..\App.php:340
5    0.1201    8127496    Mage_Core_Controller_Varien_Router_Standard
->match( )    ..\Front.php:176
6    0.2234    8727184    Mage_Core_Controller_Varien_Action
->dispatch( )    ..\Standard.php:253
7    0.4836    14604936    Mage_Checkout_OnepageController
->indexAction( )    ..\Action.php:420
8    0.6657    22423224    Mage_Core_Controller_Varien_Action
->loadLayout( )    ..\OnepageController.php:172
9    0.6983    22490144    Mage_Core_Controller_Varien_Action
->generateLayoutBlocks( )    ..\Action.php:270
10    0.6985    22490632    Mage_Core_Model_Layout
->generateBlocks( )    ..\Action.php:345
11    0.7925    27665608    Mage_Core_Model_Layout
->generateBlocks( )    ..\Layout.php:209
12    0.8152    27717928    Mage_Core_Model_Layout
->generateBlocks( )    ..\Layout.php:205
13    0.8365    28115968    Mage_Core_Model_Layout
->generateBlocks( )    ..\Layout.php:205
14    0.8365    28116672    Mage_Core_Model_Layout
->_generateBlock( )    ..\Layout.php:204
15    0.8365    28116896    Mage_Core_Model_Layout
->addBlock( )    ..\Layout.php:238
16    0.8365    28116896    Mage_Core_Model_Layout
->createBlock( )    ..\Layout.php:446
17    0.8478    28248016    Mage_Core_Block_Abstract
->setLayout( )    ..\Layout.php:430
18    0.8478    28248016    Mage_Payment_Block_Form_Container
->_prepareLayout( )    ..\Abstract.php:223
19    2.0251    31974896    Mage_Payment_Helper_Data
->getMethodFormBlock( )    ..\Container.php:47

I have not defined any helpers in my config.xml file. Do i need to add a helper class too?

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

@BinaryBird

Yes, you need a helper class, even if it is empty.

Also, you need to read the error and do some debugging:
In Mage_Payment_Helper_Data::getMethodFormBlock()

{
        $block 
false;
        
$blockType $method->getFormBlockType();
        if (
$this->getLayout()) {
            $block 
$this->getLayout()->createBlock($blockType);
            
$block->setMethod($method);
        
}
        
return $block;
    
}

So it is obvious that the Foostor_Direcpay_Model_Payment::getFormBlockType() returns something that doesn\’t work.
And when I look at your config, I can\’t find the declaration for your block.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BinaryBird
Jr. Member
 
Total Posts:  27
Joined:  2011-05-17
 

So my block declaration in the config.xml file would be something like this ?

<blocks>
            <
direcpay><class>Foostor_Direcpay_Block</class></direcpay>
</
blocks>

And do i need to declare my helper class in the config.xml too?

<helpers>
            <
direcpay>
                <class>
Foostor_Direcpay_Helper</class>
            </
direcpay>
        </
helpers>

and a empty helper class inside app/code/local/Foostor/Direcpay/Helper would do the trick? Thanks again for all the help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BinaryBird
Jr. Member
 
Total Posts:  27
Joined:  2011-05-17
 

Thanks, that did it. I can see my module during the checkout.

I want to send the user details and address through a post method to a url and i have to run a javascript file when the order is submitted. Any suggestions on this? Where do i need to include the external .js file?

 
Magento Community Magento Community
Magento Community
Magento Community
 
lalkotaavinash
Jr. Member
 
Total Posts:  1
Joined:  2009-04-01
 

Hi,

I am new to magento, i tried the new payment method module at present i am able to create admin configuration by using all xml files… but i am not able to see the my payment method in front end when i enable it..

please suggest me.

Advance Thanks

Regards,
Avinash

 
Magento Community Magento Community
Magento Community
Magento Community
 
felo
Jr. Member
 
Total Posts:  25
Joined:  2010-11-10
Durham, NC
 

Hi all, Im trying to create a payment module for a Magento Enterprise Edition.

I have followed all the steps on the tutorial and can see my option on the admin and edit all the information.
However when I attempt to checkout I get the following:
Warning: include(mycompany_mymodule_Model_Payment.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\projects\plaza\includes\src\Varien_Autoload.php on line 93

I have tried several different ways of creating to make Magento find the class by changing the model tag in the config file but keep getting the same error unless I use a Mage Class.
for example if I do:

<default>
        <
payment>
            <
visanet>
                <
active>0</active>

<!-- 
USING A NORMAL MAGE CLASS AVOIDS THE ERROR -->
                <
model>payment/ccsave</model>

                <
order_status>pending</order_status>
                <
title>Credit Card (Visanet)</title>
                <
cctypes>VI</cctypes>
                <
payment_action>authorize</payment_action>
                <
allowspecific>0</allowspecific>
            </
visanet>
         </
payment>
    </default>

Frustration made me try all options available, and right now I copied BinaryBird\\\’s solution EXACTLY to see if it was me making the error or if its some sort of Enterprise incompatibility or something. The thing is that even with this tested module I am getting the same error:
Warning: include(Foostor_Direcpay_Model_Payment.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\projects\plaza\includes\src\Varien_Autoload.php on line 93

Is there something I am not seeing here??

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
manish_iitg
Sr. Member
 
Total Posts:  260
Joined:  2009-05-02
 

i have written a detailed blog post here on how to add payment method in magento http://www.excellencemagentoblog.com/magento-create-custom-payment-method

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 18 of 19