我有一个正在使用catalog_product_entity
的magento安装,而其他人在查询期间使用catalog_product_flat_1
来检索产品集合。
为什么会这样?
答案 0 :(得分:3)
您可以配置Magento是否对集合使用平面表或实体。在Use Flat Catalog Product
下的Magento管理部分中查看System->Config->Catalog: Frontend
。更改此设置时会刷新Magento缓存存储,因为管理员配置已缓存。索引失效也可能在这里发挥作用,我不确定Magento是否在最新时使用平台。
Buttle Butkus报告可能需要将其切换为No
并再次返回Yes
以激活它。
如果要在管理区域中加载集合,则不使用平面表。
这是在Mage_Catalog_Model_Resource_Product_Collection::_construct()
:
/**
* Initialize resources
*
*/
protected function _construct()
{
if ($this->isEnabledFlat()) {
$this->_init('catalog/product', 'catalog/product_flat');
}
else {
$this->_init('catalog/product');
}
$this->_initTables();
}
/**
* Retrieve is flat enabled flag
* Return alvays false if magento run admin
*
* @return bool
*/
public function isEnabledFlat()
{
if (Mage::app()->getStore()->isAdmin()) {
return false;
}
if (!isset($this->_flatEnabled[$this->getStoreId()])) {
$this->_flatEnabled[$this->getStoreId()] = $this->getFlatHelper()
->isEnabled($this->getStoreId());
}
return $this->_flatEnabled[$this->getStoreId()];
}