平面商品目录数据打开时,如何从magento EAV表中进行选择 [英] How to select from magento EAV tables when flat catalog product data is on

查看:91
本文介绍了平面商品目录数据打开时,如何从magento EAV表中进行选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码可以从Magento中选择最畅销的产品:

I have this code for selecting best selling products from Magento:

$productCollection = Mage::getResourceModel('reports/product_collection')
            ->addOrderedQty($startTime, $currentTime)
            ->addAttributeToSelect('*')
            ->setStoreId($storeId)
            ->addStoreFilter($storeId)
            ->setOrder('ordered_qty', 'desc')
            ->setPageSize($this->limit());
    }

,并且工作正常,直到我将后端的使用平面目录产品"设置为是"为止. 有什么方法可以告诉magento不要使用平面餐桌,而是使用EAV?
有人可以帮我吗?

and it works fine, until I set "use flat catalog product" in backend to yes. Is there any way to tell magento to not use flat tables, and use EAV instead?
Can any one help me with this.

推荐答案

创建一个新的模型类('mycatalog/product'),以扩展原始产品类,但对其进行硬编码以使用EAV资源模型和EAV资源集合,然后使用该模型在您的查询代码中进行建模.

Create a new model class ('mycatalog/product') that extends the original product class but hard code it to use the EAV resource model and EAV resource collection, and then use that model in your query code.

这篇关于平面商品目录数据打开时,如何从magento EAV表中进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