简体   繁体   English

自定义集合magento中的寻呼机错误

[英]Pager error in custom collection magento

I have an array populated with some objects that are not from magento. 我有一个数组填充了一些不是来自magento的对象。 I have fetched them from 3rd party software and I am showing them in magento grid. 我从第三方软件中取出它们,我在magento网格中显示它们。 The grid population is complete. 网格填充完整。 But when I try to add a pager to its collection, it throws an exception. 但是当我尝试在其集合中添加一个寻呼机时,它会抛出一个异常。 here is the exception text 这是异常文本

Magento错误

I have seen on some articles that there is a difference between magento collection and an ordinary array in php. 我在一些文章中看到magento集合和php中的普通数组之间存在差异。 I am new to magento so I require help in it. 我是magento的新手,所以我需要帮助。 I have also tried to convert it to magento collection as proposed in 我也尝试将其转换为magento collection,如同提议的那样

Convert an array to a collection 将数组转换为集合

but its not working either.Any help would be highly appreciated. 但它也没有用。任何帮助都将受到高度赞赏。

Regards 问候

Please try below code. 请尝试下面的代码。

protected $collection;
public $collection1;
public $rowObj;
protected function _construct()
{
$currentPage = (empty($_REQUEST['p'])) ? 1 : $_REQUEST['p'];
$setLimit = (empty($_REQUEST['limit'])) ? 9 : $_REQUEST['limit'];
$collection1 = new Varien_Data_Collection(); 
$rowObj = new Varien_Object();
 $this->collection = array_merge($this->getPreviousLead(), $this->getLeadsData()); 
$this->collection = array_merge($this->collection, $this->getContactsData());
 $this->collection = array_merge($this->collection, $this->getUpdateLeads()); 
$this->collection->setPage($currentPage, $setLimit);
$rowObj->setData($this->collection); 

$collection1->addItem($rowObj); 

}

Hope this will work for you! 希望这对你有用!

Cheers! 干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM