</file>'; $response = insales_api_client('POST', '/admin/files.xml', $productWallpaperXml, 'xml'); // var_dump($response); $productWallpaperUrl = strval($response->{'absolute-url'}); $productNameXml = '<?xml version="1.0" encoding="UTF-8"?> <product> <id type="integer">' . $productId . '</id> <title>' . $productName . ' №' . $productId . '</title> </product>'; $response = insales_api_client('PUT', '/admin/products/' . $productId . '.xml', $productNameXml, 'xml'); $productFieldXml = '<?xml version="1.0" encoding="UTF-8"?> <product-field-value> <product-field-id>' . $productWallpaperId . '</product-field-id> <value>' . $productWallpaperUrl . '</value> </product-field-value>'; $response = insales_api_client('POST', '/admin/products/' . $productId . '/product_field_values.xml', $productFieldXml, 'xml'); // var_dump($productFieldXml); // var_dump($response); exit(); $productInStoreLink = $inSalesStoreDomain . $productCollectionUrl . '/product/' . $productLink; $colorsArray = array(); foreach ($colors as $colorName => $color) { $colorsArray[] = $colorName . ': ' . $color; } $message = '<p>Заказ №' . $productId . '</p>'; $message .= '<p>' . $productName . '</p>'; $message .= '<p>' . 'Стоимость: ' . $productPrice . ' р.' . '</p>'; $message .= '<p>' . 'Цвет: ' . implode(', ', $colorsArray) . '</p>'; $message .= '<p>' . 'Ссылка на товар: <a href="' . $productInStoreLink . '">' . $productInStoreLink . '</a></p>'; $subject = 'Заказ №' . $productId . ' - ' . $productName; $result = sendEmails($qStickerEmails, $qStickerEmailFrom, $subject, $message, $files); if ($result) {
$files = array(); $imagesData = $_POST['images']; foreach ($imagesData as $imageName => $imageData) { $files[$imageName] = parseImage($imageData, $imageName); } if (ENVIRONMENT == 'testing') { sendEmails($testingEmails, '*****@*****.**', 'Test editor', 'Test editor', $files); exit; } if (ENVIRONMENT == 'production') { // data:image/jpeg;base64, // data:image/png;base64, // var_dump($_POST); $productId = $_POST['data']['productId']; $colors = $_POST['data']['colors']; $insales_api = insales_api_client($inSalesDomain, $inSalesApiKey, $inSalesApiPassword); $productAdditionalOptions = isset($_POST['data']['optionsIds']) ? $_POST['data']['optionsIds'] : array(); $productCategoryId = 1297378; $productCollectionId = 2099066; $productCollectionUrl = '/collection/tovary-iz-rendera'; $productWallpaperId = 2813; // $productCategoryId = 1580223; // $productCollectionId = 2100348; // $productCollectionUrl = '/collection/puhoviki'; // $productWallpaperId = 2813; try { // $response = $insales_api('GET', '/admin/product_fields.json'); // var_dump($response); // // $categories = $insales_api('GET', '/admin/categories.json'); // var_dump($categories);