Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. <?php
  2.  
  3. #error_reporting(E_ALL | E_STRICT);
  4. #ini_set('display_errors', 1);
  5.  
  6. $apiUser = "wyomind";
  7. $apiKey = "wyomind8906";
  8. $host = "http://magento.wyomind.com/";
  9.  
  10. $client = new SoapClient($host . "api/?wsdl");
  11.  
  12. $sessionID = $client->login($apiUser, $apiKey);
  13.  
  14. $product_id = __YOUR_PRODUCT_ID__;
  15. $status = true;
  16. $warehouse_id = __YOUR_WAREHOUSE_ID__;
  17. $data = array(
  18. "quantity_in_stock" => 999,
  19. "manage_stock" => 1,
  20. "backorder_allowed" => 2,
  21. "use_config_setting_for_backorders" => 0
  22. );
  23.  
  24. $context = "Custom context";
  25. $action = "Custom action";
  26. $reference = "Custom reference";
  27. $details = "Details";
  28.  
  29. echo "<pre>";
  30.  
  31. /* * ********************************* INSERT A ROW INTO THE JOURNAL *********************************** */
  32. $warehouse_id=551;
  33. $date_from=date("2011-m-d 00:00:00");
  34.  
  35. $result = $client->call($sessionID, 'advancedinventory.fetchorder', array($warehouse_id,$date_from));
  36. if ($result) {
  37. print_r($result);
  38. echo "> Orders fetched";
  39. }
  40.  
  41.  
  42. /* * ************************************************************************************************** */
  43.  
  44. /* * ********************************* ENABLE/DISABLE MULTISOCK *************************************** */
  45.  
  46. $result = $client->call($sessionID, 'advancedinventory.setMultistock', array($product_id, $status));
  47. if ($result) {
  48. echo "> Multistock enabled for ProductId $product_id <br>";
  49. }
  50.  
  51. /* * ************************************************************************************************** */
  52.  
  53. /* * ********************************* GET ALL WAREHOUSES ********************************************* */
  54. $result = $client->call($sessionID, 'advancedinventory.getWh');
  55. if ($result) {
  56. echo "> Available warehouse :" . print_r($result, true) . "<br>";
  57. }
  58. /* * ************************************************************************************************** */
  59.  
  60.  
  61. /* * ********************************* GET STOCK DATA BY PRODUCT ID AND WAREHOUSE ID ******************* */
  62.  
  63.  
  64. $result = $client->call($sessionID, 'advancedinventory.getData', array($product_id, $warehouse_id));
  65. if ($result) {
  66. echo "> Stock data for ProductId $product_id in Warehouse $warehouse_id : " . print_r($result, true) . "<br>";
  67. }
  68. /* * ************************************************************************************************** */
  69.  
  70. /* * ********************************* SET WAREHOUSE DATA BY PRODUCT ID AND WAREHOUSE ID ************** */
  71.  
  72.  
  73. $result = $client->call($sessionID, 'advancedinventory.setData', array($product_id, $warehouse_id, $data));
  74. if ($result) {
  75. echo "> Stock Updated for ProductId $product_id in Warehouse $warehouse_id<br>";
  76. }
  77. /* * ************************************************************************************************** */
  78.  
  79. /* * ********************************* INSERT A ROW INTO THE JOURNAL *********************************** */
  80. $result = $client->call($sessionID, 'advancedinventory.writejournal', array($context, $action, $reference, $details));
  81. if ($result) {
  82. echo "> Journal updated";
  83. }
  84. /* * ************************************************************************************************** */
  85. echo "</pre>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement