我正在使用 this code使用 Magento 的 API 为我的 Rails 应用程序。除了一件事,一切都很好,我需要通过 Magento API 的参数过滤产品,但我不知道如何:(
显然我已经测试了更多的解决方案(数组、散列等),但是 不成功。
Pd:对不起,我的英文很有限
链接
最佳答案
我知道这已经很晚了,但是如果其他人找到了这个线程,我已经创建了一个 magento_api_wrapper gem,它为 Magento SOAP API v2 实现了过滤器。您可以在此处找到代码:https://github.com/harrisjb/magento_api_wrapper
总而言之,如果您想使用一种 Magento SOAP API 简单过滤器,您可以传递一个带有键和值的散列:
api = MagentoApiWrapper::Catalog.new(magento_url: "yourmagentostore.com/index.php", magento_username: "soap_api_username", magento_api_key: "userkey123")
api.product_list(simple_filters: [{key: "status", value: "processing"}, {key: created_at, value: "12/10/2013 12:00" }])
要使用复杂的过滤器,传递一个带有键、运算符和值的散列:
api.product_list(complex_filters: [{key: "status", operator: "eq", value: ["processing", "completed"]}, {key: created_at, operator: "from", value: "12/10/2013" }])
关于ruby-on-rails-3 - 使用 Savon gem (SOAP) 在 Ruby on Rails 中使用 API Magento 过滤产品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8049732/