2014-05-20 23 views
1

我在使用Linux上的magento模塊時遇到問題。 它在os x上沒有任何問題。Magento模塊在OS X而不是Linux上工作

這是我模塊的結構

app 
├── code 
│ └── local 
│  └── Vuuh 
│   └── ProductFeed 
│    ├── Block 
│    │ ├── Adminhtml 
│    │ │ └── ProductFeed.php 
│    │ └── Index.php 
│    ├── controllers 
│    │ ├── Adminhtml 
│    │ │ └── AdminController.php 
│    │ └── ProductController.php 
│    ├── etc 
│    │ ├── adminhtml.xml 
│    │ └── config.xml 
│    ├── Helper 
│    │ └── Data.php 
│    ├── Model 
│    │ ├── Resource 
│    │ │ ├── ProductFeed 
│    │ │ │ └── Collection.php 
│    │ │ └── ProductFeed.php 
│    │ └── ProductFeed.php 
│    │ 
│    └── sql 
│     └── vuuh_productfeed_setup 
│      └── install-0.0.1.php 
├── design 
│ └── adminhtml 
│  └── default 
│   └── default 
│    ├── layout 
│    │ └── productfeed.xml 
│    └── template 
│     └── productfeed 
│      └── productfeed.phtml 
└── etc 
    └── modules 
     └── Vuuh_ProductFeed.xml 

這是我​​3210

<?xml version="1.0" encoding="UTF-8"?> 
<config> 

<!-- Module --> 
<modules> 
    <Vuuh_ProductFeed> 
     <version>0.0.1</version> 
    </Vuuh_ProductFeed> 
</modules> 

<!-- Frontend --> 
<frontend> 
    <routers> 
     <vuuh_productfeed> 
      <use>standard</use> 
      <args> 
       <module>Vuuh_ProductFeed</module> 
       <frontName>vuuhproductfeed</frontName> 
      </args> 
     </vuuh_productfeed> 
    </routers> 
</frontend> 

<!-- Admin--> 
<admin> 
    <routers> 
     <Vuuh_ProductFeed> 
      <use>admin</use> 
      <args> 
       <module>Vuuh_ProductFeed</module> 
       <frontName>productfeed</frontName> 
      </args> 
     </Vuuh_ProductFeed> 
    </routers> 
</admin> 

<!-- Adminhtml --> 
<adminhtml> 
    <layout> 
     <updates> 
      <productfeed> 
       <file>productfeed.xml</file> 
      </productfeed> 
     </updates> 
    </layout> 
</adminhtml> 

<!-- Global --> 
<global> 
    <models> 
     <vuuh_productfeed> 
      <class>Vuuh_ProductFeed_Model</class> 
      <resourceModel>vuuh_productfeed_resource</resourceModel> 
     </vuuh_productfeed> 

     <vuuh_productfeed_resource> 
      <class>Vuuh_ProductFeed_Model_Resource</class> 
      <entities> 
       <productfeed> 
        <table>vuuh_productfeed_productfeed</table> 
       </productfeed> 
      </entities> 
     </vuuh_productfeed_resource> 
    </models> 
    <resources> 
     <vuuh_productfeed_setup> 
      <setup> 
       <module>Vuuh_ProductFeed</module> 
       <class>Mage_Core_Model_Resource_Setup</class> 
      </setup> 
      <connection> 
       <use>core_setup</use> 
      </connection> 
     </vuuh_productfeed_setup> 
    </resources> 
    <helpers> 
     <productfeed> 
      <class>Vuuh_ProductFeed_Helper</class> 
     </productfeed> 
    </helpers> 
    <blocks> 
     <productfeed> 
      <class>Vuuh_ProductFeed_Block</class> 
     </productfeed> 
    </blocks> 
</global> 

我研究了一下,發現了該問題可能是因爲情況sensivity的在Linux上。但我在配置中找不到任何錯誤?

Mage :: getModel(「vuuh_productfeed/productfeed」)找不到該類。

$productfeed = Mage::getModel("vuuh_productfeed/productfeed")->getCollection(); 

Fatal error: Call to a member function getCollection() on a non-object in /var/www/magento18/app/design/adminhtml/default/default/template/productfeed/productfeed.phtml 

我已經盯着那個配置好幾個小時了。我找不到錯誤。 模塊加載正常。這只是一個不會加載的類。

回答

4

問題是區分大小寫。 窗口上的文件名不區分大小寫。在UNIX上它們是。
所以叫Mage::getModel("vuuh_productfeed/productfeed")當Magento的查找文件

Vuuh/ProductFeed/Model/Productfeed.php但你的文件名是 Vuuh/ProductFeed/Model/ProductFeed.php

你有2個選擇這裏。
無論是getModel(和createBlock等工廠)的所有呼叫變爲例如

Mage::getModel("vuuh_productfeed/productFeed") 

但是,這種方法是一種耗時。

第二個選項是將文件從ProductFeed.php重命名爲Productfeed.php。您也可以更改這些文件中的類名稱,但這不是必需的,因爲在PHP中,類名稱是區分大小寫的。但只是爲了「政治上正確」,你應該改變它們。

+0

我通過重命名模型文件修復了它:)謝謝! – nkobber

+1

@Razcou不要忘記你有3個這樣的文件。一個模型,一個資源模型和一個塊。 – Marius

相關問題