Z
Z
z23122015-07-29 15:12:01
JavaScript
z2312, 2015-07-29 15:12:01

How to pass argument (productData ) to method (catalogProductCreate)?

I look in the book I see "fig"

var MagentoAPI = require('magento');
var magento = new MagentoAPI({
  host: 'your.host',
  port: 80,
  path: '/api/xmlrpc/',
  login: 'your_username',
  pass: 'your_pass'
});

magento.login(function(err, sessId) {
  if (err) {
    // deal with error
    return;
  }
// Параметры товара
var productData = {
    name: 'Товар',
    categories: 'Категория',
    description: 'Описание',
    short_description: 'Короткое описание',
    visibility: 4,
    weight: 10,
    status: 1,
    price: 100,
    tax_class_id: 1 
}
// Создаем товар 
magento.catalogProduct.create({
  type: 'simple',
  set:  1,
  sku:  333,
  data: '01.11.01',   
}, function (a) {console.log( a)} );

});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Petrov, 2015-07-29
@z2312

the data parameter is the same, only you are using it incorrectly

// Создаем товар 
magento.catalogProduct.create({
  type: 'simple',
  set:  1,
  sku:  333,
  data: productData,   
}, function (a) {console.log( a)} );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question