Новый настроенный модуль оплаты. Проблема не отображается в интерфейсе - PullRequest
0 голосов
/ 17 августа 2011

я создал настроенный способ оплаты module.it входит в system-> advanced, а также в раздел «Способы оплаты», но он не поступает в интерфейс, где время выбора способа оплаты.Просьба просмотреть мой код

\ 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>

система.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>
      </groups>
          </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));
        }

    }

1 Ответ

1 голос
/ 10 ноября 2011

Просто сам прошел через что-то подобное.

Моя проблема (похоже, у вас тоже) была где-то в недрах Magento, она читает вашу конфигурацию на основе вашей переменной $_code. Таким образом, ваш файл config.xml должен соответствовать вашему коду таким образом:

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';
}

Кроме того, ваша модель выглядит неправильно в config.xml. Он должен совпадать с последним разделом имени вашего класса (в вашем случае это «Стандарт»), но в нижнем регистре:

<config>
    <default>
        <payment>
            <GMO>
                <model>Payment/standard</model>
....
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...