Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.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
使用data.php助手类从不同页面筛选不同的数据_Php_Magento - Fatal编程技术网

使用data.php助手类从不同页面筛选不同的数据

使用data.php助手类从不同页面筛选不同的数据,php,magento,Php,Magento,我在Data.php(Helper类)中的sales\u flat\u order\u payment表中加入了“method”列。像这样: $collection = Mage::getModel('sales/order_shipment')->getCollection(); $collection->join('sales/order_payment', 'order_id=parent_id' , 'method'); 我的问题是有两个页面带有搜索过滤器:一个页面用于货到

我在Data.php(Helper类)中的sales\u flat\u order\u payment表中加入了“method”列。像这样:

$collection = Mage::getModel('sales/order_shipment')->getCollection();
$collection->join('sales/order_payment', 'order_id=parent_id' , 'method');
我的问题是有两个页面带有搜索过滤器:一个页面用于货到付款,另一个页面用于预付款

我想为不同的页面过滤不同的数据。像对于现金交付页面一样,我想从Data.php中过滤此内容:

$collection->addAttributeToFilter('method', array('eq' => 'cashondelivery'));
对于预付费页面,我想从Data.php中过滤这个

$collection->addAttributeToFilter('method', array('eq' => 'prepaid'));
我试图从相同的页面进行筛选,但存在分页问题,因此我使用Data.php

我还尝试了当前页面的url代码,但也失败了:

$currentUrl = Mage::helper('core/url')->getCurrentUrl();
$url = Mage::getSingleton('core/url')->parseUrl($currentUrl);
$currentpath = $url->getPath();

$linkpath = array('/cashdelivery/', 'cashdelivery/');
if(in_array($currentpath, $linkpath))
{
$collection->addAttributeToFilter('method', array('eq' => 'cashondelivery'));

}
有人能给我一个建议吗