2

I have tried Payment Module Development 5 times and tried lots of fixes available but none useful for me.

I have the same problem for shipment method; see Custom Shipping Module Not Showing on Frontend

I'm using Magento CE 1.9.1.0

C:\wamp\www\magento1\app\code\local\Magik\Paymentpro\etc\config.xml

<?xml version="1.0"?>
<config>
    <global>
        <models>
            <paymentpro>
                <class>Magik_Paymentpro_Model</class>
            </paymentpro>
        </models>

        <resources>
            <paymentpro_setup>
                <setup>
                    <module>Magik_Paymentpro</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </paymentpro_setup>
            <paymentpro_write>
                <use>core_write</use>
            </paymentpro_write>
            <paymentpro_read>
                <use>core_read</use>
            </paymentpro_read>
        </resources>
    </global>

    <default>
        <payment>
            <paymentpro>
                <active>0</active>
                <model>Paymentpro/PaymentMethod</model>
                <order_status>pending</order_status>
                <title>Cash On Delivery</title>
            </paymentpro>
        </payment>
    </default>
    <frontend>
        <routers>
            <mycheckout>
                <use>standard</use>
                <args>
                    <module>Inchoo_Mycheckout</module>
                    <frontname>customcard</frontname>
                </args>
            </mycheckout>
        </routers>
    </frontend>
</config>

C:\wamp\www\magento1\app\code\local\Magik\Paymentpro\etc\system.xml

<?xml version="1.0"?>
<config>
    <sections>
        <!-- payment tab -->
        <payment>
            <groups>
                <!-- paymentpro fieldset -->
                <paymentpro translate="label" module="paygate">
                    <!-- will have title 'Cash On Delivery' -->
                    <label>TCS Cash Payment Methods</label>
                    <!-- position between other payment methods -->
                    <sort_order>1</sort_order>
                    <!-- do not show this configuration options in store scope -->
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>0</show_in_store>
                    <fields>
                        <!-- is this payment method active for the website? -->
                        <active translate="label">
                            <!-- label for the field -->
                            <label>Enabled</label>
                            <!-- input type for configuration value -->
                            <frontend_type>select</frontend_type>
                            <!-- model to take the option values from -->
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <!-- field position -->
                            <sort_order>1</sort_order>
                            <!-- do not show this field in store scope -->
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </active>
                        <order_status translate="label">
                            <label>New order status</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_order_status</source_model>
                            <!--<source_model>adminhtml/system_config_source_order_status_new</source_model>-->
                            <!--<source_model>adminhtml/system_config_source_order_status_processing</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>
                        </order_status>
                        <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>1</show_in_store>
                        </allowspecific>
                        <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>1</show_in_store>
                        </specificcountry>

                        <title translate="label">
                            <label>Cash Method</label>
                            <frontend_type>multiselect</frontend_type>
                            <sort_order>2</sort_order>
                            <source_model>paymentpro/paymentmethod</source_model>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </title>
                    </fields>
                </paymentpro>
            </groups>
        </payment>
    </sections>
</config>

C:\wamp\www\magento1\app\code\local\Magik\PaymentPro\Model\PaymentMethod.php

<?php
class Magik_Paymentpro_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract
{
    protected $_code                    = 'paymentpro';
    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 = 'payment/form_checkmo';
    //protected $_infoBlockType = 'payment/info_cod';

    /**
    * Assign data to info model instance
    *
    * @param   mixed $data
    * @return  Mage_Payment_Model_Method_Checkmo
    */

  public function toOptionArray()
  {
    return array(
      array('value' => 0, 'label' => 'Cash On Delivery'),
      array('value' => 1, 'label' => 'Cash At Doorstep')   );
  }
    public function authorize(Varien_Object $payment, $amount){
        $data = $payment->getData();
        /*
        $data = array(
        store_id,
        customer_payment_id,
        method,
        additional_data,
        po_number,
        cc_type,
        cc_number_enc,
        cc_last4,
        cc_owner,
        cc_exp_month,
        cc_exp_year,
        cc_number,
        cc_cid,
        cc_ss_issue,
        cc_ss_start_month,
        cc_ss_start_year,
        parent_id,
        amount_ordered,
        base_amount_ordered,
        shipping_amount,
        base_shipping_amount,
        method_instance)
        */
    }
    public function capture(Varien_Object $payment, $amount){
        // Grab stored payment data array for processing
        $paymentData = unserialize($payment->getAdditionalData());
    }
    public function void(Varien_Object $payment){
        // actions when order is voided occur here
    }
    public function refund(Varien_Object $payment, $amount){
        // actions when order is refunded occur here
    }   
    public function assignData($data){
        $details = array();
        if ($this->getPayableTo()) {
        $details['payable_to'] = $this->getPayableTo();
        }
        if ($this->getMailingAddress()) {
        $details['mailing_address'] = $this->getMailingAddress();
        }
        if (!empty($details)) {
        $this->getInfoInstance()->setAdditionalData(serialize($details));
        }
        return $this;
    }

