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
 
magentix2008
Jr. Member
 
Total Posts:  4
Joined:  2008-03-14
 

actually I think one has to create a Mage_Payment.csv or whatever filename you use in etc/config.xml
Well I could be wrong but I’ll give that a shot (let me know if that’s wrong!)
Ta

 
Magento Community Magento Community
Magento Community
Magento Community
 
magentix2008
Jr. Member
 
Total Posts:  4
Joined:  2008-03-14
 

Hi again (spammer!)

Sorted the issue of the form not showing up on checkout by looking at the core modules, notably cc save. (was way off with the csv file, duh)
In config.xml I use this model <model>protx/payment</model>
and I had a bug in my Payment.php class smile Form shows up now. So double check your model, make sure you’ve renamed the dir from model to Model as well. Hope that helps.

 
Magento Community Magento Community
Magento Community
Magento Community
 
magentix2008
Jr. Member
 
Total Posts:  4
Joined:  2008-03-14
 

Hi,

sorted out most things but if anyone knew how to add different card types that would be grand - I need to add 3 UK based cards (although they’re just maestro I believe) SWITCH/Solo and visa electron. Point is I can just pass the card code I choose to the payment gateway (protx) but am having issues adding additional options to this drop down.
If you have nay hints, it would be much apreciated.
Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
redpen
Sr. Member
 
Total Posts:  254
Joined:  2008-01-23
 
magentix2008 - 14 March 2008 04:53 PM

Hi,

sorted out most things but if anyone knew how to add different card types that would be grand - I need to add 3 UK based cards (although they’re just maestro I believe) SWITCH/Solo and visa electron. Point is I can just pass the card code I choose to the payment gateway (protx) but am having issues adding additional options to this drop down.
If you have nay hints, it would be much apreciated.
Thanks!

Have you managed to get a working ProTX module, then?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 
magentix2008 - 14 March 2008 04:53 PM

Hi,

sorted out most things but if anyone knew how to add different card types that would be grand - I need to add 3 UK based cards (although they’re just maestro I believe) SWITCH/Solo and visa electron. Point is I can just pass the card code I choose to the payment gateway (protx) but am having issues adding additional options to this drop down.
If you have nay hints, it would be much apreciated.
Thanks!

hi,

open config.xml of your payment module and add between <global></global>

<payment>
            <
cc>
                <
types>
                    <
AE>
                        <
code>AE</code>
                        <
name>American Express</name>
                    </
AE>
                    <
VI>
                        <
code>VI</code>
                        <
name>Visa</name>
                    </
VI>
                    <
MC>
                        <
code>MC</code>
                        <
name>Master Card</name>
                    </
MC>
                    <
DI>
                        <
code>DI</code>
                        <
name>Discover</name>
                    </
DI>            
                    <
OT>
                        <
code>OT</code>
                        <
name>Other</name>
                    </
OT>
                </
types>
            </
cc>
        </
payment>

You are overwriting config of core\Mage\Payment\etc\config.xml. You can add your own CC types. Edit at your own needs

Cheers

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
bolasevich
Sr. Member
 
Avatar
Total Posts:  235
Joined:  2008-03-04
Newington, CT USA
 

I also am having a hard time with this.. i’ve tried for days now to just get this to show up in the “payment methods” options but so far it will only show in the advanced area as “Mage_MZHeidelpay” and it says its enabled. Can someone please look at this code and tell me where im going wrong just to get the basic thing to display. I took it from posts earlier in this and if i get some help ill post the final as a template for anyone that is trying to create there own payment module cause thats all im trying to do at this point is get a template that shows up.. then ill go and add all the code/logic but this part is proving to be far more difficult then it should and i know php and xml very well.. just not well enough i guess. any help would be great.

Thanks

File Attachments
MZHeidelpay.zip  (File Size: 14KB - Downloads: 166)
 
Magento Community Magento Community
Magento Community
Magento Community
 
bolasevich
Sr. Member
 
Avatar
Total Posts:  235
Joined:  2008-03-04
Newington, CT USA
 

here it is..answered my own question.. no idea why that other doesnt work but the concept was the same.. i really think it had to do with the names and some not being the same case. anyways here is a working template for the latest verison of magento.. just gives you the basic to develop off of.

Scott

File Attachments
template.zip  (File Size: 13KB - Downloads: 277)
 
Magento Community Magento Community
Magento Community
Magento Community
 
redpen
Sr. Member
 
Total Posts:  254
Joined:  2008-01-23
 
bolasevich - 19 March 2008 08:19 PM

here it is..answered my own question.. no idea why that other doesnt work but the concept was the same.. i really think it had to do with the names and some not being the same case. anyways here is a working template for the latest verison of magento.. just gives you the basic to develop off of.

Scott

Hi Scott.

Thanks for posting this, this looks the closest to a working ProTX module that I’ve seen.  I’ve copied the files into app/code/community to play around with, what else do I need to do to make it show up in Admin?

edit: sorry, got it.  Protx.xml needs to be in app/etc/modules.  =)

edit 2: produces errors on the checkout page.  I’m sure I’ve put stuff in the wrong folders…

edit 3: can’t figure it out.  Here’s my error which I get when accessing the checkout.  Module appears fine in the admin backend:

