使用SOAP API V2和C#获取Magento版本 [英] Getting Magento Version Using SOAP API V2 and C#

查看:114
本文介绍了使用SOAP API V2和C#获取Magento版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我构建了一个工具,可以将销售订单从Magento导入到自定义应用程序中.函数salesOrderList()在客户的Magento Go商店中运行良好.然后,它在另一个客户的商店上失败了.原因是前者商店的版本为1.6.x,后者商店的版本为1.5.x.函数调用在两个版本上返回了两个不同的数据结构(尽管是相同的API版本,即SOAP API V2),从而导致了问题.因此,我对工具进行了自定义,以期首先期望1.6.x数据结构,然后在前者失败的情况下回落至1.5.x.现在,我们有了一个新客户,该客户似乎具有Magento 1.7版.对于相同的功能(salesOrderList()),数据结构似乎在1.7中再次更改.

Background: I have built a tool that imports sales orders from Magento to a custom application. The function salesOrderList() worked fine on a customer's Magento Go store. Then it failed on another customer's store. The reason was the former store was version 1.6.x and the latter was 1.5.x. The function call returned two different data structures on the two versions (despite being the same API version, namely SOAP API V2), causing the problem. So I customized the tool to expect the 1.6.x data structure first and then fall back to 1.5.x if the former failed. Now, we have a new customer who seems to have Magento version 1.7. The data structure seems to have changed again in 1.7 for the same function (salesOrderList()).

编程使用 :. NET(C#); Magento SOAP API V2

Programmed Using: .NET (C#); Magento SOAP API V2

问题:是否有函数调用来确定我们要连接的商店的Magento(1.5、1.6等)版本?我从另一篇文章中了解到,有一个MAGE :: getVersion()调用在PHP中直接在商店上使用(没有SOAP API).使用SOAP API时是否有等效的.NET?

Question: Is there a function call to determine the Magento (1.5, 1.6, etc.) version of the store we are connecting to? I understand from another post that there is a MAGE::getVersion() call that they use in PHP, directly on the store (without SOAP API). Is there a .NET equivalent for this when using the SOAP API?

PS :我已经发布了与 user1236916 相同的问题(虽然有点琐碎),因为我暂时丢失了该帐户的登录信息.我为这次重复道歉.

PS: I had posted the same question (a little less wordy though) as user1236916 because I had temporarily lost the login information for this account. My apologies for the repetition.

谢谢!

推荐答案

已知Magento核心API在默认情况下提供的调用中非常有限.没有任何电话可以立即返回Magento版本.

The Magento core API is known to be very limited in the calls it provides by default. There is no call that returns the Magento version out of the box.

有关Magento核心API的更多信息,请访问 Magento官方网站.

More infomation on the Magento core API can be found on the official Magento site.

话虽这么说,Magento API旨在进行扩展,但这样做并不太困难.您将需要创建一个扩展核心API资源之一的Magento模块(您将需要在PHP中执行此操作,并有权访问Magento安装本身).

That being said the Magento API is designed to be extended and to do so is not overly difficult. You will need to create a Magento module that extends one of the core API resources (you will need to do this in PHP and have access to the Magento installation itself).

有关如何扩展V2 Magento的更多信息,请参见这篇文章. API.

See this post for more information on how to extend the V2 Magento API.

在您的扩展API类中,简单地创建一个类似如下的函数:

In your extended API class simple create a function like so:

public function getVersion()
{
    // static method to return the Magento version within the app
    return Mage::getVersion();
}

这篇关于使用SOAP API V2和C#获取Magento版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