gpt4 book ai didi

linux - Magento 模块适用于 OS X 而不是 Linux

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:37:55 26 4
gpt4 key购买 nike

我在让我的 magento 模块在 Linux 上运行时遇到问题。它在 os x 上没有任何问题。

这是我的模块结构

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

这是我的config.xml

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

我研究了一下,发现问题可能是因为 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

我已经盯着那个配置看了好几个小时了。我找不到错误。该模块加载正常。只有一个类不会加载。

最佳答案

问题是区分大小写。Windows 上的文件名不区分大小写。在 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 中区分大小写。但只是为了“政治正确”,你应该改变它们。

关于linux - Magento 模块适用于 OS X 而不是 Linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23762520/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com