Warning: include(Protx.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\magento\app\code\core\Mage\Core\functions.php on line 44
[0] in __autoload() in C:\xampp\htdocs\magento\app\code\core\Mage\Core\functions.php on line 44
[1] in __autoload("Protx")
[2] in class_exists("Protx") in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Config.php on line 607
[3] in Mage_Core_Model_Config->getModelInstance("Protx", Array[0]) in C:\xampp\htdocs\magento\app\Mage.php on line 289
[4] in Mage::getModel("Protx") in C:\xampp\htdocs\magento\app\code\core\Mage\Payment\Helper\Data.php on line 68
[5] in Mage_Payment_Helper_Data->getStoreMethods(NULL, Mage_Sales_Model_Quote) in C:\xampp\htdocs\magento\app\code\core\Mage\Payment\Block\Form\Container.php on line 85
[6] in Mage_Payment_Block_Form_Container->getMethods() in C:\xampp\htdocs\magento\app\code\core\Mage\Payment\Block\Form\Container.php on line 37
[7] in Mage_Payment_Block_Form_Container->_prepareLayout() in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Block\Abstract.php on line 192
[8] in Mage_Core_Block_Abstract->setLayout(Mage_Core_Model_Layout) in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Layout.php on line 425
[9] in Mage_Core_Model_Layout->addBlock("Mage_Checkout_Block_Onepage_Payment_Methods", “checkout.payment.methods") in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Layout.php on line 220
[10] in Mage_Core_Model_Layout->_generateBlock(Mage_Core_Model_Layout_Element, Mage_Core_Model_Layout_Element) in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Layout.php on line 186
[11] in Mage_Core_Model_Layout->generateBlocks(Mage_Core_Model_Layout_Element) in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Layout.php on line 187
[12] in Mage_Core_Model_Layout->generateBlocks(Mage_Core_Model_Layout_Element) in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Layout.php on line 187
[13] in Mage_Core_Model_Layout->generateBlocks(Mage_Core_Model_Layout_Element) in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Layout.php on line 191
[14] in Mage_Core_Model_Layout->generateBlocks() in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Controller\Varien\Action.php on line 277
[15] in Mage_Core_Controller_Varien_Action->generateLayoutBlocks() in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Controller\Varien\Action.php on line 214
[16] in Mage_Core_Controller_Varien_Action->loadLayout() in C:\xampp\htdocs\magento\app\code\core\Mage\Checkout\controllers\OnepageController.php on line 94
[17] in Mage_Checkout_OnepageController->indexAction() in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Controller\Varien\Action.php on line 341
[18] in Mage_Core_Controller_Varien_Action->dispatch("index") in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php on line 150
[19] in Mage_Core_Controller_Varien_Router_Standard->match(Mage_Core_Controller_Request_Http) in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Controller\Varien\Front.php on line 147
[20] in Mage_Core_Controller_Varien_Front->dispatch() in C:\xampp\htdocs\magento\app\Mage.php on line 421
[21] in Mage::run("default") in C:\xampp\htdocs\magento\index.php on line 29

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

Hi,

theres one small change in config.xml
payment_action should be

<default>
<
payment>
<
protx>
  ...
  <
payment_action>authorize</payment_action
  ...
</default>

Attached you find my CC Payment Module

Cheers

File Attachments
Hpcc.zip  (File Size: 8KB - Downloads: 358)
 
Magento Community Magento Community
Magento Community
Magento Community
 
redpen
Sr. Member
 
Total Posts:  254
Joined:  2008-01-23
 
[m><p> zentrale” date= -

theres one small change in config.xml
payment_action should be

<default>
<
payment>
<
protx>
  ...
  <
payment_action>authorize</payment_action
  ...
</default>

Cheers

I still get the same screen full of errors.

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

Hi,

i updated my previous post and added my cc module.
check it out. Its based on authorized.net

cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
redpen
Sr. Member
 
Total Posts:  254
Joined:  2008-01-23
 
[m><p> zentrale” date= -

i updated my previous post and added my cc module.
check it out. Its based on authorized.net

cheers

Hi

I don’t understand, I was using the zip file from bolasevich - do I need anything else?

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

Hi,

dont know, try out mine and tell me about result. Should be located in “local” not “community”

Cheers

Stefan

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

Hi,

ok, try to add in helber class:

const XML_PATH_HPCC_METHODS 'protx';
    
    public function 
getMethodInstance($code)
    
{
        $key 
self::XML_PATH_HPCC_METHODS.'/'.$code.'/model';
        
$class Mage::getStoreConfig($key);
        if (!
$class{
            Mage
::throwException($this->__('Can not configuration for payment method with code: %s'$code));
        
}
        
return Mage::getModel($class);
    
}

and add following code to your model class

/**
     * Retrieve model helper
     *
     * @return Mage_Payment_Helper_Data
     */
    protected function _getHelper()
    
{
        
return Mage::helper('protx');
    
}
    
           
/**
     * Retrieve information from payment configuration
     *
     * @param   string $field
     * @return  mixed
     */
    
public function getConfigData($field)
    
{
        $path 
'payment/'.$this->getCode().'/'.$field;
        
$config Mage::getStoreConfig($path$this->getStore());    
        
        return 
$config;
    
}

EDIT: Sorry, this is totaly stupid to add smile!!!!

Cheeers

 
Magento Community Magento Community
Magento Community
Magento Community
 
redpen
Sr. Member
 
Total Posts:  254
Joined:  2008-01-23
 
[m><p> zentrale” date= -

ok, try to add in helber class:

Cheeers

No difference.  Same error.

It’s like it’s looking for protx.php but can’t find it.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top