<?php

/*

(:metacart:)
	(:cart XES1 seller=XES:)
		(:code XyZ type=item name="Product Name" amt=123.45 desc="Product description" pic=http://example.com/products/pic.gif:)
			(:pic http://example.com/products/pic2.gif:)
		(:codeend:)
		(:code YYz type=coupon name="Special Offer" math=* amt=.9 redeem="BuyMyStuff" expire=2006-07-28:)(:codeend:)
		(:code PQT type=item name="Wholesale Product" amt=40 desc="Description" exempt pic=url:)
			(:code DEF type=discount name="25-50" range=25,50 math=- amt=50:)(:codeend:)
			(:code ABC type=discount name="100+" range=100, math=/ amt=2:)(:codeend:)
			(:code GHI type=discount name="51-99" range=51,99 math=* amt=.75:)(:codeend:)
			(:code NOP type=options name="Colors" select=1:)
				(:code RED type=option name="Red":)(:codeend:)
				(:code BLUE type=option name="Blue":)(:codeend:)
			(:codeend:)
			(:code QHI type=options name="Size" select=1:)
				(:code 8oz type=option name="Small" default:)(:codeend:)
				(:code 20oz type=option name="Large" math=+ amt=10.50:)
					(:code GREEN type=option name="Green" parent="Colors" math=* amt=1.1 exempt:)(:codeend:)
				(:codeend:)
			(:codeend:)
		(:code SVC type=service name="Install PmWiki" amt=100 desc="description" exempt:)
			(:code Basic type=option name="Basic PmWiki Package" amt=250 desc="description":)(:codeend:)
		(:codeend:)	
	(: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);