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

New Payment Method extending Mage_Payment_Model_Method_Ccsave does not pass onepage checkout payment info form validation
 
kevin123
Jr. Member
 
Total Posts:  27
Joined:  2008-11-04
 

Hello,

I am trying to extend Mage_Payment_Model_Method_Ccsave however, my new Payment Method shows up in the backend admin and in the frontend but when the user tries to click “Continue” on the onepage checkout the form just hangs..

Something is not passing the form validation. I am not sure what though.

The only difference my new Payment Method has with the original is that I have overwritten the isAvailable() to check the customers customer group in order to determine if the payment method should display or not.

I’ll attach my module files below.

Any feedback or advice would be much appreciated.

/app/code/local/pxcv/StarkPayment/etc/config.xml

<?xml version="1.0"?>
<config>
    <
modules>
       <
Pxcv_StarkPayment>
          <
version>0.1.0</version>
       </
Pxcv_StarkPayment>
    </
modules>
 
    <global>
        <
models>
            <
starkpayment>
                <class>
Pxcv_StarkPayment_Model</class>
            </
starkpayment>
        </
models>
 
      <
helpers>
        <
starkpayment>
            <class>
Pxcv_StarkPayment_Helper</class>
        </
starkpayment>
        </
helpers>    
            
        <
resources>
            <
starkpayment_setup>
                <
setup>
                    <
module>Pxcv_StarkPayment</module>
                </
setup>
                <
connection>
                    <use>
core_setup</use>
                </
connection>
            </
starkpayment_setup>
            <
starkpayment_write>
                <
connection>
                  <use>
core_write</use>
                </
connection>
            </
starkpayment_write>
            <
starkpayment_read>
               <
connection>
                <use>
core_read</use>
              </
connection>
            </
starkpayment_read>
        </
resources>
                  
    </global>

    <default>
        <
payment>

            <
savedcc>
                <
active>1</active>
                <
cctypes>AE,VI,MC,DI</cctypes>
                <
model>starkpayment/method_savedcc</model>
                <
order_status>pending</order_status>
                <
title>Credit Card</title>
                <
allowspecific>0</allowspecific>
            </
savedcc>
                             
         </
payment>
    </default>
    
</
config>
 
Magento Community Magento Community
Magento Community
Magento Community
 
kevin123
Jr. Member
 
Total Posts:  27
Joined:  2008-11-04
 

/app/code/local/Pxcv/StarkPayment/Model/Method/Savedcc.php

<?php
class Pxcv_StarkPayment_Model_Method_Savedcc extends Mage_Payment_Model_Method_Ccsave {

    
protected $_code            'savedcc';
 
    public function 
isAvailable($quote=null{
        
if (=== (int) $quote->getCustomer()->getGroupId()) {
            
return true;
        
}
        
return false;
    
}
        
}
?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
kevin123
Jr. Member
 
Total Posts:  27
Joined:  2008-11-04
 

/app/code/local/Pxcv/StarkPayment/etc/system.xml

<?xml version="1.0"?>
<config>
   <
sections>
        <
payment translate="label" module="payment">
            <
label>Payment Methods</label>
            <
tab>sales</tab>
            <
frontend_type>text</frontend_type>
            <
sort_order>400</sort_order>
            <
show_in_default>1</show_in_default>
            <
show_in_website>1</show_in_website>
            <
show_in_store>1</show_in_store>
            <
groups>

                <
savedcc translate="label">
                    <
label>Saved CC (Retailer Only)</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>1</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>
                        <
cctypes translate="label">
                            <
label>Credit Card Types</label>
                            <
frontend_type>multiselect</frontend_type>
                            <
source_model>adminhtml/system_config_source_payment_cctype</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>
                        </
cctypes>

..
 
Magento Community Magento Community
Magento Community
Magento Community
 
kevin123
Jr. Member
 
Total Posts:  27
Joined:  2008-11-04
 

<order_status translate="label">
                            <
label>New order status</label>
                            <
frontend_type>select</frontend_type>
                            <
source_model>adminhtml/system_config_source_order_status_new</source_model>
                            <
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>
                        </
order_status>
                        <
sort_order translate="label">
                            <
label>Sort order</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>100</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>0</show_in_store>
                        </
sort_order>
                        <
title translate="label">
                            <
label>Title</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>1</show_in_store>
                        </
title>
                        <
useccv translate="label">
                            <
label>Credit Card Verification</label>
                            <
frontend_type>select</frontend_type>
                            <
source_model>adminhtml/system_config_source_yesno</source_model>
                            <
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>
                        </
useccv>
                         <
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>0</show_in_store>
                        </
allowspecific>
 
Magento Community Magento Community
Magento Community
Magento Community
 
kevin123
Jr. Member
 
Total Posts:  27
Joined:  2008-11-04
 

<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>0</show_in_store>
                        </
specificcountry>
                        <
min_order_total translate="label">
                            <
label>Minimum Order Total</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>98</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>0</show_in_store>
                        </
min_order_total>
                        <
max_order_total translate="label">
                            <
label>Maximum Order Total</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>99</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>0</show_in_store>
                        </
max_order_total>
                        <
model>
                        </
model>
                    </
fields>
                </
savedcc>
                                           
            </
groups>
        </
payment>
    </
sections>
</
config>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top