开发者

New customized Payment module.Problem not displaying in Front end

i created customized payment module.it comes in system-> advanced and also in Payment methods but it is not coming in Front end where Payment method selection time . Pls review my code

\app\code\local\GMO\Payment\etc

config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<GMO_Payment>
<version>1.0.0</version>
</GMO_Payment>
</modules>

 <global>
<models>
<GMO>
 <class>GMO_Payment_Model</class>
 </GMO>
  </models>

   <blocks>
  <GMO_Payment>
 <class>GMO_Payment_Block</class>
 </GMO_Payment>
 </blocks>
</global>

<resources>
  <!-- resource identifier -->
  <GMO_setup>
    <!-- specify that this resource is a setup resource and used for upgrades -->
    <setup>
      <!-- which module to look for install/upgrade files in -->
      <module>GMO_Payment</module>
    </setup>
    <!-- specify database connection for this resource -->
    <connection>
      <!-- do not create new connection, use predefined core setup connection -->
      <use>core_setup</use>
    </connection>
  </GMO_setup>
  <GMO_write>
    <connection>
      <use>core_write</use>


    </connection>
  </GMO_write>
  <GMO_read>
    <connection>
      <use>core_read</use>
    </connection>
    </GMO_read>
   </resources>
  <default>
  <payment>
     <GMO>
  <model>Payment/PaymentGMO</model>
  <active>1</active>
   <order_status>pending</order_status>
   <title>GMO</title>
  <payment_action>sale</payment_action>
   <submit_url>https://someurl.com</submit_url>
     <merchant_id>Insert merchant id</merchant_id>
     <allowspecific>0</allowspecific>
    <sort_order>1</sort_order>
    </GMO>
   </payment>
    </default>
       <frontend>
    <routers>
        <GMO>
            <use>standard</use>
            <args>
                <module>GMO_Payment</module>
                <frontName>GMO</frontName>
            </args>
        </GMO>
    </routers>
     </frontend>

        </config>

system.xml

    <?xml version="1.0"?>
    <config>
    <sections>
    <payment>
     <groups>
      <GMO_Payment translate="label comment" module="paypal">
     <label>GMO</label>
    <frontend_type>text</frontend_type>
  <sort_order>0</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>0</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>
    <order_status translate="label">
    <label>New Order Status</label>
     <frontend_type>select</frontend_type>
      <source_model>adminhtml/system_config_source_order_status</source_model>
      <sort_order>50</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>
         <submit_url>
  <label>Gateway URL</label>
  <frontend_type>text</frontend_type>
  <sort_order>58</sort_order>
   <show_in_default>1</show_in_default>
       <show_in_website>1</show_in_website>
        <show_in_store>0</show_in_store>
  </submit_url>
  <merchant_id>
   <label>Merchant ID</label>
    <frontend_type>text</frontend_type>
    <sort_order>59</sort_order>
            <show_in_default>1</show_in_default>
           <show_in_website>1</show_in_website>
      <show_in_store>0</show_in_store>
            </merchant_id>
            <allowspecific translate="label">
          <label>Payment Applicable From</label>
           <frontend_type>select</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>0</show_in_store>
        </allowspecific>
              <specificcountry translate="label">
           <label>Countries Payment Applicable From</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>0</show_in_store>
                  <depends><allowspecific>1</allowspecific></depends>
                 </specificcountry>
              <sort_order translate="label">
               <label>Sort Order</label>
                <frontend_type>text</frontend_type>
              </sort_order><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>

                  </fields>
          </GMO_Payment>
      </gr开发者_开发技巧oups>
          </payment>

         </sections>
           </config>

app\code\local\GMO\Payment\Model\standard.php

     <?php

      class GMO_Payment_Model_Standard extends Mage_Payment_Model_Method_Abstract
  {

   protected $_code = 'GMO_Payment';

   protected $_isInitializeNeeded      = true;
     protected $_canUseInternal          = false;
      protected $_canUseForMultishipping  = false;
        protected $_isGateway               = true;


 * can this method capture funds?
 */
    protected $_canCapture              = true;


protected $_canRefund               = false;

/**
 * can this method void transactions?
 */
 protected $_canVoid                 = true;


    protected $_canUseCheckout          = true;


  /**
  * can this method save cc info for later use?
   */
    protected $_canSaveCc = false;
       /**
     * Return Order place redirect url
      *
      * @return string
      */

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

    }


Just went through something like this myself.

My problem (which looks like you have too) was somewhere in the depths of Magento it reads your config based on your $_code variable. So your config.xml file must match your code thus:

class GMO_Payment_Model_Standard extends Mage_Payment_Model_Method_Abstract
{
     // Must be == config/default/payment/xxxx in your config.xml
     protected $_code = GMO; // 'GMO_Payment';
}

Additionally your model looks wrong in config.xml. It must be the same as the last section of you class name (in your case is "Standard") but in lowercase:

<config>
    <default>
        <payment>
            <GMO>
                <model>Payment/standard</model>
....
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