Php 如何发送sql以使用magento寻呼机
我已经创建了一个新的数据库来提供自定义订单列表 我用SQL代码PS$SQL给出数据库显示是多行的Php 如何发送sql以使用magento寻呼机,php,magento,mysqli,limit,pager,Php,Magento,Mysqli,Limit,Pager,我已经创建了一个新的数据库来提供自定义订单列表 我用SQL代码PS$SQL给出数据库显示是多行的 $sql = select * from database_name WHERE customfilter like $customfilter limit $startfrom, $limit $result = mysqli_query($cn,$sql) $collection = mysqli_fetch_array($result) 我不知道该编辑哪个代码。我试图编辑
$sql = select * from database_name WHERE customfilter like $customfilter limit $startfrom, $limit
$result = mysqli_query($cn,$sql)
$collection = mysqli_fetch_array($result)
我不知道该编辑哪个代码。我试图编辑产品页面上的代码以用于此页面,但它给出了错误
谁能建议我编辑哪种代码来使用寻呼机
下面是我尝试的代码
$this->getCollection($collection);
$pager = $this->getLayout()->createBlock('page/html_pager', 'ordercustom.pager')
->setCollection($this->getCollection());
$this->setChild('pager', $pager);
return $this;
但它显示错误。请查看以下产品集合代码并设置页面大小限制
$collection = Mage::getModel ('catalog/product')
->getCollection() -
->addAttributeToSelect('*')
->setPageSize($this->getRequest()->getParam("limit"))
->load();
请采用上面的客户收集页面大小,并让我知道
$collection = Mage::getModel ('customorder/index')
->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('customer_code', $customercode)
->addAttributeToFilter('shipping', array('eq' => $shipping))
->setPageSize($this->getRequest()->getParam("limit"))
->load();
$this->setCollection($collection);
它显示致命错误:对非对象调用成员函数getCollection()
PS
customorder/index位于my customorder.xml中
<block type="customorder/index" name="customorder" template="customorder/index.phtml"/>
我这个页面的类是class Custom_Customorder_Block_Index extensed Mage_Core_Block_Template{我想你错过了该模型的集合类。请从
parent::__construct();
$collection = Mage::getModel ('ordercustom/index')
->getCollection() -
->addAttributeToSelect('*')
->addAttributeToFilter('customer_code', array('eq' => $customercode))
->addAttributeToFilter('shipping', array('eq' => $shipping))
->setPageSize($this->getRequest()->getParam("limit"))
->load();
$this->setCollection($collection);
}
protected function _prepareLayout()
{
parent::_prepareLayout();
$pager = $this->getLayout()->createBlock('page/html_pager', 'customorder.pager');
$pager->setAvailableLimit(array(5=>5,10=>10,20=>20,'all'=>'all'));
$pager->setCollection($this->getCollection());
$this->setChild('pager', $pager);
$this->getCollection()->load();
return $this;
}
public function getPagerHtml()
{
return $this->getChildHtml('pager');
}