Sitellite Application Framework
Class Tree         Index         All Elements

Class: Cart

Source Location: Program_Root/Cart/Cart.php

Class Overview




Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 95]


[ Top ]


Class Variables

$checkout_tpl =  '<a href="{link}">Check Out</a>'

[line 150]

If you call the checkout_button () method, it uses this template to generate a 'Check Out' link.



Tags:

access:  public

Type:   mixed


[ Top ]

$customer_id =  ''

[line 132]

To identify a customer, we assign them a $customer_id. This can be generated randomly, set to be some other identifying value, such as the $session object's id property, or whatever you want.



Tags:

access:  public

Type:   mixed


[ Top ]

$items = array ()

[line 103]

The list of items in the cart. Keys are the sku's, values are Item objects.



Tags:

access:  public

Type:   mixed


[ Top ]

$link =  '/index'

[line 160]

This property is necessary in order to create a proper 'View Cart' or 'Check Out' link with the view_button () and checkout_button () methods.



Tags:

access:  public

Type:   mixed


[ Top ]

$price_column =  'price'

[line 122]

In order to calculate subtotals and totals, Cart needs to know which property of Item contains the prices of the items. This defaults to 'price'.



Tags:

access:  public

Type:   mixed


[ Top ]

$tax =  1.0

[line 112]

The tax is a number that the prices are simply multiplied by, so to assign 15% tax, you would set $tax to 1.15



Tags:

access:  public

Type:   mixed


[ Top ]

$view_tpl =  '<a href="{link}">View Cart</a>'

[line 141]

If you call the view_button () method, it uses this template to generate a 'View Cart' link.



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor Cart [line 169]

Cart Cart( [string $customer_id = ''])

Constructor method.



Tags:

access:  public


Parameters:

string   $customer_id  

[ Top ]

method add_item [line 253]

object &add_item( string $sku, object $item)

Adds an item to the cart.



Tags:

access:  public


Parameters:

string   $sku  
object   $item  

[ Top ]

method add_tax [line 211]

void add_tax( object $tpl)

Returns the total of the prices, plus taxes.



Tags:

access:  public


Parameters:

object   $tpl  

[ Top ]

method checkout [line 283]

void checkout( )

Empty method - to be defined when subclassed. Check the person out, we have led them to buy.



Tags:

access:  public


[ Top ]

method checkout_button [line 237]

void checkout_button( object $tpl)

Generates a 'Check Out' button.



Tags:

access:  public


Parameters:

object   $tpl  

[ Top ]

method error [line 310]

void error( )

Empty method - to be defined when subclassed. Report something gone wrong.



Tags:

access:  public


[ Top ]

method retrieve [line 274]

void retrieve( )

Empty method - to be defined when subclassed. Retrive the cart from wherever it was stored before.



Tags:

access:  public


[ Top ]

method save [line 292]

void save( )

Empty method - to be defined when subclassed. Save the cart for later, without purchasing anything. Sort of a 'save as wishlist' option.



Tags:

access:  public


[ Top ]

method store [line 265]

void store( )

Empty method - to be defined when subclassed. Store the cart somewhere for another script to retrive it.



Tags:

access:  public


[ Top ]

method subtotal [line 192]

void subtotal( object $tpl)

Adds up all of the prices of the items, not including taxes.



Tags:

access:  public


Parameters:

object   $tpl  

[ Top ]

method total_items [line 181]

void total_items( object $tpl)

Returns the number of items in the cart.



Tags:

access:  public


Parameters:

object   $tpl  

[ Top ]

method valid [line 301]

void valid( )

Empty method - to be defined when subclassed. Check if the information (contact, credit cart, whatever) provided is valid.



Tags:

access:  public


[ Top ]

method view_button [line 223]

void view_button( object $tpl)

Generates a 'View Cart' button. Requires a global $simple SimpleTemplate object.



Tags:

access:  public


Parameters:

object   $tpl  

[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:17:02 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2