My storefront captures order and item data via python, and my output data is sent using XML... I use a for loop to iterate an ItemPart section for each item in the order, but I need to pass a value of 01, 02, 03 inside the "itemnum" node. I know I can get the '0 prefix' with zfill, but I'm not sure how to create a variable that I can use in the the XML. My current variables from the ordering session come through as shown in the "qtyOrdered" node.
<ItemParts>
@for item in items
<ItemPart>
<itemnum></itemnum>
<qtyOrdered>%(q(item.qty))s</qtyOrdered>
</ItemPart>
@end for
</ItemParts>
I know this won't do the trick, but this is the general idea:
for k in range(1,10):
k.zfill(1);
No comments:
Post a Comment