加入在magento中显示错误

时间:2017-01-03 09:13:08

标签: magento magento-1.9

我正在尝试加入magento中的市场产品表和产品集合表。但我没有得到输出。这是我的代码

 $showcaseproducts1       =   $showcaseCat->getProductCollection()
                                ->addAttributeToSelect('*')

                                ->addFieldToFilter('showcase',array('eq' => 1))
                                ->addFieldToFilter('status',array('eq' => 1))
                                ->setOrder('price', 'DESC')->setPageSize(15)
                                ->setCurPage(1);
    $showcaseproducts1     = $showcaseproducts1->getSelect()->joinLeft(array('mp' => $showcaseproducts1->getTable('marketplace_product')), "mp.mageproductid  =e.entity_id", array('*'));
    $showcaseproducts1->addFieldToFilter('mp.userid',array(array('eq' => 163)));

1 个答案:

答案 0 :(得分:1)

 $showcaseproducts1 = Mage::getResourceModel('catalog/product_collection')
        ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
        ->addFieldToFilter('showcase',array('eq' => 1))
        ->addFieldToFilter('status',array('eq' => 1))
        ->setPageSize(6);

    $showcaseproducts1->getSelect()
        ->joinLeft(
            array('mp' => $showcaseproducts1->getResource()->getTable('marketplace_product')),
            "e.entity_id=mp.mageproductid"
        )
        ->where('mp.userid=163');

试试这段代码。