<?php /* Proposed shoppinng cart markup v0.2 (:metacart:) (:cart XES1 seller=XES:) (:item XyZ name="Product Name" amt=123.45 desc="Product description" pic=http://example.com/products/pic.gif:) (:pic http://example.com/products/pic2.gif:) (:itemend:) (:coupon YYz name="Special Offer" math=* amt=.9 redeem="BuyMyStuff" expire=2006-07-28:)(:couponend:) (:item PQT name="Wholesale Product" amt=40 desc="Description" exempt pic=url:) (:discount DEF name="25-50" range=25,50 math=- amt=50:)(:codeend:) (:discount ABC name="100+" range=100, math=/ amt=2:)(:codeend:) (:discount GHI name="51-99" range=51,99 math=* amt=.75:)(:codeend:) (:options NOP name="Colors" select=1:) (:option RED name="Red":)(:optionend:) (:option BLUE name="Blue":)(:optionend:) (:optionsend:) (:options QHI name="Size" select=1:) (:option 8oz name="Small" default:)(:optionend:) (:option 20oz name="Large" math=+ amt=10.50:) (:option GREEN type=option name="Green" parent="Colors" math=* amt=1.1 exempt:)(:optionend:) (:optionend:) (:optionsend:) (:service SVC name="Install PmWiki" amt=100 desc="description" exempt:) (:option Basic name="Basic PmWiki Package" amt=250 desc="description" checkbox:)(:optionend:) (:serviceend:) (:cartend:) (:metacartend:) Notes: exempt -> exempt from cart-wide coupons & discounts math -> if the result is a calculation from the amount of the parent, use this mathematical function (* + - / maybe ^) range -> the discount applies to orders numbering within "range" range=100+ could be an alias for range=100, since 100+ is more intuitive redeem -> the code the user must enter to add the coupon to the cart parent -> under these circumstances add this option to the parent's "colors" option There needs to be more functionality, like tax settings, etc. but this is a starting concept */ $metacart = array ( 'XES1' => array ( 'seller'=>'XES', 'XyZ' => array ( 'type'=>'item', 'name'=>"Product Name", 'amt'=>123.45, 'desc'=>"Product description", 'pic'=> array( 'http://example.com/products/pic.gif', 'http://example.com/products/pic2.gif') ), 'YYz' => array ( 'type'=>'coupon', 'name'=>"Special Offer", 'math'=>'*', 'amt'=>.9, 'redeem'=>"BuyMyStuff", 'expire'=>"2006-07-28"), 'PQT' => array ( 'type'=>'item', 'name'=>"Wholesale Product", 'amt'=>40, 'desc'=>"Description", 'exempt'=>true, 'pic'=>"http://www.example.com/pic4.gif", 'DEF' => array( 'type'=>'discount', 'name'=>"25-50", 'range'=>"25,50", 'math'=>"-", 'amt'=>50 ), 'ABC' => array( 'type'=>'discount', 'name'=>"100+", 'range'=>"100,", 'math'=>"/", 'amt'=>2 ), 'GHI' => array ( 'type'=>'discount', 'name'=>"51-99", 'range'=>"51,99", 'math'=>"*", 'amt'=>.75), 'NOP' => array ( 'type'=>'options', 'name'=>"Colors", 'select'=>1, 'RED' => array ( 'type'=>'option', 'name'=>"Red"), 'BLUE' => array ( 'type'=>'option', 'name'=>"Blue") ), 'QHI' => array ( 'type'=>'options', 'name'=>"Size", 'select'=>1 ), '8oz' => array( 'type'=>'option', 'name'=>"Small", 'default'=>true ), '20oz' => array ( 'type'=>'option', 'name'=>"Large", 'math'=>'+', 'amt'=>10.50, 'GREEN' => array( 'type'=>'option', 'name'=>"Green", 'parent'=>'Colors', 'math'=>'*', 'amt'=>1.1, 'exempt'=>true ) ) ), 'SVC' => array( 'type'=>'service', 'name'=>"Install PmWiki", 'amt'=>100, 'desc'=>"description", 'exempt'=>true, 'Basic' => array( 'type'=>'option', 'name'=>"Basic PmWiki Package", 'amt'=>250, 'desc'=>"description") ) ) ); print_r($metacart);