【问题标题】:magento custom payment module not showing in live site. but showing in development sitemagento 自定义支付模块未显示在实时站点中。但在开发站点中显示
【发布时间】:2012-04-04 14:01:47
【问题描述】:

我正在经历非常奇怪的事情。我在我的开发服务器(Mac Lion)上制作了一个自定义支付模块。一切在开发服务器上运行良好实际上完美。当我将它移动到实时站点时,它在后端/管理以及前端都不可见。

我已经花了几个小时,但无法弄清楚。我可以提前看到模块选项卡并启用。我已经清除了缓存,实际上我也禁用了它。我不确定这里有什么问题。我的开发和实时站点具有相同的 magento 版本 1.5.1。我在这里包含我的代码,所以欢迎提出问题所在。

config.xml

  <global>
    <models>
      <callpayment>
         <class>Bestdirect_CallPayment_Model</class>
      </callpayment>
    </models>
  </global>

 <default>
   <payment>
     <callpayment>
       <active>1</active>
       <model>callpayment/paymentMethod</model>
       <order_status>1</order_status>
       <title>ePayment</title>
       <payment_action>authorize_capture</payment_action>
    </callpayment>
  </payment>
 </default>

 <frontend>
   <routers>
    <callpayment>
        <use>standard</use>
        <args>
        <module>Bestdirect_CallPayment</module>
        <frontName>callpayment</frontName>
        </args>
    </callpayment>
  </routers>
 </frontend>

system.xml

<?xml version="1.0"?>
<config>
  <sections>
    <payment>
      <groups>
       <callpayment translate="label" module="paygate">
          <label>ePayment</label>
          <sort_order>670</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>
                <sort_order>1</sort_order>
                <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>
                <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>Title</label>
               <frontend_type>text</frontend_type>
               <sort_order>2</sort_order>
               <show_in_default>1</show_in_default>
               <show_in_website>1</show_in_website>
               <show_in_store>0</show_in_store>
              </title>
           </fields>
        </callpayment>
      </groups>
     </payment>
   </sections>
  </config>

PaymentMethod.php

  <?php
  require_once 'Bestdirect' . DS . 'Verkkomaksut_Module_Rest.php';

  class Bestdirect_CallPayment_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract
  {
    protected $_code  = 'callpayment';

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

public function capture(Varien_Object $payment, $amount) 
{
    $payment->getOrder()->setCanSendNewEmailFlag(false);
    return parent::capture($payment, $amount);
}

public function getOrderPlaceRedirectUrl()
{
    return Mage::getUrl('callpayment/standard/start', array('_secure' => true));
}

}

【问题讨论】:

  • 我认为这里与答案stackoverflow.com/questions/7926087/…有同样的问题
  • 我只是用头撞核心代码,看看能否找到解决方案。仍然没有答案。
  • 您的代码工作正常。也许您没有复制所有文件?这里没有来自 /app/etc/modules/*.xml 的文件
  • 模块注册文件在etc/modules中。我可以在配置/高级中看到模块
  • 可能是文件夹结构错误?此代码工作正常(设置在支付模块下的管理员中可用)。

标签: php xml magento-1.5 magento


【解决方案1】:

乍一看,我的第一个问题是确定您的生产 PHP include_path 设置是否知道在哪里寻找 Bestdirect 库。 require_once 语句将使用该路径,如果找不到库则失败。由于您可能禁用了display_errors,因此该故障可能会在您的生产服务器上保持沉默。

【讨论】:

  • 我实际上尝试删除 require_once 并删除任何内容。我只留下了模型名称和受保护的 $_code 但同样的事情。
  • 你能澄清一下吗?删除require_once 可能会使问题变得更糟,因为Verkkomaksut_Module_Rest.php 不会加载。将完整路径添加到 Bestdirect 库或修改您的 PHP include_path 设置以指向该路径。我怀疑这会导致您面临的问题。
  • 也许我应该澄清一下。我删除了需要一次和任何需要 Verkkomaksut_Module_Rest.php 的功能。实际上我只是用模型类创建了一个简单的支付模块。它适用于开发站点而不是实时站点。
【解决方案2】:

我知道这是一个老问题,但这可以帮助某人。这可能是大写/小写的错字。 Zero Cool 的模块名称是 Bestdirect_CallPayment,如果在 app/etc/Bestdirect_CallPayment.xml 上以不同的大写/小写组合键入模块名称(例如 Bestdirect_Callpayment),它将在 Mac 上工作,但在 Linux 上不工作。那是因为文件系统处理大写/小写的方式。希望对您有所帮助!

【讨论】:

    猜你喜欢
    • 2012-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多