【问题标题】:Magento: how to filter order list by shipping method?Magento:如何按运输方式过滤订单列表?
【发布时间】:2011-05-11 13:34:06
【问题描述】:

我尝试使用通过某种运输方式(例如 TNT)运输的订单创建自定义网格。这是一个应该是过滤器的方法:

protected function _prepareCollection()
{
    $collection = Mage::getResourceModel($this->_getCollectionClass());
    $this->setCollection($collection);
    return parent::_prepareCollection();
}

我将使用 addFieldToFilter() 之类的方法,但我不知道字段名称。你能帮帮我吗?

【问题讨论】:

    标签: php magento shipping


    【解决方案1】:

    “shipping_method”或“shipping_description”怎么样。 此字段来自“sales_flat_order”

    【讨论】:

    • 谢谢!解决方法是: $collection->getSelect()->join('sales_flat_order', 'main_table.entity_id=sales_flat_order.entity_id', array('sales_flat_order'=>'shipping_method'), null, 'left'); $collection->addAttributeToFilter('shipping_method', '***');
    • 或者更好的解决方案: $collection->getSelect()->join('sales_flat_order', 'shipping_method="***" AND main_table.entity_id=sales_flat_order.entity_id', false, null, '内部');
    【解决方案2】:

    我创建了this extension,它允许您通过运输和付款方式过滤管理订单网格。试试看:)

    【讨论】:

    • 酷,这是一个非常有用的扩展,不管我当前的问题已经解决了,我都会使用它;)谢谢。
    • 您的扩展在 1.7.0.2 中不工作。你能说出可以在 1.7.0.2 上运行的免费扩展吗
    猜你喜欢
    • 2013-02-21
    • 1970-01-01
    • 2015-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-14
    • 2016-10-14
    相关资源
    最近更新 更多