whoami7 - Manager
:
/
data
/
vhosts
/
pruebas
/
www
/
alta_colores
/
Upload File:
files >> /data/vhosts/pruebas/www/alta_colores/index.php
<?php // Definiciones define('API_URL', 'https://pyc.ncdesarrollos.com/rest/V1/'); define('API_USER', 'roberto'); define('API_PASS', '1156Magento'); // Obtener el token de acceso $ch = curl_init(API_URL . 'integration/admin/token'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array('username' => API_USER, 'password' => API_PASS))); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $token = json_decode(curl_exec($ch)); curl_close($ch); // Declaro el array $marcas = array("EN-1335, EN-1022 Y EN-1728","GS, Quality FEMB (level 3)","UNE EN 1335","UNE EN 12520 EN16139","UNE EN 1022; EN 13761; EN 15373; EN 1728; EN 16139","GS. UNE-EN-1335. NPR 1813. FEM B","EN13761, EN1728, EN1022, EN15373","EN-1335","KGS. Clase 4","Sin certificado","GS","-","UNE EN 1022; EN 16139; EN 1728","EN 1335, EN 1022","UNE EN 16139 EN 1022","EN-1335. Certificado GS. Certificado Q. Greenguard. BIFMA","UN EN 1335","EN 16139; EN 1728; UNE EN 1022","UNE EN 1022; UNE EN 1335","UNE EN 16139","EN-1021; EN-1335; EN-1022; EN-16139; EN-1728","UNE EN 12520","UNE EN 1022; EN 13761; EN 15373; EN 1728","GS-SIGN de ??Intertek, ISO 9001-2008, ISO 14001-2009"); // Creo cada uno de los colores como opción del atributo color en Magento foreach($marcas as $marca){ $ch = curl_init(API_URL . 'products/attributes/certificado/options'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . $token)); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array('option' => array('label' => $marca)))); curl_exec($ch); curl_close($ch); } ?>
Copyright ©2021 || Defacer Indonesia