    public function getPayableTo(){
        return $this->getConfigData('payable_to');
    }

    public function getMailingAddress(){
        return $this->getConfigData('mailing_address');
    }
}

C:\wamp\www\magento1\app\etc\modules\paymentpro.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <catalog_product_view>
        <reference name="product.info">
            <block type="paymentpro/catalog_product_view_profile" name="product.info.additional.recurring.schedule" as="recurring_info" template="paymentpro/catalog/product/view/profile/schedule.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
                <action method="setTitle" translate="value"><value>Recurring Profile</value></action>
            </block>
        </reference>
        <reference name="product.info.options.wrapper">
            <block type="paymentpro/catalog_product_view_profile" name="product.info.options.recurring" as="recurring_options" template="paymentpro/catalog/product/view/profile/options.phtml"/>
        </reference>
    </catalog_product_view>
</layout>

C:\wamp\www\magento1\app\code\local\Magik\Paymentpro\etc\Magik_Paymentpro.xml

<?xml version="1.0"?>
<config>
    <modules>
        <!-- declare Magik_Paymentpro module -->
        <Magik_Paymentpro>
            <!-- this is an active module -->
            <active>true</active>
            <!-- this module will be located in app/code/local code pool -->
            <codePool>local</codePool>
            <!-- specify dependencies for correct module loading order -->
            <depends>
                <Mage_Payment />
            </depends>
            <!-- declare module's version information for database updates -->
            <version>0.1.0</version>
        </Magik_Paymentpro>
    </modules>
</config>

C:\wamp\www\magento1\app\design\frontend\base\default\template\paymentpro.phtml

<?php
// Retrieve order
$_order = new Mage_Sales_Model_Order();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$_order->loadByIncrementId($orderId);
?>
<form name="paymentproform" method="post" action="http://www.gateway.com/the_url_they_gave_me">
    <input type="hidden" name="orderid" value="<?php echo $orderId; ?>">
    <input type="hidden" name="grandtotal" value="<?php echo $_order->getBaseGrandTotal(); ?>">
</form>
<script type="text/javascript">
document.paymentproform.submit();
</script>
  • First try putting C:\wamp\www\magento1\app\code\local\Magik\Paymentpro\etc\Magik_Paymentpro.xml to C:\wamp\www\magento1\app\etc\modules\Magik_Paymentpro.xml – DmitryR Jan 21 '15 at 9:09
  • File located at C:\wamp\www\magento1\app\etc\modules\paymentpro.xml is a layout file, and it should be placed in another folder + it's name should be added to the config.xml as a layout update name. Try reading Magento Extension Developer's Guide, v. 1.0 first. – DmitryR Jan 21 '15 at 9:15
  • Module now visible on frontend but values are not loading now. Its a multiselect that should appear on frontend. config.xml – Magento Developer Jan 24 '15 at 5:18
2
<default>
    <payment>
        <paymentpro>
            <active>0</active>
            <model>Paymentpro/PaymentMethod</model>
            <order_status>pending</order_status>
            <title>Cash On Delivery</title>
        </paymentpro>
    </payment>
</default>

Should be

<default>
    <payment>
        <paymentpro>
            <!-- can be overridden via System > Config (see `core_config_data`) -->
            <active>1</active>
            <!--
                Your model class group is "paymentpro" not "Paymentpro". Also,
                "PaymentMethod" points to "Magik_Paymentpro_Model_PaymentMethod"
            -->
            <model>paymentpro/PaymentMethod</model>
            <order_status>pending</order_status>
            <title>Cash On Delivery</title>
        </paymentpro>
    </payment>
</default>
  • its still not working. please guide me to the solution today. Its crucial for me to complete today. – Magento Developer Feb 1 '15 at 12:16
  • Well, it's past the crucial time. Did you get this working? – benmarks Feb 16 '15 at 14:58
  • 9
    Two things, "MagentoDeveloper": (1) StackExchange is not just about helping you - it's mainly about cataloguing and curating help for the benefit of an entire community of developers. (2) "Help me NOW" requests are not really in the spirit of SE (see point #1), and your comments on my answer are coming off as insulting ("sorry none of u identified the problem area even"). I'm giving you the benefit of the doubt as English seems to not be your first language, but you'll find that a poor attitude & tone will leave you out in the cold when asking for free help from some of the best & brightest. – benmarks Feb 17 '15 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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