简体   繁体   中英

Payment method is visible in Admin configuration but not on Frontend in Magento

I have included Payment method module on my website.That payment method is visible in Admin Configurations but not on frontend on Payment Step.

I have a config file named config.xml whose code is

    <?xml version="1.0"?>
<config>
    <modules>
        <Goodahead_Santander>
            <version>1.0.0</version>
        </Goodahead_Santander>
    </modules>
    <global>
        <models>
            <goodahead_santander>
                <class>Goodahead_Santander_Model</class>
                <resourceModel>goodahead_santander_resource</resourceModel>
            </goodahead_santander>
            <goodahead_santander_resource>
                <class>Goodahead_Santander_Model_Resource</class>
                <entities>
                    <finance_id>
                        <table>goodahead_santander_finance_id</table>
                    </finance_id>
                </entities>
            </goodahead_santander_resource>
        </models>
        <resources>
            <goodahead_santander_setup>
                <setup>
                    <module>Goodahead_Santander</module>
                    <class>Mage_Eav_Model_Entity_Setup</class>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </goodahead_santander_setup>
            <goodahead_santander_write>
                <use>core_write</use>
            </goodahead_santander_write>
            <goodahead_santander_read>
                <use>core_read</use>
            </goodahead_santander_read>
        </resources>
        <blocks>
            <goodahead_santander>
                <class>Goodahead_Santander_Block</class>
            </goodahead_santander>
        </blocks>
        <helpers>
            <goodahead_santander>
                <class>Goodahead_Santander_Helper</class>
            </goodahead_santander>
        </helpers>        
    </global>
    <frontend>
        <layout>
            <updates>
                <goodahead_santander>
                    <file>goodahead/santander.xml</file>
                </goodahead_santander>
            </updates>
        </layout>
        <events>
            <controller_action_predispatch_checkout_cart_index>
                <observers>
                    <goodahead_messages_postdispatch_checkout_cart_add>
                        <class>goodahead_messages/observer</class>
                        <method>addIsInCart</method>
                    </goodahead_messages_postdispatch_checkout_cart_add>
                </observers>
            </controller_action_predispatch_checkout_cart_index>
            <controller_action_predispatch_checkout_onepage_savePayment>
                <observers>
                    <goodahead_santander_controller_action_predispatch_savePayment>
                        <class>goodahead_santander/observer</class>
                        <method>onSavePaymentMethod</method>
                    </goodahead_santander_controller_action_predispatch_savePayment>
                </observers>
            </controller_action_predispatch_checkout_onepage_savePayment>
            <checkout_submit_all_after>
            <observers>
                    <goodahead_santander_checkout_submit_all_after>
                        <class>goodahead_santander/observer</class>
                        <method>sendOrderEmail</method>
                    </goodahead_santander_checkout_submit_all_after>
                </observers>
            </checkout_submit_all_after>
        </events>
    </frontend>
    <default>
        <payment>
            <santander>
                <active>1</active> 
                <model>goodahead_santander/Finanzierung</model>
                <order_status>1</order_status>
                <title>Finanzierung</title>
                <allowspecific>0</allowspecific>
                <form_block_type>0</form_block_type>
                <payment_action>authorize</payment_action>
                <show_bank_accounts_in_pdf>1</show_bank_accounts_in_pdf>
                <show_customtext_in_pdf>1</show_customtext_in_pdf>
            </santander>
        </payment>
    </default>

</config>

and system.xml is

