使用data.php助手类从不同页面筛选不同的数据
我在Data.php(Helper类)中的sales\u flat\u order\u payment表中加入了“method”列。像这样:使用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'); 我的问题是有两个页面带有搜索过滤器:一个页面用于货到
$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'));
}
有人能给我一个建议吗