2
Magento 1.8 SOAP APIv2에서 SOAP API에서 정보를 검색하는 데 날짜 범위를 가져 오는 방법을 찾고 있습니다. 예 : Combined complex filter for ranges과 같은 stackoverflow 자체에서 쿼리를 문의했습니다. 내 노드 프로젝트에 같은 유형의 복잡한 필터를 적용해야합니다. 는 Curently 젠토 노드 래퍼 즉에게 https://github.com/MadisonReed/magentoapiNodejs의 범위를위한 복잡한 복합 필터
exports.find = function (req, res) {
async.waterfall([
function (done) {
magento.login(function(err, sessId) {
if (err) {
// deal with error
console.log('login error:' + err);
return;
}
done(err, done);
// http://localhost/api/rest/customers
});
},
function (filteredCustomer, done) {
var attributes = [];
var filteredCustomer = [];
magento.customer.list({filters: [ ]},function(err, customerCollection) {
_.forEach(customerCollection, function(customer, key) {
var attributes = _.pick(customer, [
'customer_id',
'created_at',
'updated_at',
'firstname',
'lastname',
'gender',
'credit_value',
'customer_referral_code',
]);
var customerDocument = {
'email': customer.email,
'number': customer.contact_no,
'created_at': Date.now(),
'initialSource': 'magento',
'attributes': attributes
};
filteredCustomer.push(customerDocument);
});
done(filteredCustomer);
});
},
function (filteredCustomer, done) {
console.log(filteredCustomer);
if(!err){
done(filteredCustomer);
}
}
],
function (err) {
if (err) {
console.log(err);
}
});
};
출력을 사용 :
[
{
email: '[email protected]',
number: '1313543132',
created_at: 1478785224233,
initialSource: 'magento',
attributes:
{ customer_id: '1',
created_at: '2016-03-10 04:39:16',
updated_at: '2016-10-03 10:09:21',
firstname: 'rohit',
lastname: 'Rai',
gender: '1',
credit_value: '0.0000',
customer_referral_code: 'dS518'
}
},
{
email: '[email protected]',
number: '9088694978',
created_at: 1478785224233,
initialSource: 'magento',
attributes:
{
customer_id: '2',
created_at: '2016-04-10 23:52:05',
updated_at: '2016-11-04 05:22:09',
firstname: 'rajveer',
gender: '1',
credit_value: '0.0000',
customer_referral_code: 'Cw624'
}
},
{
email: '[email protected]',
number: '1321321231',
created_at: 1478785224233,
initialSource: 'magento',
attributes:
{
customer_id: '3',
created_at: '2016-07-11 05:00:55',
updated_at: '2016-11-07 10:03:54',
firstname: 'rohit',
gender: '1',
credit_value: '0.0000',
customer_referral_code: 'aj318'
}
}
]