Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. $client = new SoapClient('http://magentohost/api/soap/?wsdl');
  2.  
  3. // If some stuff requires api authentification,
  4. // then get a session token
  5. $session = $client->login('apiUser', 'apiKey');
  6.  
  7. // get attribute set
  8. $attributeSets = $client->call($session, 'product_attribute_set.list');
  9. $attributeSet = current($attributeSets);
  10.  
  11.  
  12. $result = $client->call($session, 'catalog_product.create', array('simple', $attributeSet['set_id'], 'product_sku', array(
  13. 'categories' => array(2),
  14. 'websites' => array(1),
  15. 'name' => 'Product name',
  16. 'description' => 'Product description',
  17. 'short_description' => 'Product short description',
  18. 'weight' => '10',
  19. 'status' => '1',
  20. 'url_key' => 'product-url-key',
  21. 'url_path' => 'product-url-path',
  22. 'visibility' => '4',
  23. 'price' => '100',
  24. 'tax_class_id' => 1,
  25. 'meta_title' => 'Product meta title',
  26. 'meta_keyword' => 'Product meta keyword',
  27. 'meta_description' => 'Product meta description'
  28. )));
  29.  
  30. var_dump ($result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement