2012-04-04 43 views
0

顯示我遇到很奇怪的事情。我在我的開發服務器(Mac Lion)上製作了一個自定義付款模塊。在開發服務器上,一切都非常完美。當我將它移動到活動站點時,它在後端/管理員以及前端都不可見。magento自定義付款模塊沒有顯示在現場。但在開發網站

我花了幾個小時,但無法弄清楚。我可以預先查看模塊選項卡並啓用。我清除了緩存實際上我也禁用了它。我不確定這裏有什麼問題。我的開發和現場網站具有相同的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)); 
} 

}

+0

我覺得這裏同樣的問題與答案 http://stackoverflow.com/questions/7926087/magento-module-works-well-on-localhost-but-not-on-live-server/ – 2012-04-04 16:50:44

+0

我只是把我的頭撞向核心代碼,看看我能否找到解決方案。仍然沒有答案。 – 2012-04-04 22:19:44

+0

你的代碼工作正常。也許你沒有複製過所有文件?這裏是/app/etc/modules/*.xml中沒有文件。 – 2012-04-05 05:17:10

回答

0

一覽我的第一個問題是要確定您的生產PHP include_path設定是否知道到哪裏查找Bestdirect庫。 require_once語句將使用該路徑,如果找不到該庫,則會失敗。由於您可能禁用了display_errors,因此這種故障可能會在您的生產服務器上保持沉默。

+0

我實際上嘗試刪除require_once並刪除任何東西。我只留下了模型的名稱和保護$ _code但同樣的事情。 – 2012-04-04 14:29:45

+0

你能澄清嗎?刪除'require_once'可能會使問題變得更糟,因爲Verkkomaksut_Module_Rest.php不會加載。或者在「Bestdirect」庫的前面添加完整路徑,或者修改PHP的include_path設置以指向該路徑。我懷疑這是導致你面臨的問題。 – Jason 2012-04-04 14:55:16

+0

也許我應該澄清。我刪除了需要一次以及任何需要Verkkomaksut_Module_Rest.php的函數。其實我只是創建了一個只有模型類的簡單支付模塊。它適用於dev站點,而不是在現場。 – 2012-04-04 15:01:26

-2

我知道這是一個老問題,但這可以幫助某人。這可能是大寫/小寫的拼寫錯誤。 Zero Cool的模塊名稱是Bestdirect_CallPayment,如果在app/etc/Bestdirect_CallPayment.xml上,模塊名稱是在不同的大寫/小寫字母組合(例如Bestdirect_Callpayment)上鍵入的,它將在Mac上工作,但不在Linux上。這是因爲文件系統處理大寫/小寫的方式。希望能幫助到你!