【发布时间】:2014-02-18 16:09:55
【问题描述】:
在 Magento 1.8 中将使用平面目录产品设置为是时出现错误。我的一个模块似乎与此功能不兼容。看到以下错误:
a:5:{i:0;s:1852:"SELECT SUM(order_items.qty_ordered) AS
ordered_qty,order_items.nameASorder_items_name,order_items.product_id如entity_id,e.entity_type_id,e.attribute_set_id,e.type_id,e.sku,e.has_options,e.required_options,e.created_at,e.updated_at,flat.name,flat.imageASsmall_image,flat.price,flat.minimal_price,flat.special_price,flat.special_from_date,flat.special_to_date,cat_index.positionAScat_index_position,at_inventory_in_stock.is_in_stockASinventory_in_stockFROMsales_flat_order_itemASorder_items内连接sales_flat_orderASorderONorder.entity_id = order_items.order_id ANDorder.state '取消' AND (order.created_at BETWEEN '2014-01-18' AND '2014-02-17') 左加入catalog_product_entityASeON (e.type_id NOT IN ('grouped', 'configurable', 'bundle')) AND e.entity_id = order_items.product_id AND e.entity_type_id = 4 左连接catalog_product_flat_1ASflatON (e.entity_id = flat.entity_id) 内连接catalog_category_product_indexAScat_index开启 cat_index.product_id=e.entity_id AND cat_index.store_id='1' AND cat_index.visibility IN(2, 4) AND cat_index.category_id = '2' INNER 加入cataloginventory_stock_itemASat_inventory_in_stockON (at_inventory_in_stock.product_id=e.entity_id) 和 ((at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=1 和 at_inventory_in_stock.is_in_stock=1) 或 (at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=0) 或 (at_inventory_in_stock.use_config_manage_stock = 1 AND at_inventory_in_stock.is_in_stock=1)) WHERE (parent_item_id IS NULL) 分组order_items.product_id有 (SUM(order_items.qty_ordered) > 0) ORDER BYordered_qtydesc,ordered_qtydesc LIMIT 1";i:1;s:4869:"#0 /home2/icast.sajtpro.se/www/mxfoto/magento/includes/src/Varien_Db_Statement_Pdo_Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
在 list.phtml 文件中,我有以下代码:
class Tatva_Catalogextensions_Block_Bestsellers_List extends Mage_Catalog_Block_Product_List {
protected function _getProductCollection()
{
parent::__construct();
$storeId = Mage::app()->getStore()->getId();
$products = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*') ->addOrderedQty()
->setStoreId($storeId)
->addStoreFilter($storeId)
//->setOrder('ordered_qty', 'desc')
->setPageSize($this->get_prod_count())
->setOrder($this->get_order(), $this->get_order_dir())
->setCurPage($this->get_cur_page());
$productFlatData = Mage::getStoreConfig('catalog/frontend/flat_catalog_product'); if($productFlatData == "1") { $products->getSelect()->joinLeft(
array('flat' => 'catalog_product_flat_1'),
"(e.entity_id = flat.entity_id ) ",
array(
'flat.name AS name','flat.image AS small_image','flat.price AS price','flat.minimal_price as minimal_price','flat.special_price as special_price','flat.special_from_date AS special_from_date','flat.special_to_date AS special_to_date'
)
); }
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
$this->_productCollection = $products;
return $this->_productCollection;
}
function get_prod_count() { //unset any saved limits
Mage::getSingleton('catalog/session')->unsLimitPage();
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9; }// get_prod_count
function get_cur_page() { return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1; }// get_cur_page
function get_order() { return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'ordered_qty'; }// get_order
function get_order_dir() { return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc'; }// get_direction }
?>
有人可以帮帮我吗?
【问题讨论】:
标签: magento