在magento中,使用我在http://www.magentocommerce.com/boards/viewthread/43238/找到的脚本以编程方式重建平面产品目录后,每当我尝试更新产品属性时,我都会收到错误exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.display_price_group_0' in 'field list''
。
更奇怪的是,我检查了Magento的其他安装,表catalog_product_flat_1
中似乎没有列“display_price_group_0”......
是否有人暗示发生了什么?以编程方式重建平面目录的正确方法是什么?非常感谢你!
<?php
// Carico l'enviroment dell'istallazione di Magento per sfruttare i suoi Model
require_once('..'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'Mage.php');
Mage::app();
// Inizializzo il file di log
$logFileName = 'clear_cache.log';
Mage::log("Inizio pulizia cache",null,$logFileName);
try {
Mage::getSingleton('catalog/url')->refreshRewrites();
Mage::log("[INFO] Catalog rewrites e' stato aggiornato con successo",null,$logFileName);
} catch (Exception $e) {
Mage::log("[ERRORE] " . $e,null,$logFileName);
}
try {
Mage::getSingleton('catalog/index')->rebuild();
Mage::log("Catalog Index e' stato aggiornato con successo",null,$logFileName);
} catch (Exception $e) {
Mage::log("[ERRORE] " . $e,null,$logFileName);
}
try {
$flag = Mage::getModel('catalogindex/catalog_index_flag')->loadSelf();
if ($flag->getState() == Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_RUNNING){
$kill = Mage::getModel('catalogindex/catalog_index_kill_flag')->loadSelf();
$kill->setFlagData($flag->getFlagData())->save();
}
$flag->setState(Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_QUEUED)->save();
Mage::getSingleton('catalogindex/indexer')->plainReindex();
Mage::log("[INFO] Layered Navigation Indices e' stato aggiornato con successo",null,$logFileName);
} catch (Exception $e) {
Mage::log("[ERRORE] " . $e,null,$logFileName);
}
try {
Mage::getModel('catalog/product_image')->clearCache();
Mage::log("[INFO] Image cache e' stato aggiornato con successo",null,$logFileName);
} catch (Exception $e) {
Mage::log("[ERRORE] " . $e,null,$logFileName);
}
try {
Mage::getSingleton('catalogsearch/fulltext')->rebuildIndex();
Mage::log("[INFO] Search Index e' stato aggiornato con successo",null,$logFileName);
} catch (Exception $e) {
Mage::log("[ERRORE] " . $e,null,$logFileName);
}
try {
Mage::getSingleton('cataloginventory/stock_status')->rebuild();
Mage::log("[INFO] CatalogInventory Stock Status e' stato aggiornato con successo",null,$logFileName);
} catch (Exception $e) {
Mage::log("[ERRORE] " . $e,null,$logFileName);
}
try {
Mage::getResourceModel('catalog/category_flat')->rebuild();
Mage::log("[INFO] Flat Catalog Category e' stato aggiornato con successo",null,$logFileName);
} catch (Exception $e) {
Mage::log("[ERRORE] " . $e,null,$logFileName);
}
try {
Mage::getResourceModel('catalog/product_flat_indexer')->rebuild();
Mage::log("[INFO] Flat Catalog Product e' stato aggiornato con successo",null,$logFileName);
} catch (Exception $e) {
Mage::log("[ERRORE] " . $e,null,$logFileName);
}
Mage::log("Fine pulizia cache",null,$logFileName);
?>