<?xml version="1.0"?>
<config>
    <sections>
        <payment>
            <groups>
                <santander translate="label" module="goodahead_santander">
                    <label>Finanzierung</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>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </active>
                        <title translate="label">
                            <label>Title</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>20</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </title>
                        <vendornumber translate="label">
                            <label>Vendor number</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>21</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <comment>Your account number</comment>
                        </vendornumber>
                        <vendorpassword translate="label">
                            <label>Vendor password</label>
                            <frontend_type>password</frontend_type>
                            <sort_order>22</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <comment>Your account password</comment>
                        </vendorpassword>
                        <endpoint translate="label">
                            <label>WSDL endpoint</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>23</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <comment>WSDL endpoint URL (Given by bank)</comment>
                        </endpoint>
                        <url translate="label">
                            <label>Financing URL</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>24</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <comment>Financing URL (Given by bank)</comment>
                        </url>
                        <order_status translate="label">
                            <label>New order status</label>
                            <frontend_type>select</frontend_type>
                            <source_model>goodahead_santander/source_order_status</source_model>
                            <sort_order>40</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </order_status>
                        <sort_order translate="label">
                            <label>Sort order</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>50</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </sort_order>
                        <allowspecific translate="label">
                            <label>Payment from applicable countries</label>
                            <frontend_type>allowspecific</frontend_type>
                            <sort_order>60</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>70</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>
                        <min_order_total>
                            <label>Minimum Order Total</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>71</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </min_order_total>
                        <max_order_total>
                            <label>Maximum Order Total</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>72</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </max_order_total>
                    </fields>
                </santander>
            </groups>
        </payment>
    </sections>

    <!-- FINANCING CALCULATOR -->
    <tabs>
        <goodahead translate="label" module="goodahead_santander">
            <label>Goodahead</label>
            <sort_order>300</sort_order>
        </goodahead>
    </tabs>
    <sections>
        <goodahead_calculator translate="label">
            <label>Financing Calculator</label>
            <tab>goodahead</tab>
            <frontend_type>text</frontend_type>
            <sort_order>10</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <rates translate="label">
                    <label>Rates</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>10</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <cms_page translate="label">
                            <label>CMS page:</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <comment>Enter CMS page url key</comment>
                        </cms_page>
                        <shipping translate="label">
                            <label>Shipping cost:</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>20</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <comment>Shipping cost included to calculation</comment>
                        </shipping>
                        <rates translate="label">
                            <label>Months and Rates:</label>
                            <frontend_type>text</frontend_type>
                            <frontend_model>goodahead_santander/adminhtml_rates</frontend_model>
                            <backend_model>adminhtml/system_config_backend_serialized</backend_model>
                            <sort_order>30</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </rates>
                    </fields>
                </rates>
            </groups>
        </goodahead_calculator>
    </sections>
</config>

and model file named Finanzierung.php is

<?php

class Goodahead_Santander_Model_Finanzierung extends Mage_Payment_Model_Method_Abstract
{
    protected $_code = 'santander';
   // protected $_canAuthorize = true;



    protected $_formBlockType = 'goodahead_santander/form';
    protected $_infoBlockType = 'goodahead_santander/info';

    /**
     * SoapClient object
     * @var SoapClient
     */
    protected $_soapClient;

    /**
     * WSDL endpoint url
     * @var string
     */
    protected $_endpoint;

    /**
     * Parameters for SOAP request
     * @var array
     */
    protected $_params;

    /**
     * @see Mage_Payment_Model_Method_Abstract::isAvailable()
     */
    public function isAvailable($quote = null)
    {
        if (!$this->getEndpoint() 
            || !$this->_getVendorNumber()
            || !$this->_getVendorPassword()
            || !$this->getConfigData('url')
        ) {
            return false;
        }
        return parent::isAvailable($quote);
    }

}
?>

and layout design file is

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <checkout_onepage_index>
        <reference name="head">
            <action method="addJs"><script>goodahead/santander/calculator.js</script></action>
        </reference>
    </checkout_onepage_index>

    <santander_redirect_index>
        <reference name="content">
            <block type="goodahead_santander/redirect" name="redirect" as="redirect" template="goodahead/santander/redirect.phtml" />
        </reference>
    </santander_redirect_index>

    <checkout_cart_index>
        <reference name="head">
            <action method="addJs"><script>goodahead/santander/calculator.js</script></action>
        </reference>
        <reference name="checkout.cart">
            <block type="goodahead_santander/calculator" name="goodahead.santander.calculator" as="calculator" template="goodahead/santander/calculator.phtml"/>
        </reference>
    </checkout_cart_index>
</layout>

Please help.

<?php
class Goodahead_Santander_Model_Finanzierung extends Mage_Payment_Model_Method_Abstract
{
    protected $_code = 'santander';
    protected $_canUseInternal          = true;
    protected $_canUseCheckout          = true;
}
?>

Please refer above sample code $_canUseInternal = true; //this means you have to used payment in admin $_canUseInternal = true; // this means you have to used payment in checkout

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM