C# Magento-按订单增量id列出的salesOrderShipmentList

C# Magento-按订单增量id列出的salesOrderShipmentList,c#,api,magento,C#,Api,Magento,我需要能够通过销售订单增量id检索销售订单的销售订单装运。 根据Magento的最终指南,我被允许在方法的筛选器中将order_increment_id用作键,但是当我这样做时,我会收到一个错误,说明该键不受支持 以下是我正在使用的代码: // Construct filter. var filters = new filters(); var filterOrderId = new complexFilter { key = "order_increment_id",

我需要能够通过销售订单增量id检索销售订单的销售订单装运。 根据Magento的最终指南,我被允许在方法的筛选器中将order_increment_id用作键,但是当我这样做时,我会收到一个错误,说明该键不受支持

以下是我正在使用的代码:

  // Construct filter.
  var filters = new filters();
  var filterOrderId = new complexFilter
  {
    key = "order_increment_id",
    value = new associativeEntity() { key = "eq", value = orderIcrementId.ToString() }        
  };

  filters.complex_filter = new[] { filterOrderId };
  var shipments = apiService.salesOrderShipmentList(sSessionId, filters);
错误消息:

{“SQLSTATE[42S22]:未找到列:“where子句”中的1054未知列“order_increment_id”}

我可以很好地使用其他过滤器(order_id、created_at等),但我确实需要能够使用Magento API中的salesOrderShipmentList,通过order_increment_id返回sales_order_发货

如果您需要任何其他信息,请询问。

我已经5年没有做过C了,但您需要做的是不要将
filterOrderId
设置为
复杂的\u过滤器

这是代码的PHP等价物:

这会产生相同的错误。 下面是一个有效的PHP调用,请尝试在C#中重现该数据结构:

这很有效。您可以进一步简化
过滤器或删除
,但这不是问题的原因。

EDIT:在PHP中起作用的还有将
filterOrderId
直接传递给
salesOrderShipmentList()
调用。

我已经5年没有做过C了,但是你需要做的是不要把
filterOrderId
设置为
complex\u过滤器

这是代码的PHP等价物:

这会产生相同的错误。 下面是一个有效的PHP调用,请尝试在C#中重现该数据结构:

这很有效。您可以进一步简化
过滤器或删除
,但这不是问题的原因。

EDIT:在PHP中起作用的还有将
filterOrderId
直接传递给
salesOrderShipmentList()
调用。


您使用哪个magento版本?在my CE 1.6中,尚未实现按订单字段(订单id除外)过滤发货、贷记单、发票等。如果查看
Mage\u Sales\u Model\u Resource\u Collection\u Abstract
中的方法
joinAttribute()
,它是所有装运、贷记单等集合的父类-您将看到:

/**
 * Backward compatibility with EAV collection
 *
 * @todo implement join functionality if necessary
 *
 * @param string $alias
 * @param string $attribute
 * @param string $bind
 * @param string $filter
 * @param string $joinType
 * @param int $storeId
 * @return Mage_Sales_Model_Resource_Collection_Abstract
 */
public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinType = 'inner', $storeId = null)
{
    return $this;
}

不过我不知道,也许在最新的CE1.6.2版本中,它已经被修复。

您使用哪个magento版本?在my CE 1.6中,尚未实现按订单字段(订单id除外)过滤发货、贷记单、发票等。如果查看
Mage\u Sales\u Model\u Resource\u Collection\u Abstract
中的方法
joinAttribute()
,它是所有装运、贷记单等集合的父类-您将看到:

/**
 * Backward compatibility with EAV collection
 *
 * @todo implement join functionality if necessary
 *
 * @param string $alias
 * @param string $attribute
 * @param string $bind
 * @param string $filter
 * @param string $joinType
 * @param int $storeId
 * @return Mage_Sales_Model_Resource_Collection_Abstract
 */
public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinType = 'inner', $storeId = null)
{
    return $this;
}

不过我不知道,也许在最新的CE1.6.2版本中,它已经被修复。

您的攻击是错误的。您正在尝试按订单增量id查找装运,但该值不可用。您的可用值为“订单id”。你必须用这个

使用订单的增量id查找订单id,然后根据该id筛选装运

private void GetShipments()
    {
        // Create the filter array
        filters theFilters = new filters();

        // get the order's id from its incrementId
        salesOrderEntity theOrder = this.mageObject.MageService.salesOrderInfo(this.mageObject.MageSessionId, this.Session["orderID"] as string);

        // Create the "C#" version of the associative array using a generic list
        List<associativeEntity> theEntities = new List<associativeEntity>
            {
                new associativeEntity { key = "order_id", value = theOrder.order_id } 
            };

        // Make the generic list back into an array
        theFilters.filter = theEntities.ToArray();

        // Here are your sales orders
        salesOrderShipmentEntity[] x =
            this.mageObject.MageService.salesOrderShipmentList(this.mageObject.MageSessionId, theFilters);
private void getshippings()
{
//创建过滤器阵列
过滤器过滤器=新过滤器();
//从订单的增量id中获取订单的id
salesOrderEntity theOrder=this.mageObject.MageService.salesOrderInfo(this.mageObject.MageSessionId,this.Session[“orderID”]为字符串);
//使用通用列表创建关联数组的“C#”版本
列出实体=新列表
{
新关联实体{key=“order\u id”,value=theOrder.order\u id}
};
//将泛型列表返回到数组中
filters.filter=theEntities.ToArray();
//这是你们的销售订单
salesOrderShipmentEntity[]x=
this.mageObject.MageService.salesOrderShipmentList(this.mageObject.MageSessionId,过滤器);

你找错了。你试图按订单增量id查找装运,但该值不可用。可用值为“订单id”。你必须使用此值

使用订单的增量id查找订单id,然后根据该id筛选装运

private void GetShipments()
    {
        // Create the filter array
        filters theFilters = new filters();

        // get the order's id from its incrementId
        salesOrderEntity theOrder = this.mageObject.MageService.salesOrderInfo(this.mageObject.MageSessionId, this.Session["orderID"] as string);

        // Create the "C#" version of the associative array using a generic list
        List<associativeEntity> theEntities = new List<associativeEntity>
            {
                new associativeEntity { key = "order_id", value = theOrder.order_id } 
            };

        // Make the generic list back into an array
        theFilters.filter = theEntities.ToArray();

        // Here are your sales orders
        salesOrderShipmentEntity[] x =
            this.mageObject.MageService.salesOrderShipmentList(this.mageObject.MageSessionId, theFilters);
private void getshippings()
{
//创建过滤器阵列
过滤器过滤器=新过滤器();
//从订单的增量id中获取订单的id
salesOrderEntity theOrder=this.mageObject.MageService.salesOrderInfo(this.mageObject.MageSessionId,this.Session[“orderID”]为字符串);
//使用通用列表创建关联数组的“C#”版本
列出实体=新列表
{
新关联实体{key=“order\u id”,value=theOrder.order\u id}
};
//将泛型列表返回到数组中
filters.filter=theEntities.ToArray();
//这是你们的销售订单
salesOrderShipmentEntity[]x=
this.mageObject.MageService.salesOrderShipmentList(this.mageObject.MageSessionId,过滤器);
/***与EAV集合的向后兼容性**@todo 如有必要,实施连接功能

我认为这是一个严重的错误在magento

不会发出任何警告?? 所谓的向后兼容性在哪里

依赖此功能的旧扩展无法正常工作,并且可能会悄无声息地发生

/***与EAV集合的向后兼容性**@todo 如有必要,实施连接功能

我认为这是一个严重的错误在magento

不会发出任何警告?? 所谓的向后兼容性在哪里


依赖此功能的旧扩展无法正常工作,并且可能会无声地发生这种情况

您使用的是哪个版本的Magento?1.6.1版社区版。您使用的是哪个版本的Magento?1.6.1版社区版。Tha
/**
 * Backward compatibility with EAV collection
 *
 * @todo implement join functionality if necessary
 *
 * @param string $alias
 * @param string $attribute
 * @param string $bind
 * @param string $filter
 * @param string $joinType
 * @param int $storeId
 * @return Mage_Sales_Model_Resource_Collection_Abstract
 */
public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinType = 'inner', $storeId = null)
{
    return $this;
}
private void GetShipments()
    {
        // Create the filter array
        filters theFilters = new filters();

        // get the order's id from its incrementId
        salesOrderEntity theOrder = this.mageObject.MageService.salesOrderInfo(this.mageObject.MageSessionId, this.Session["orderID"] as string);

        // Create the "C#" version of the associative array using a generic list
        List<associativeEntity> theEntities = new List<associativeEntity>
            {
                new associativeEntity { key = "order_id", value = theOrder.order_id } 
            };

        // Make the generic list back into an array
        theFilters.filter = theEntities.ToArray();

        // Here are your sales orders
        salesOrderShipmentEntity[] x =
            this.mageObject.MageService.salesOrderShipmentList(this.mageObject.MageSessionId, theFilters);