Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Public Attributes | List of all members
eZCart Class Reference

## Public Member Functions
| __construct ( $id="")
| store ()
| personID ()
| companyID ()
| get ( $id="")
| getBySession ( $session)
| delete ()
| id ()
| setSession (&$session)
| setPersonID ( $userID)
| setShipServiceCode ( $code)
| setCompanyID ( $id)
| items ()
| cartTotals (&$tax, &$total, $voucher=false, $checkout=false, $calcVAT=false)
| applyPctShippingMarkup ( $shiplist)
| applyFlatShippingMarkup ( $shiplist)
| applyFreeShipping ( $shiplist)
| shippingCost ( $shippingType)
| shippingVAT ( $shippingType)
& | extractShippingVAT ( $shippingType)
& | extractShippingVATPercentage ( $shippingType)
& | addShippingVAT ( $shippingType)
| clear ()
| storeshipoptions ($shipservice, $addressid)

## Public Attributes
| $ID
| $SessionID
| $PersonID
| $CompanyID
| $ShipServiceCode
| $userFreeShipping
| $dealerFreeShipping
| $singleBoxMaxWeight
| $shippingMarkupPct
| $shippingMarkupFlat
| $AddressID

## Detailed Description

! eZTrade eZCart handles a shopping cart

Example:

// Create a new cart
$cart = new eZCart();
$cart->setSession( $session );
// Store the cart to the database
$cart->store();
// Fetch all cart items
$items = $cart->items();
// print contents of the cart if it exists
if ( $items )
{
foreach ( $items as $item )
{
$product = $item->product();
print( $product->name() . "<br>");
}
}
$session
$session
Definition: admin/articlelist.php:44
$items
$items
Definition: admin/orderview.php:211
$cart
$cart
Definition: buy.php:27
eZCart
Definition: ezcart.php:71
$item
$item
Definition: classes/admin/linklist.php:228
$product
$product
Definition: homepage.php:202

See also
  eZCartItem eZProductCategory eZOption

Definition at line 70 of file ezcart.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZCart::__construct | ( |  | $id = `""` | ) |

Constructs a new eZCart object.

If $id is set the object's values are fetched from the database.

Definition at line 78 of file ezcart.php.

References $id, and $ID.

## Member Function Documentation

## ◆ addShippingVAT()

& eZCart::addShippingVAT | ( |  | $shippingType | ) |

Returns the VAT value of the product.

If a value is given as argument this value is used for VAT calculation. This is used in carts where you have multiple products and prices on options.

Definition at line 1091 of file ezcart.php.

References $shippingCost, $shippingType, $shippingVAT, and shippingCost().

## ◆ applyFlatShippingMarkup()

eZCart::applyFlatShippingMarkup | ( |  | $shiplist | ) |

Definition at line 939 of file ezcart.php.

References $i, and $shippingMarkupFlat.

Referenced by cartTotals().

## ◆ applyFreeShipping()

eZCart::applyFreeShipping | ( |  | $shiplist | ) |

Definition at line 953 of file ezcart.php.

References $i.

Referenced by cartTotals().

## ◆ applyPctShippingMarkup()

eZCart::applyPctShippingMarkup | ( |  | $shiplist | ) |

Applies a percentage shipping markup from the ini file.

Definition at line 929 of file ezcart.php.

References $i, and $shippingMarkupPct.

Referenced by cartTotals().

## ◆ cartTotals()

eZCart::cartTotals | ( | & | $tax,
|  | & | $total,
|  |  | $voucher = `false`,
|  |  | $checkout = `false`,
|  |  | $calcVAT = `false`
| ) |  |

Definition at line 355 of file ezcart.php.

References $AddressID, $checkout, $checkups, $country, $i, $id, $ini, $item, $items, $product, $products, $region, $res, $shippingCost, $shippingType, $shippingVAT, $ShipServiceCode, $singleBoxMaxWeight, $total, $type, $upscheck, $user, $uspscheck, applyFlatShippingMarkup(), applyFreeShipping(), applyPctShippingMarkup(), eZUser\currentUser(), extractShippingVAT(), extractShippingVATPercentage(), eZHTTPTool\getVar(), id(), items(), shippingCost(), shippingVAT(), and storeshipoptions().

## ◆ clear()

eZCart::clear | ( |  | ) |

Empties out the cart.

Definition at line 1113 of file ezcart.php.

References $db, $item, $items, $res, eZDB\globalDatabase(), and items().

## ◆ companyID()

eZCart::companyID | ( |  | ) |

Returns the company we are shopping for

Definition at line 146 of file ezcart.php.

References $CompanyID.

## ◆ delete()

eZCart::delete | ( |  | ) |

Deletes a eZCart object from the database.

Definition at line 230 of file ezcart.php.

References $db, $i, $item, $items, $res, eZDB\globalDatabase(), and items().

## ◆ extractShippingVAT()

& eZCart::extractShippingVAT | ( |  | $shippingType | ) |

Returns the shipping VAT. That is the VAT value of the shipping cost.

The argument must be a eZShippingType object.

Definition at line 1043 of file ezcart.php.

References $shippingCost, $shippingType, $shippingVAT, and shippingCost().

Referenced by cartTotals(), and shippingVAT().

## ◆ extractShippingVATPercentage()

& eZCart::extractShippingVATPercentage | ( |  | $shippingType | ) |

Returns the shipping VAT in percentage.

The argument must be a eZShippingType object.

Definition at line 1066 of file ezcart.php.

References $shippingCost, $shippingType, $shippingVAT, and shippingCost().

Referenced by cartTotals().

## ◆ get()

eZCart::get | ( |  | $id = `""` | ) |

Fetches the object information from the database.

Definition at line 154 of file ezcart.php.

References $db, $id, $ret, and eZDB\globalDatabase().

## ◆ getBySession()

eZCart::getBySession | ( |  | $session | ) |

Returns a eZCart object.

Definition at line 201 of file ezcart.php.

References $db, $query, $ret, $session, and eZDB\globalDatabase().

## ◆ id()

eZCart::id | ( |  | ) |

Returns the object ID.

Definition at line 267 of file ezcart.php.

References $ID.

Referenced by cartTotals().

## ◆ items()

eZCart::items | ( |  | ) |

Returns all the cart items in the cart.

An array of eZCartItem objects are retunred if successful, an empty array.

Definition at line 326 of file ezcart.php.

References $db, $item, $query, $ret, and eZDB\globalDatabase().

Referenced by cartTotals(), clear(), delete(), and shippingCost().

## ◆ personID()

eZCart::personID | ( |  | ) |

Returns the person we are shopping for

Definition at line 138 of file ezcart.php.

References $PersonID.

## ◆ setCompanyID()

eZCart::setCompanyID | ( |  | $id | ) |

Sets the company we are shopping for

Definition at line 313 of file ezcart.php.

References $id.

## ◆ setPersonID()

eZCart::setPersonID | ( |  | $userID | ) |

Sets the person we are shopping for

Definition at line 288 of file ezcart.php.

References $id, and $userID.

## ◆ setSession()

eZCart::setSession | ( | & | $session | ) |

Sets the session the cart belongs to.

Return false if the applied argument is not and eZSession object.

Definition at line 277 of file ezcart.php.

References $session.

## ◆ setShipServiceCode()

eZCart::setShipServiceCode | ( |  | $code | ) |

Sets the ship service code

Definition at line 304 of file ezcart.php.

## ◆ shippingCost()

eZCart::shippingCost | ( |  | $shippingType | ) |

Calculates the shipping cost with the given shippment type. The argument must be a eZShippingType object.

Definition at line 969 of file ezcart.php.

References $count, $item, $items, $product, $shippingGroup, $shippingType, $values, and items().

Referenced by addShippingVAT(), cartTotals(), extractShippingVAT(), and extractShippingVATPercentage().

## ◆ shippingVAT()

eZCart::shippingVAT | ( |  | $shippingType | ) |

Obsolete. Use addShippingVAT() or extractShippingVAT() instead.

Definition at line 1031 of file ezcart.php.

References $shippingType, and extractShippingVAT().

Referenced by cartTotals().

## ◆ store()

eZCart::store | ( |  | ) |

Stores a cart to the database.

Definition at line 92 of file ezcart.php.

References $db, $query, $res, and eZDB\globalDatabase().

## ◆ storeshipoptions()

eZCart::storeshipoptions | ( |  | $shipservice,
|  |  | $addressid
| ) |  |

Definition at line 1144 of file ezcart.php.

References $db, $res, and eZDB\globalDatabase().

Referenced by cartTotals().

## Member Data Documentation

## ◆ $AddressID

eZCart::$AddressID

Definition at line 1217 of file ezcart.php.

Referenced by cartTotals().

## ◆ $CompanyID

eZCart::$CompanyID

Definition at line 1204 of file ezcart.php.

Referenced by companyID().

## ◆ $dealerFreeShipping

eZCart::$dealerFreeShipping

Definition at line 1212 of file ezcart.php.

## ◆ $ID

eZCart::$ID

Definition at line 1201 of file ezcart.php.

Referenced by __construct(), and id().

## ◆ $PersonID

eZCart::$PersonID

Definition at line 1203 of file ezcart.php.

Referenced by personID().

## ◆ $SessionID

eZCart::$SessionID

Definition at line 1202 of file ezcart.php.

## ◆ $shippingMarkupFlat

eZCart::$shippingMarkupFlat

Definition at line 1215 of file ezcart.php.

Referenced by applyFlatShippingMarkup().

## ◆ $shippingMarkupPct

eZCart::$shippingMarkupPct

Definition at line 1214 of file ezcart.php.

Referenced by applyPctShippingMarkup().

## ◆ $ShipServiceCode

eZCart::$ShipServiceCode

Definition at line 1210 of file ezcart.php.

Referenced by cartTotals().

## ◆ $singleBoxMaxWeight

eZCart::$singleBoxMaxWeight

Definition at line 1213 of file ezcart.php.

Referenced by cartTotals().

## ◆ $userFreeShipping

eZCart::$userFreeShipping

Definition at line 1211 of file ezcart.php.

The documentation for this class was generated from the following file:

- ezcart.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.