Inline ShoppingCart Example
This example is fully self-contained. It declares a ShoppingCart (with the default tax groups - for the Netherlands), adds a few products and renders a ShoppingCart Xml output.
Smartsite SXML | Copy Code |
---|---|
<se:text save="mycontent"> {char.lt()}mycontent> {char.lt()}extradata /> {char.lt()}/mycontent> </se:text> <se:shoppingcart storeid="TestStore" resultformat="{html.prettyprint(this.result())}" > {this.add('t1', 14.80, 'high')} {this.add('t2', 55.20, 'low')} {this.add('t3', 563.0, 'zero')} {this.add('t4', 14.80, 'high', 2, 'myname', $mycontent, 'mydescription', 'mycategory')} </se:shoppingcart> |
Example Result | Copy Code |
---|---|
<?xml version="1.0"?> <shoppingcart id="Cart"> <userid>guest</userid> <storeid>TestStore</storeid> <intax>0</intax> <taxgroups> <taxgroup name="zero"> <percentage>0</percentage> </taxgroup> <taxgroup name="low"> <percentage>6</percentage> </taxgroup> <taxgroup name="high"> <percentage>19</percentage> </taxgroup> </taxgroups> <products> <product> <code>t1</code> <name> </name> <description> </description> <numberof>1</numberof> <content /> <category> </category> <price>14.80</price> <taxgroup>high</taxgroup> </product> <product> <code>t2</code> <name> </name> <description> </description> <numberof>1</numberof> <content /> <category> </category> <price>55.20</price> <taxgroup>low</taxgroup> </product> <product> <code>t3</code> <name> </name> <description> </description> <numberof>1</numberof> <content /> <category> </category> <price>563.00</price> <taxgroup>zero</taxgroup> </product> <product> <code>t4</code> <name>myname</name> <description>mydescription</description> <numberof>2</numberof> <content> <extradata /> </content> <category>mycategory</category> <price>14.80</price> <taxgroup>high</taxgroup> </product> </products> <totalpriceextax>662.60</totalpriceextax> <totalpriceintax>674.35</totalpriceintax> <totalpricetax>11.75</totalpricetax> </shoppingcart> |