0

I am using Magento 1.9.4.5

I am developing a Custom Payment Gateway. Its showing up on Admin Configuration Page. But not showing at all in Multishipping Page and Admin Order Creation Page. I am providing the code I've done so far.

/app/etc/modules/WebKutir_Payment_Bkash.xml

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

/app/code/local/WebKutir/Payment/Bkash/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <WebKutir_Payment_Bkash>
            <version>0.1.0.0</version>
        </WebKutir_Payment_Bkash>
    </modules>
    <global>
        <helpers>
            <webkutir_payment_bkash>
                <class>WebKutir_Payment_Bkash_Helper</class>
            </webkutir_payment_bkash>
        </helpers>
        <blocks>
            <webkutir_payment_bkash>
                <class>WebKutir_Payment_Bkash_Block</class>
            </webkutir_payment_bkash>
        </blocks>
        <models>
            <webkutir_payment_bkash>
                <class>WebKutir_Payment_Bkash_Model</class>
            </webkutir_payment_bkash>
        </models>
    </global>
    <default>
        <payment>
            <webkutir_payment_bkash>
                <active>1</active>
                <model>webkutir_payment_bkash/starter</model>
                <order_status>processing</order_status>
                <title>bKash</title>
                <testmode>1</testmode>
                <allowspecific>1</allowspecific>
                <specificcountry>BD</specificcountry>
                <password backend_model="adminhtml/system_config_backend_encrypted"/>
                <appkey backend_model="adminhtml/system_config_backend_encrypted"/>
                <appsecret backend_model="adminhtml/system_config_backend_encrypted"/>
            </webkutir_payment_bkash>
        </payment>
    </default>
</config>

/app/code/local/WebKutir/Payment/Bkash/etc/system.xml

<?xml version="1.0"?>
<config>    
    <sections>
        <payment>
            <groups>
                <webkutir_payment_bkash translate="label">
                    <label>bKash Payment Gateway</label>
                    <sort_order>1000</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>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                            <sort_order>2</sort_order>
                        </active>
                        <title translate="label">
                            <label>Title</label>
                            <frontend_type>text</frontend_type>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                            <sort_order>3</sort_order>
                        </title>
                        <testmode translate="label">
                            <label>Test Mode</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                            <sort_order>4</sort_order>
                        </testmode>
                        <url translate="label">
                            <label>Gateway URL</label>
                            <frontend_type>text</frontend_type>
                            <validate>required-entry</validate>
                            <sort_order>5</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </url>
                        <username translate="label">
                            <label>Username</label>
                            <frontend_type>text</frontend_type>
                            <validate>required-entry</validate>
                            <sort_order>6</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </username>
                        <password translate="label">
                            <label>Password</label>
                            <frontend_type>obscure</frontend_type>
                            <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
                            <validate>required-entry</validate>
                            <sort_order>7</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </password>
                        <appkey translate="label">
                            <label>App Key</label>
                            <frontend_type>obscure</frontend_type>
                            <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
                            <validate>required-entry</validate>
                            <sort_order>8</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </appkey>
                        <appsecret translate="label">
                            <label>App Secret Key</label>
                            <frontend_type>obscure</frontend_type>
                            <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
                            <validate>required-entry</validate>
                            <sort_order>9</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </appsecret>
                        <order_status translate="label">
                            <label>New order status</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_order_status</source_model>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                            <sort_order>10</sort_order>
                        </order_status>
                        <allowspecific translate="label">
                            <label>Payment from applicable countries</label>
                            <frontend_type>allowspecific</frontend_type>
                            <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>
                            <sort_order>80</sort_order>
                        </allowspecific>
                        <specificcountry translate="label">
                            <label>Payment from Specific countries</label>
                            <frontend_type>multiselect</frontend_type>
                            <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>
                            <sort_order>90</sort_order>
                        </specificcountry>
                        <min_order_total translate="label">
                            <label>Minimum Order Total</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>
                        </min_order_total>
                        <max_order_total translate="label">
                            <label>Maximum Order Total</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>110</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>
                        <sort_order translate="label">
                            <label>Sort Order</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>120</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                            <frontend_class>validate-number</frontend_class>
                        </sort_order>
                    </fields>
                </webkutir_payment_bkash>
            </groups>
        </payment>
    </sections>
</config>

/app/code/local/WebKutir/Payment/Bkash/Helper/Data.php

<?php

class WebKutir_Payment_Bkash_Helper_Data extends
    Mage_Core_Helper_Abstract
{

}

/app/code/local/WebKutir/Payment/Bkash/Model/Starter.php

<?php

class WebKutir_Payment_Bkash_Model_Starter extends Mage_Payment_Model_Method_Abstract 
{
    protected $_code                    = 'webkutirpaymentgatewaybkash';
    protected $_isGateway               = true;
    protected $_canAuthorize            = true;
    protected $_canCapture              = true;
    protected $_canCapturePartial       = false;
    protected $_canRefund               = true;
    protected $_canVoid                 = true;
    protected $_canUseInternal          = true;
    protected $_canUseCheckout          = true;
    protected $_canUseForMultishipping  = true;
    protected $_canSaveCc               = false;

    protected $_formBlockType = 'webkutir_payment_bkash/form_bkash';
    protected $_infoBlockType = 'webkutir_payment_bkash/info_bkash';

    public function getOrderPlaceRedirectUrl()
    {
        return Mage::getUrl('bkash/payment/redirect', array('_secure' => true));
    }
}

/app/code/local/WebKutir/Payment/Bkash/Block/Form/Bkash.php

<?php

class WebKutir_Payment_Bkash_Block_Form_Bkash extends Mage_Payment_Block_Form
{
    protected function __construct()
    {
        parent::__construct();
        
        $this->setTemplate('webkutir/payment/bkash/form/bkash.phtml');
    }
}

/app/code/local/WebKutir/Payment/Bkash/Block/Info/Bkash.php

<?php

class WebKutir_Payment_Bkash_Block_Info_Bkash extends Mage_Payment_Block_Info
{
    protected function _prepareSpecificInformation($transport = null)
    {
        if (null !== $this->_paymentSpecificInformation) 
        {
            return $this->_paymentSpecificInformation;
        }
    
        $data = array();
        $transport = parent::_prepareSpecificInformation($transport);
    
        return $transport->setData(array_merge($data, $transport->getData()));
    }
}

/app/design/frontend/base/default/template/webkutir/payment/bkash/form/bkash.phtml

<div class="form-list" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
    <div>
        <label><?php echo $this->__('Custom Field One') ?>*</label>
    </div>
</div>
<div>
    <?php echo $this->getMethod()->getConfigData('message');?>
</div>

This Payment Module is not showing on Frontend and Backend. Please help me to solve this issue.

Thanks.

1 Answer 1

0

Regarding the front end, the layout file is missing. Create a layout file in the theme/module with the below content.

/frontend/base/default/layout/layoutfilename.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <checkout_onepage_payment_method_available>
        <reference name="root">
            <block type="core/template" name="custompayment" template="yourfoldername/payment.phtml"/>
        </reference>
    </checkout_onepage_payment_method_available>
</layout>

Same for the admin area.

/adminhtml/default/default/layout/custompayment.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <adminhtml_sales_order_create_index>
        <reference name="head">
            <action method="addItem"><type>js_css</type><name>custompayment/style.css</name></action>
        </reference>
    </adminhtml_sales_order_create_index>
</layout>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.