Objectif
Le XML fournisseur contient plusieurs entrepôts dans un offer : warehouse/stock pour nord et sud. L’import a besoin d’un total unique stock_total.
Réponse courte
Créez d’abord un nouveau noeud enfant stock_total dans offer, puis ouvrez ses paramètres et ajoutez une règle de somme sur {/catalog/offers/offer/warehouse/stock}. Eofferix additionnera tous les stock de l’article courant.
Comment le faire dans Eofferix
Dans la structure XML, créez un nouveau noeud enfant
stock_totaldans l’offerrépété.Ouvrez les paramètres de la valeur.

L’animation montre le champ qui reçoit le stock total. Ajoutez une règle : condition
Toute valeur, actionSomme des valeurs, source{/catalog/offers/offer/warehouse/stock}.
La règle additionne les stocks d’entrepôt de l’article courant.
Avant / après
Avant
données source<catalog>
<offers>
<offer id="2001">
<sku>SKU-2001</sku>
<name>Lampe Elodie</name>
<warehouse code="north">
<stock>4</stock>
</warehouse>
<warehouse code="south">
<stock>8</stock>
</warehouse>
</offer>
<offer id="2002">
<sku>SKU-2002</sku>
<name>Fauteuil Martin</name>
<warehouse code="north">
<stock>0</stock>
</warehouse>
<warehouse code="south">
<stock>3</stock>
</warehouse>
</offer>
</offers>
</catalog>Après
résultat<catalog>
<offers>
<offer id="2001">
<sku>SKU-2001</sku>
<name>Lampe Elodie</name>
<warehouse code="north">
<stock>4</stock>
</warehouse>
<warehouse code="south">
<stock>8</stock>
</warehouse>
<stock_total>12</stock_total>
</offer>
<offer id="2002">
<sku>SKU-2002</sku>
<name>Fauteuil Martin</name>
<warehouse code="north">
<stock>0</stock>
</warehouse>
<warehouse code="south">
<stock>3</stock>
</warehouse>
<stock_total>3</stock_total>
</offer>
</offers>
</catalog>