Php 收集空magento

Php 收集空magento,php,magento,Php,Magento,您好,我的集合不是在运行本地计算机的数据库中填充的,而是在非生产环境中填充的。 运行时,生成的SQL值通常显示在银行中,但不会填充集合。你能帮我吗 public function __construct() { parent::__construct(); $userid = Mage::getSingleton('customer/session')->getCustomer()->getId(); $post = $this->getRequest

您好,我的集合不是在运行本地计算机的数据库中填充的,而是在非生产环境中填充的。 运行时,生成的SQL值通常显示在银行中,但不会填充集合。你能帮我吗

public function __construct() {
    parent::__construct();

    $userid = Mage::getSingleton('customer/session')->getCustomer()->getId();
    $post = $this->getRequest()->getPost();
    $rowdata=array();

    $querydata = Mage::getModel('stock/product')->getCollection()
        ->addFieldToFilter('userid', array('eq' => $userid))
        ->addFieldToFilter('status', array('neq' => 2))
        ->setOrder('stockproductid');

    foreach ($querydata as  $value) {
        $qty = (int)Mage::getModel('cataloginventory/stock_item')
            ->loadByProduct($value->getStockproductid())->getQty();
        if($qty) {
            $rowdata[] = $value->getStockproductid();
        }
    }

    $collection = Mage::getModel('catalog/product')->getCollection();
    $collection->addAttributeToSelect('*');
    $collection->addAttributeToFilter('entity_id', array('in' => $rowdata));
    $collection->addAttributeToSort('name', 'ASC');

    //filter with search content
    if(!empty($post)) {
        $collection->addAttributeToFilter(array(array('attribute'=>'name', 'like'=>'%'.$post['searchfr'].'%')));
    }

    $this->setCollection($collection);
}

您是否启用了平面目录?
我的猜测是尝试对您的生产环境重新编制索引

我已经重新定义了,但没有任何变化。请,有人能帮我吗?