我已将我的Magento从1.4升级到1.6
我还安装了一个畅销书扩展程序,它在1.4上工作正常,并且在1.6的新实例上工作正常。但我的问题是它不适用于我从1.4升级到1.6的那个
我的代码就像
$products = Mage::getResourceModel('reports/product_collection')
->addOrderedQty()
->addAttributeToSelect('*')
// ->addAttributeToSelect(array('id', 'price', 'small_image', 'short_description'))
->setStoreId($storeId)
->addStoreFilter($storeId)
->setPageSize(4)
->setCurPage(1)
->setOrder('ordered_qty', 'desc')->load(true);
我保留 - > load(true)来检查查询,而查询是
SELECT SUM(order_items.qty_ordered) AS `ordered_qty`, `order_items`.`name` AS `order_items_name`, `order_items`.`product_id` AS `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`, `e`.`name`, `e`.`price`, `e`.`small_image`, `e`.`short_description` FROM `tp_sales_flat_order_item` AS `order_items` INNER JOIN `tp_sales_flat_order` AS `order` ON `order`.entity_id = order_items.order_id AND `order`.state <> 'cancelled' LEFT JOIN `tp_catalog_product_entity` AS `e` ON (e.type_id NOT IN ('grouped', 'configurable', 'bundle')) AND e.entity_id = order_items.product_id AND e.entity_type_id = 4 WHERE (parent_item_id IS NULL) GROUP BY `order_items`.`product_id` HAVING (SUM(order_items.qty_ordered) > 0) ORDER BY `ordered_qty` desc LIMIT 4
我发现它将addAttributeToSelect字段添加到查询列表中,这会导致错误。
虽然1.6的新实例的相同步骤不包括查询中的那些字段,但它只是在集合中添加这些字段。
非常感谢任何帮助。
由于