Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
magento中自定义集合的分页问题_Magento_Collections - Fatal编程技术网

magento中自定义集合的分页问题

magento中自定义集合的分页问题,magento,collections,Magento,Collections,我已经创建了自定义块来从多个类别检索产品。我已将此块扩展到核心产品列表块。寻呼机在自定义集合上不工作,你知道寻呼机为什么不工作吗? 我正在collection.php中使用此函数 public function addCategoriesFilter($categories) { $alias = 'cat_index'; $categoryCondition = $this->getConnection()->quoteInto( $alias.'

我已经创建了自定义块来从多个类别检索产品。我已将此块扩展到核心产品列表块。寻呼机在自定义集合上不工作,你知道寻呼机为什么不工作吗? 我正在collection.php中使用此函数

public function addCategoriesFilter($categories)
    {

    $alias = 'cat_index';
    $categoryCondition = $this->getConnection()->quoteInto(
    $alias.'.product_id=e.entity_id AND '.$alias.'.store_id=? AND ',
    $this->getStoreId()
    );

    $categoryCondition.= $alias.'.category_id IN ('.$categories.')';
    $this->getSelect()->group('e.entity_id');
    $this->getSelect()->joinInner(
    array($alias => $this->getTable('catalog/category_product_index')),
    $categoryCondition,
    array('position'=>'position')
    );

    $this->_categoryIndexJoined = true;
    $this->_joinFields['position'] = array('table'=>$alias, 'field'=>'position' );

    return $this;

}

这需要添加到您试图加载产品的xml块中,以便它获得工具栏和寻呼机

请参阅此链接作为参考。

这需要添加到您试图加载产品的xml块中,以便它获得工具栏和寻呼机

请参阅此链接作为参考。

在探索了许多小时并阅读了几乎所有关于定制收藏分页的论坛之后,我找到了一种显示定制收藏页面分页的方法

我需要为我的页面显示工具栏,该工具栏将显示具有糖尿病价值的产品(糖尿病是自定义属性)

首先我们需要过滤phtml文件上的集合:

$_productCollection = Mage::getModel('catalog/product')->setStoreId($storeId)getCollection()->addAttributeToFilter("diabetic",1);

/* populate toolbar collection with your collection */
$toolbar = Mage::getBlockSingleton('catalog/product_list')->getToolbarBlock();
$toolbar->setCollection($_productCollection);
echo $toolbar->toHtml();

在探索了许多小时,阅读了几乎所有关于定制集合分页的论坛之后,我找到了一种显示定制集合页面分页的方法

我需要为我的页面显示工具栏,该工具栏将显示具有糖尿病价值的产品(糖尿病是自定义属性)

首先我们需要过滤phtml文件上的集合:

$_productCollection = Mage::getModel('catalog/product')->setStoreId($storeId)getCollection()->addAttributeToFilter("diabetic",1);

/* populate toolbar collection with your collection */
$toolbar = Mage::getBlockSingleton('catalog/product_list')->getToolbarBlock();
$toolbar->setCollection($_productCollection);
echo $toolbar->toHtml();

我想你说的是Mage_目录、Block_产品列表。您扩展并可能重写了_getProductCollection()。但是您在哪里添加了$yourCollection->addCategoriesFilter()?你能展示这段代码吗?我想你说的是Mage\u目录\块\产品\列表。您扩展并可能重写了_getProductCollection()。但是您在哪里添加了$yourCollection->addCategoriesFilter()?你能给我看一下这段代码吗?你的回答帮助我实现了分页。。我忘了用您的集合填充工具栏集合…:)你的回答帮助我实现了分页。。我忘了用您的集合填充工具栏集合…:)