我正在尝试从我的magento商店检索所有客户,但只检查那些在其帐户中激活简报订阅的客户。
问题:我无法弄清楚如何过滤这个属性(“时事通讯”,有吗?)。
我得到了:
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');
$params = array(
'sessionId' => $session_id,
'filters' => null
);
$allCustomers = $proxy->customerCustomerList($params);
这将返回所有客户。 有任何想法如何通过简报订阅过滤这个?
答案 0 :(得分:4)
新闻稿订阅存储是一个单独的模块。 Mage_Newsletter
。
此模块似乎没有任何API覆盖范围,但是如果您在newsletter_subscriber
数据库表中快速达到峰值,您将看到同时也是客户的订户具有与之相关的外键。
我可能会考虑向Mage_Customer
添加一个保存订阅状态的属性,向subscribe添加观察者并取消订阅事件以更新它。
然后,我会将此属性添加到Mage_Customer
API中,以便在抓取客户时可以通过它进行过滤。
有关订阅活动的观察员:https://stackoverflow.com/a/12991195/2205881和Adding a custom field to Magento's subscription module
扩展v2 API:http://inchoo.net/ecommerce/magento/magento-api-v2/