Magento 产品平面数据错误-PHP致命错误:对非对象调用成员函数reindexAll()
我在MySQL中遇到行限制问题,因为Magento安装中的属性太多,所以我编写了一个扩展,扩展了“Mage\u Catalog\u Model\u Resource\u Product\u Flat\u Indexer”类,使用以下代码将字符限制重写为64Magento 产品平面数据错误-PHP致命错误:对非对象调用成员函数reindexAll(),magento,indexing,Magento,Indexing,我在MySQL中遇到行限制问题,因为Magento安装中的属性太多,所以我编写了一个扩展,扩展了“Mage\u Catalog\u Model\u Resource\u Product\u Flat\u Indexer”类,使用以下代码将字符限制重写为64 protected function _MySQLCharLimit() { if (!$this->_isFlatTableExists($store)) { $sql = "CREATE TABLE {$t
protected function _MySQLCharLimit()
{
if (!$this->_isFlatTableExists($store)) {
$sql = "CREATE TABLE {$tableNameQuote} (n";
foreach ( $columns as $field => $fieldProp ) {
if ( $fieldProp['type'] == "varchar(255)" )
$fieldProp['type'] = "varchar(64)";
$sql .= sprintf( " %s,n",
$this->_sqlColunmDefinition( $field, $fieldProp ) );
}
foreach ($addIndexes as $indexName => $indexProp) {
$sql .= sprintf(' ADD %s,',
$this->_sqlIndexDefinition( $indexName, $indexProp ) );
}
$sql = rtrim($sql, ",");
$sql = str_replace( "varchar(255)","varchar(64)",$sql );
$this->_getWriteAdapter()->query( $sql );
}
}
我从这里得到的
在尝试重新编制索引后,我注意到它将我发送到一个空白页,当我单击“返回”时,“产品平面数据”索引在处理过程中被卡住
我通过SSH从“shell”文件夹运行indexer.php,它报告了以下错误:
PHP致命错误:在第296行Mage/Catalog/Model/Product/Flat/Indexer.PHP中的非对象上调用成员函数reindexAll()
有没有人知道哪里出了问题,或者我如何纠正?谢谢
编辑:完整代码
<?php
class GDModules_MySQLCharLimit_Catalog_Model_Resource_Product_Flat_Indexer extends Mage_Catalog_Model_Resource_Product_Flat_Indexer
{
public function mySQLCharLimit()
{
if (!$this->_isFlatTableExists($store)) {
$sql = "CREATE TABLE {$tableNameQuote} (n";
foreach ( $columns as $field => $fieldProp ) {
if ( $fieldProp['type'] == "varchar(255)" )
$fieldProp['type'] = "varchar(64)";
$sql .= sprintf( " %s,n",
$this->_sqlColunmDefinition( $field, $fieldProp ) );
}
foreach ($addIndexes as $indexName => $indexProp) {
$sql .= sprintf(' ADD %s,',
$this->_sqlIndexDefinition( $indexName, $indexProp ) );
}
$sql = rtrim($sql, ",");
$sql = str_replace( "varchar(255)","varchar(64)",$sql );
$this->_getWriteAdapter()->query( $sql );
}
}
}
0.0.1
GDModules\u MySQLCharLimit\u Catalog\u Model\u Resource\u Product\u Flat\u Indexer
config.xml中的重写配置错误。Magento无法实例化它需要的资源模型。啊,好吧,我应该怎么做?使用这个GDModules\u MySQLCharLimit\u Catalog\u model\u resource\u Product\u Flat\u Indexer作为初学者,我想看看是否可以直接实例化资源模型类$foo=新GDModules\u MySQLCharLimit\u Catalog\u Model\u Resource\u Product\u Flat\u Indexer;变量转储(获取类($foo));最常见的情况是,该类位于错误的目录和/或类名中有输入错误。我不确定是否是这样,因为即使我禁用并删除扩展名,它仍然存在错误。
<?xml version="1.0" encoding="UTF-8"?>
<!-- The root node for Magento module configuration -->
<config>
<!--
The module's node contains basic
information about each Magento module
-->
<modules>
<!--
This must exactly match the namespace and module's folder
names, with directory separators replaced by underscores
-->
<GDModules_MySQLCharLimit>
<!-- The version of our module, starting at 0.0.1 -->
<version>0.0.1</version>
</GDModules_MySQLCharLimit>
</modules>
<!-- Configure our module's behaviour in the global scope -->
<global>
<!-- Defining models -->
<models>
<catalog_resource>
<rewrite>
<product_flat_indexer>GDModules_MySQLCharLimit_Catalog_Model_Resource_Product_Flat_Indexer</product_flat_indexer>
</rewrite>
</catalog_resource>
</models>
</global>
</config>