Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Descrizione

Questo metodo può essere utilizzato per modificare un gruppo di attributi all'interno del sistema.

Utilizzo

I parametri richiesti da questa funzione sono:

  • attributeGroupId: Id del gruppo di attributi da modificare.
  • attributeGroupName: Array di oggetti che definiscano il nome del gruppo di attributi nelle varie lingue così strutturati:
    • languageId: Id della lingua.
    • value: Nome della categoria nella lingua specificata, lunghezza minima 5 caratteri, massima 100.
  • sortOrder: Numero che rappresenta l'indice di visualizzazione per questo elemento.

 Il metodo non ha nessun valore di ritorno.

Gestione errori

In caso di errore il metodo genererà un'eccezione che riporterà uno dei seguenti codici di errore:

  • ERROR_INVALID_ATTRIBUTE_GROUP_ID: L'id fornito non è valido.
  • ERROR_INVALID_PARAMS: Uno dei parametri inviati non è valido.
  • ERROR_INVALID_TOKEN: Non è stato effettuato nessun login in precedenza o la sessione è scaduta per inutilizzo.
  • ERROR_INVALID_IP: L'indirizzo ip del server che sta effettuando la chiamata non valido perchè non inserito nella whitelist associata alle credenziali.
  • ERROR_SERVER_UNAVAILABLE: Il server non è disponibile o si è verificato un errore di comunicazione generico.

 

Code Block
languagephp
titlePHP
linenumberstrue
require "vendor/autoload.php"
 
try {
    $ezPrintSDK = new ezPrintSDKWrapper('http://demo.ezprint.it');
	$apiToken = $ezPrintSDK->cLoginAPI('1WHm0icsupAEm9fil9en','yCHZ0nKiyn1MU0DhpgmG');
 
	$availableLanguages = $ezPrintSDK->backOffice->bGetAvailableLanguages();
	$productAttributeGroups = $ezPrintSDK->backOffice->bGetProductAttributeGroups(false, $availableLanguages[0]['languageId']);
	$productAttributeGroupName = array();
 
	foreach($availableLanguages as $language) {
        $productAttributeGroupName[] = array(
            'languageId'    => $language['languageId'],
            'value'         => 'Nome ' . $language['languageName']
        );
    }
 
	$ezPrintSDK->backOffice->bEditProductAttributeGroup(productAttributeGroups[0]['attributeGroupId'], $productAttributeGroupName, 0);
} catch (Exception $e) {
    echo 'Error Code: ',  $e->getMessage();
}

Code Block
languagejs
titleNode.js
linenumberstrue
try {
	var util = require('util');
	var ezPrintSDK = require('ezprint-sdk-wrapper');
	ezPrintSDK.initializeWrapper('http://demo.ezprint.it');
 
    var apiToken = ezPrintSDK.cLoginAPI('1WHm0icsupAEm9fil9en','yCHZ0nKiyn1MU0DhpgmG');
 	
	var availableLanguages = ezPrintSDK.backOffice.bGetAvailableLanguages();
	var productAttributeGroups = ezPrintSDK.backOffice.bGetProductAttributeGroups(false, availableLanguages[0].languageId);
    var productAttributeGroupName = [];
 
	availableLanguages.forEach(function(language) {
        productAttributeGroupName.push({
            languageId:     language['languageId'],
            value:          'Nome ' . language['languageName']
        });
    });
	ezPrintSDK.backOffice.bEditProductAttributeGroup(productAttributeGroups[0].attributeGroupId, productAttributeGroupName , 0);
} catch (ex) {
	console.log(ex);
}
Code Block
languagec#
title.NET (C#)
linenumberstrue
try {
	ezPrintSDKWrapper.Client ezPrintSDK = new ezPrintSDKWrapper.Client("http://demo.ezprint.it");
	ezPrintSDK.cLoginAPI("1WHm0icsupAEm9fil9en","yCHZ0nKiyn1MU0DhpgmG");
	
	List<ezPrintSDKWrapper.Structures.languageItem> availableLanguages = ezPrintSDK.BackOffice.bGetAvailableLanguages();
	List<ezPrintSDKWrapper.Structures.productAttributeGroupItem> productAttributeGroups = ezPrintSDK.BackOffice.bGetProductAttributeGroups(false, availableLanguages[0].languageId);
    List<ezPrintSDKWrapper.Structures.localizationItem> productAttributeGroupName = new List<ezPrintSDKWrapper.Structures.localizationItem>();
 
	foreach (ezPrintSDKWrapper.Structures.languageItem language in availableLanguages) {
        productAttributeGroupName.Add(new ezPrintSDKWrapper.Structures.localizationItem() {languageId = language.languageId, value = "Name " + language.languageName});
    }
 
	ezPrintSDK.backOfficeBackOffice.bEditProductAttributeGroup(productAttributeGroups[0].attributeGroupId, productAttributeGroupName , 0);
} catch (ezPrintException ex) {
	string ErrorMessage = ex.Message;
}