Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $proxy = new SoapClient($this->_api_url); // TODO : change url
- $sessionId = $proxy->login($this->_user, $this->_password); // TODO : change login and pwd if necessary
- $pageURL= $this->_page_url;
- $result = $proxy->catalogProductList($sessionId);
- $product_list = array();
- foreach($result as $p)
- {
- $starttime = microtime(true);
- $id = $p->product_id;
- $info = new stdclass();
- $info->attributes = array('sku', 'name', 'description', 'price', 'url_path');
- $product = $proxy->catalogProductInfo($sessionId, $id, NULL, $info);
- $image = $proxy->catalogProductAttributeMediaList($sessionId, $id, NULL, 'ID');
- $endtime = microtime(true);
- $timediff = $endtime - $starttime;
- echo "api calls $timediff <br><br>";
- $name = $product->name;
- $description = $product->description;
- $price = $product->price;
- $formatted_price = number_format($price, 2);
- $image_url = $image[0]->url;
- $product_url = $product->url_path;
- $product_url = $pageURL.$product_url;
- $sku = $product->sku;
- $my_product = new Product();
- $my_product->id = $id;
- $my_product->name = $name;
- $my_product->description = $description;
- $my_product->price = $formatted_price;
- $my_product->image_url = $image_url;
- $my_product->product_url = $product_url;
- $my_product->sku = $sku;
- $product_list[] = $my_product;
- }
- return $product_list;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement