Advertisement
Guest User

Untitled

a guest
Jul 11th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. $proxy = new SoapClient($this->_api_url); // TODO : change url
  2. $sessionId = $proxy->login($this->_user, $this->_password); // TODO : change login and pwd if necessary
  3. $pageURL= $this->_page_url;
  4. $result = $proxy->catalogProductList($sessionId);
  5.  
  6. $product_list = array();
  7.  
  8. foreach($result as $p)
  9. {
  10. $starttime = microtime(true);
  11.  
  12. $id = $p->product_id;
  13. $info = new stdclass();
  14. $info->attributes = array('sku', 'name', 'description', 'price', 'url_path');
  15. $product = $proxy->catalogProductInfo($sessionId, $id, NULL, $info);
  16. $image = $proxy->catalogProductAttributeMediaList($sessionId, $id, NULL, 'ID');
  17.  
  18. $endtime = microtime(true);
  19. $timediff = $endtime - $starttime;
  20.  
  21. echo "api calls $timediff <br><br>";
  22.  
  23. $name = $product->name;
  24. $description = $product->description;
  25. $price = $product->price;
  26. $formatted_price = number_format($price, 2);
  27. $image_url = $image[0]->url;
  28. $product_url = $product->url_path;
  29. $product_url = $pageURL.$product_url;
  30. $sku = $product->sku;
  31.  
  32. $my_product = new Product();
  33. $my_product->id = $id;
  34. $my_product->name = $name;
  35. $my_product->description = $description;
  36. $my_product->price = $formatted_price;
  37. $my_product->image_url = $image_url;
  38. $my_product->product_url = $product_url;
  39. $my_product->sku = $sku;
  40. $product_list[] = $my_product;
  41. }
  42.  
  43. return $product_list;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement