Skip to content

Commit 27e050e

Browse files
committed
Ürün bilgileri güncelleme eklendi.
1 parent 3bb6bb8 commit 27e050e

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

IS/PazarYeri/Trendyol/Helper/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function getApiUrl($requestData)
210210
}
211211

212212
$apiUrl = str_replace('{supplierId}', $this->apiSupplierId, $apiUrl);
213-
if ($this->method == 'POST' || !is_array($requestData) || count($requestData) <= 0) {
213+
if ($this->method == 'POST' || $this->method == 'PUT' || !is_array($requestData) || count($requestData) <= 0) {
214214
return $apiUrl;
215215
}
216216

@@ -248,7 +248,7 @@ public function getResponse($query, $data, $authorization = true)
248248
$header[] = 'Authorization: Basic ' . $this->authorization();
249249
}
250250

251-
if ($this->method == 'POST') {
251+
if ($this->method == 'POST' || $this->method == 'PUT') {
252252
$header[] = 'Content-Type: application/json';
253253
curl_setopt($ch, CURLOPT_POST, 1);
254254
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData));

IS/PazarYeri/Trendyol/Services/ProductService.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,45 @@ public function createProducts($data = array())
9393
return $this->getResponse($query, $data);
9494
}
9595

96+
/**
97+
* Ürün bilgilerini güncellemek için kullanılır. (Fiyat ve stok güncellemek için updatePriceAndInventory fonksiyonu kullanılmalıdır)
98+
*
99+
*
100+
* @param array $data
101+
* @return array
102+
* @throws TrendyolException
103+
*/
104+
public function updateProducts($data = array())
105+
{
106+
$this->setApiUrl('https://api.trendyol.com/sapigw/suppliers/{supplierId}/v2/products');
107+
$this->setMethod("PUT");
108+
$query = array(
109+
'items'=> array(
110+
'barcode' => '',
111+
'title' => '',
112+
'productMainId' => '',
113+
'brandId' => '',
114+
'categoryId' => '',
115+
'quantity' => '',
116+
'stockCode' => '',
117+
'dimensionalWeight' => '',
118+
'description' => '',
119+
'currencyType' => '',
120+
'listPrice' => '',
121+
'salePrice' => '',
122+
'cargoCompanyId' => '',
123+
'deliveryDuration' => '',
124+
'images' => '',
125+
'vatRate' => '',
126+
'shipmentAddressId' => '',
127+
'returningAddressId' => '',
128+
'attributes' => ''
129+
),
130+
);
131+
132+
return $this->getResponse($query, $data);
133+
}
134+
96135
/**
97136
* Trendyol'a aktarılan ve onaylanan ürünlerin fiyat ve stok bilgileri eş zamana yakın güncellenir. Stok ve fiyat bligilerini istek içerisinde ayrı ayrı gönderebilirsiniz.
98137
*

0 commit comments

Comments
 (0)