Class Mage_Paypal_Model_Cart

Description

PayPal-specific model for shopping cart items and totals

The main idea is to accommodate all possible totals into PayPal-compatible 4 totals and line items

Located in /Paypal/Model/Cart.php (line 31)


	
			
Class Constant Summary
TOTAL_DISCOUNT = 'discount'
TOTAL_SHIPPING = 'shipping'
TOTAL_SUBTOTAL = 'subtotal'
TOTAL_TAX = 'tax'
Variable Summary
Method Summary
Mage_Paypal_Model_Cart __construct ([array $params = array()])
Varien_Object addItem (string $name, numeric $qty, float $amount, [string $identifier = null])
array|false getItems ([bool $bypassValidation = false])
array getTotals ([bool $mergeDiscount = false])
bool|Mage_Paypal_Model_Cart isDiscountAsItem ([$setValue $setValue = null])
bool|Mage_Paypal_Model_Cart isShippingAsItem ([$setValue $setValue = null])
bool removeItem (string $identifier)
Mage_Paypal_Model_Cart updateTotal (string $code, float $amount, [string $lineItemDescription = null])
Varien_Object _addRegularItem ( $salesItem)
void _render ()
string _renderTotalLineItemDescriptions (string $code, [string $prepend = ''], [string $append = ''], [string $glue = '; '])
void _validate ()
Variables
bool $_areItemsValid = false (line 87)

Validation result for the rendered cart items

  • access: protected
bool $_areTotalsValid = false (line 94)

Validation result for the rendered totals

  • access: protected
bool $_isDiscountAsItem = false (line 102)

Whether to render discount total as a line item Use case: WPP

  • access: protected
bool $_isShippingAsItem = false (line 110)

Whether to render shipping total as a line item Use case: WPS

  • access: protected
array $_items = array() (line 57)

Rendered cart items Array of Varien_Objects

  • access: protected
Mage_Sales_Model_Order $_salesEntity = null (line 49)

Order or quote instance

  • access: protected
bool $_shouldRender = true (line 80)

Lazy initialization indicator for rendering

  • access: protected
array $_totalLineItemDescriptions = array() (line 73)

Set of optional descriptions for the item that may replace a total and composed of several amounts Array of strings

  • access: protected
array $_totals = array() (line 65)

Rendered cart totals Associative array with the keys from constants above

  • access: protected
Methods
Constructor __construct (line 117)

Require instance of an order or a quote

  • access: public
Mage_Paypal_Model_Cart __construct ([array $params = array()])
  • array $params
addItem (line 199)

Add a line item

  • access: public
Varien_Object addItem (string $name, numeric $qty, float $amount, [string $identifier = null])
  • string $name
  • numeric $qty
  • float $amount
  • string $identifier
getItems (line 146)

Render and get line items By default returns false if the items are invalid

  • access: public
array|false getItems ([bool $bypassValidation = false])
  • bool $bypassValidation
getSalesEntity (line 134)

Getter for the current sales entity

  • access: public
Mage_Sales_Model_Order getSalesEntity ()
getTotals (line 163)

Render and get totals If the totals are invalid for any reason, they will be merged into one amount (subtotal is utilized for it) An option to substract discount from the subtotal is available

  • access: public
array getTotals ([bool $mergeDiscount = false])
  • bool $mergeDiscount
isDiscountAsItem (line 257)

Get/Set whether to render the discount total as a line item

  • access: public
bool|Mage_Paypal_Model_Cart isDiscountAsItem ([$setValue $setValue = null])
  • $setValue $setValue
isShippingAsItem (line 268)

Get/Set whether to render the discount total as a line item

  • access: public
bool|Mage_Paypal_Model_Cart isShippingAsItem ([$setValue $setValue = null])
  • $setValue $setValue
removeItem (line 220)

Remove item from cart by identifier

  • access: public
bool removeItem (string $identifier)
  • string $identifier
updateTotal (line 239)

Compound the specified amount with the specified total

  • access: public
Mage_Paypal_Model_Cart updateTotal (string $code, float $amount, [string $lineItemDescription = null])
  • string $code
  • float $amount
  • string $lineItemDescription
_addRegularItem (line 424)

Add a usual line item with amount and qty

  • access: protected
Varien_Object _addRegularItem ( $salesItem)
  • Varien_Object $salesItem
_render (line 276)

(re)Render all items and totals

  • access: protected
void _render ()
_renderTotalLineItemDescriptions (line 363)

Merge multiple descriptions by a total code into a string

  • access: protected
string _renderTotalLineItemDescriptions (string $code, [string $prepend = ''], [string $append = ''], [string $glue = '; '])
  • string $code
  • string $prepend
  • string $append
  • string $glue
_validate (line 381)

Check the line items and totals according to PayPal business logic limitations

  • access: protected
void _validate ()
Class Constants
TOTAL_DISCOUNT = 'discount' (line 39)
TOTAL_SHIPPING = 'shipping' (line 41)
TOTAL_SUBTOTAL = 'subtotal' (line 38)

Totals that PayPal suppports when passing shopping cart

TOTAL_TAX = 'tax' (line 40)

Documentation generated on Fri, 11 Feb 2011 16:57:19 +0200 by phpDocumentor 1.4.3