Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2.  
  3. //cd wp-content\plugins\business-ru-sync-product > text: all_sync.php
  4.  
  5. $_SERVER["REMOTE_ADDR"] = '127.0.0.1';
  6.  
  7. $base = dirname(__DIR__);
  8.  
  9. include_once dirname(dirname($base))."/wp-load.php";
  10.  
  11. include_once plugin_dir_path( __FILE__ ) . 'sync.php';
  12.  
  13. /**
  14. * Синхронизация всех продуктов
  15. *
  16. */
  17. function all_sync()
  18. {
  19. $products = wc_get_products(['limit'=>-1]);
  20.  
  21. $sync_product = new SyncBusinessRu();
  22.  
  23. foreach ($products as $product ){
  24. if($product->get_type() == "simple"){
  25. if($sync_product->sync_api_product($product)){
  26. update_field("sync_business_ru", 1, $product->get_id() ); //синхронизируем sync_business_ru
  27. }
  28. }
  29. }
  30. }
  31.  
  32. all_sync();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement