Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "username";
  4. $password = "mypasswrd";
  5. $dbname = "dbname";
  6. $conn = new mysqli($servername, $username, $password, $dbname);
  7. $client = new SoapClient('myurl');
  8. $session = $client->login('usr', 'pswrd');
  9. // get attribute set
  10. $attributeSets = $client->call($session, 'product_attribute_set.list');
  11. $attributeSet = current($attributeSets);
  12. $query="select * from stock";
  13. $resultt=mysqli_query($conn,$query);
  14. if($resultt->num_rows > 0)
  15. {
  16.  
  17. while($row=mysqli_fetch_assoc($resultt))
  18. {
  19. $name=$row['stock_name'];
  20. $result = $client->call($session, 'catalog_product.create', array('simple', $attributeSet['set_id'], rand(), array(
  21. 'categories' => array(2),
  22. 'websites' => array(1),
  23. 'name' => $name,
  24. 'description' => 'Nyc one',
  25. 'short_description' => 'nyc tt',
  26. 'weight' => '10',
  27. 'status' => '1',
  28. 'url_key' => 'product-url-key',
  29. 'url_path' => 'product-url-path',
  30. 'visibility' => '4',
  31. 'price' => '1000',
  32. 'tax_class_id' => 1,
  33. 'meta_title' => 'Product meta title',
  34. 'meta_keyword' => 'Product meta keyword',
  35. 'meta_description' => 'Product meta description'
  36. )));
  37. }
  38. }
  39. else
  40. {
  41. echo "fail";
  42.  
  43. }
  44. var_dump ($result);
  45. $conn->close();
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement