Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Payment method - new module tutorial
 
Aypok
Jr. Member
 
Total Posts:  1
Joined:  2008-01-24
Merry Old England
 
Guillaume Coderre - 19 January 2008 02:37 PM

Funny thing. I’m using 0.7.14800 and I tried to install the tutorial zipped files.

<snip>

I can see the new module inside the admin panel under the “Advanced” tab, but not under “Payment Methods”. Fields were added to the db table “core_config_fields”, but not to “core_config_data”.

I have exactly the same problem, but cannot figure out how to fix it. Has anyone come up with a solution?

 
Magento Community Magento Community
Magento Community
Magento Community
 
gcoderre
Jr. Member
 
Total Posts:  12
Joined:  2007-08-31
Montreal, Quebec, Canada
 

Actually, I got around that problem by following martinkaiser’s solution.
Declaring the config fields in system.xml rather than in the sql folder did the trick. I based my system.xml file on the one used by the paypal module.

One thing i’m not able to do, though, is to display the payment method on the frontend, and adding the entry payment/methodname/module in the table core_config_data does not help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
LapinLove404
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2007-11-04
 

I checked the paypal’s systems.xml and can relates some of the fields in there with the sql .php files. But I can’t figure the complete file.

Could we ahve a look at your system.xml ?

Actually, I got around that problem by following martinkaiser’s solution.
Declaring the config fields in system.xml rather than in the sql folder did the trick. I based my system.xml file on the one used by the paypal module.

Note: I’m using 0.7.15480

 
Magento Community Magento Community
Magento Community
Magento Community
 
LapinLove404
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2007-11-04
 

Yep,

Mixing the tutorial with the info found on http://www.fragento.org/index.php?option=com_fireboard&Itemid;=4&func;=view&id;=613&catid;=8 I am able of having my module enabled now.

But when loading the checkout page, I have the following error :

Fatal error: Class 'Mage_Payment_Model_Abstract' not found in

Did Mage_Payment_Model_Abstract changed name with the latest update ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Yes it is now called Mage_Payment_Model_Method_Abstract. Please take a look at other payment methods in latest version for ideas of implementation.

 
Magento Community Magento Community
Magento Community
Magento Community
 
zburnham
Member
 
Avatar
Total Posts:  69
Joined:  2007-11-07
Westborough, MA
 

This tutorial does provide some great info… But is there a central documentation repository that I’m not finding?  Maybe it’s my lack of deep experience with XML, but how is one to figure out what tags are appropriate in what locations in these files, or how to add things like support for events and so forth?

I admit I’m not a very senior coder, but it seems like there’s a piece missing here that I could really use at this point.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Matt Kammersell
Jr. Member
 
Avatar
Total Posts:  16
Joined:  2007-09-21
Las Vegas, NV
 

Has anybody considered an ACH payment module?  I wonder how difficult that’s going to be.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

iam trying to get my own payment method shown up in backend, no chance, i tried all hints in that thread. May i post my code here. Maybe iam blind at the moment. Trying under newest version of magento.

MZPayment/etc/config.xml

<config>
    <
modules>
        <
Mage_MZPayment>
            <
version>0.1.0</version>
        </
Mage_MZPayment>
    </
modules>

    <global>
        <
models>
            <
mzpayment>
                <class>
Mage_MZPayment_Model</class>
            </
mzpayment>
        </
models>

        <
resources>
            <
mzpayment_setup>
                <
setup>
                    <
module>Mage_MZPayment</module>
                </
setup>
                <
connection>
                    <use>
core_setup</use>
                </
connection>
            </
mzpayment_setup>
        </
resources>
    </global>

    <default>
        <
payment>
            <
mzpayment>
                <
active>1</active>
                <
cctypes>AE,VI,MC,DI</cctypes>
                <
model>payment/method_hpcc</model>
                <
order_status>pending</order_status>
                <
title>MZ_Payment</title>
                <
allowspecific>0</allowspecific>
            </
mzpayment>
        </
payment>
    </default>
</
config>

MZPayment/etc/system.xml

<config>
   <
sections>
        <
payment>            
            <
groups>
                <
mzpayment translate="label">
                    <
label>MZ Payment</label>
                    <
frontend_type>text</frontend_type>
                    <
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>
                    <
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>                                        
                        <
model>
                        </
model>
                    </
fields>
                </
mzpayment>                
            </
groups>
        </
payment>
    </
sections>
</
config>
 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

MZPayment/Model/HPCc.php

<?php 
/** Our test CC module adapter**/

class Mage_MZPayment_Model_PaymentMethod extends Mage_Payment_Model_Abstract
{  
    
/**   
    * unique internal payment method identifier   
    *    
    * @var string [a-z0-9_]   
    **/
    
protected $_code 'mzpayment';   
    
/**   
    * Possible result statuses   
    **/  
    
    
const RESPONSE_CODE_APPROVED 1;
    const 
RESPONSE_CODE_DECLINED 2;  
    const 
RESPONSE_CODE_ERROR 3;  
    const 
RESPONSE_CODE_HELD 4;   
    
    
}
?>

MZPayment/sql/mzpayment_setup.php

<?php 
$code 
'mzpayment'

$this->setConfigData('payment/'.$code.'/model''mzpayment/hpcc');

// create payment method group in Admin / System / Configuration / Payment Methods
$this->addConfigField(
    
'payment/'.$code
    
'MZPayment'
); 

// specify title for this payment method
$this->addConfigField(
    
'payment/'.$code.'/title'
    
'MZPayment'
);

$this->setConfigData(
    
'payment/'.$code.'/title'
    
'MZPayment'
); 

// add Enabled flag configuration
$this->addConfigField(
    
'payment/'.$code.'/active'
    
'Enabled'
    
, array(  
        
'frontend_type'=>'select',  
        
'source_model'=>'adminhtml/system_config_source_payment_active'
        
)
); 

// choose initial order status when checking out with this payment method
$this->addConfigField(
    
'payment/'.$code.'/order_status' 
    
'Order Status' 
    
, array(
        
'frontend_type'=>'select',  
        
'source_model'=>'adminhtml/system_config_source_order_status'
    
)
); 

// set position for this payment method in list
$this->addConfigField(
    
'payment/'.$code.'/sort_order'
    
'Sort Order'
);
?>

also added app/etc/modules/MZPayment.xml

<config>
    <
modules>
        <
Mage_MZPayment>
            <
active>true</active>
            <
codePool>locale</codePool>
        </
Mage_MZPayment>            
    </
modules>
</
config>

and app/etc/local.xml looks like

<config>
    <global>
        <
install>
            <
date><![CDATA[Tue05 Feb 2008 18:50:19 +0000]]></date>
        </
install>
        <
crypt>
            <
key><![CDATA[fsdjk324fjds523jgkv324tg2433s3]]></key>
        </
crypt>
        <
resources>
        </
resources>
     </global>
     <
modules>
        <
Mage_MZPayment>
            <
active>true</active>
            <
codePool>locale</codePool>
        </
Mage_MZPayment>            
    </
modules>     
</
config>

Nothing is shown up in backend, no SQL Inserts in DB, no Errors, using Magento 0.8.16100

Could anyone look at the code and report me my misstakes? For me it seems all is correct…
Maybe version conflicts? smth changed?

Thanks, KR

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

[m] Zentrale: things i see right away:

MZPayment/sql/mzpayment_setup.php - the file name is not correct it should be mzpayment_setup-install-0.1.0.php, but it is not needed anymore in new version as all the configuration fiels are read from MZPayment/etc/system.xml

don’t need to update local.xml as you have already created app/etc/modules/MZPayment.xml

rename MZPayment/Model/HPCc.php to MZPayment/Model/Hpcc.php

// instead of 
class Mage_MZPayment_Model_PaymentMethod extends Mage_Payment_Model_Abstract

// use
class Mage_MZPayment_Model_Hpcc extends Mage_Payment_Model_Method_Abstract
 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi Moshe,

it still dont work, but than i tried to adapt the paygate module to an local module. i called it MZHeidelpay. I renamed Models, Controllers and all that stuff to the new names. Copied to local/Menge, cleared all cache in backend, cleared cache in folder, deactivated all caches but my module wount be displayed in payment modules anyway. Is it a problem to name the module and the model with same name? May i attach my adapted module?

KR

Stefan

File Attachments
MZHeidelpay.zip  (File Size: 13KB - Downloads: 536)
 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

Ok, after reading you article i changed following:
name of file MHHeidelpay.php in Model changed to Mzheidelpay.php, also changed classname of model to Mage_MZHeidelpay_Model_Mzheidelpay instead of Mage_MZHeidelpay_Model_MZHeidelpay smile!

but it is still not shown up in Payment Modules :(! Its listed under “Advanced”

Need some help please

KR

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi Guys,

so, now i have the solution for this:

I have to put my module to folder /app/code/community/Mage/ instead of folder /app/code/local/Mage/

and set in app/etc/modules/MZHeidelpay.xml

<config>
    <
modules>
        <
Mage_Heidelpay>
            <
active>true</active>
            <
codePool>community</codePool>
        </
Mage_Heidelpay>          
    </
modules>
</
config>

KR

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

iam too stupid, in MZHeidelpay.xml i set for codePool to locale instead of local rasberry! OMG!

cheers

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
beha
Jr. Member
 
Total Posts:  4
Joined:  2008-02-20
Poland
 

Hi,

It seems like core_config_field table not longer exists in Magento 8.161

I ‘ve tried to go trough tutorial and at the end I getting an error

Zend_Db_Statement_Exception Object
(
    
[message:protected] => SQLSTATE[42S02]Base table or view not found1146 Table 'magento.core_config_field' doesn't exist
    [string:private] => 
    [code:protected] => 0
    [file:protected] => /var/ww...
    {...}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top