Ok, the checkout framework has been completed. It is based on one snippet, very similar to the mini-cart snippet, except it allows for editing of the quanitities of items.
Then it uses two main TVs, one for selecting shipping options and the other for selecting payment options.
Both of these TVs in turn call on individual TVs for each option. This way all you need to do is edit the two Options TVS to indicate what options you are making available.
@EVAL
if(isset($_SESSION['orders'])) {
return '
<form action="[~[*id*]~]" method="post">
<fieldset id="scShipmethods">
[*ShipDHL*][*ShipCourier*][*ShipAirmail*]<br />
<input type="submit" class="button" name="shipping" value="Select Shipping Method" />
</fieldset>
</form>
';
}
Then comes the hard part... write the code for each option’s functionality. The shipping TVs are entirely done in the one TV for each option; the TV creates the button and does all the processing. The payment options TVs will generate the option button, but will then pass off the processing to other TVs or included files. This is because they are generally much more complex than the shipping option units. You could pack the whole payment option into the same TV, but I think you’d regret it before long.