Templating
Global Functions
Website
\Components\Website\Designs \Components\Website\Pages \Components\Website\Pages\Forms \Components\Website\Posts \Components\Website\Posts\Categories
Customers
\Components\Customers\Contacts \Components\Customers\Contacts\Relationships \Components\Customers\Contacts\Relationships\Types \Components\Customers\Groups
Marketing
\Components\Marketing\EmailMarketing \Components\Marketing\Events \Components\Marketing\Events\Attendees \Components\Marketing\Events\Locations
Commerce
\Components\Commerce\Carts \Components\Commerce\Carts\Current \Components\Commerce\Configuration\PaymentMethods \Components\Commerce\Configuration\ShippingMethods \Components\Commerce\Discounts \Components\Commerce\Products \Components\Commerce\Products\Brands \Components\Commerce\Products\Categories \Components\Commerce\Products\Inventory \Components\Commerce\Sales \Components\Commerce\Sales\Items \Components\Commerce\Sales\Receipts \Components\Commerce\Sales\Receipts\Allocations
Settings
\Components\Settings\Administrators \Components\Settings\CustomFields \Components\Settings\Domains
Other Apps
\Components\Website\Comments \Components\Commerce\Affiliates \Components\Commerce\Affiliates\Administrators \Components\Commerce\Affiliates\Commissions \Components\Commerce\Affiliates\Payments \Components\Commerce\RecurringSales \Components\Commerce\RecurringSales\StoredCards
Framework
\Framework\Caching \Framework\Data\Util \Framework\HTML\Converters \Framework\HTTP\Cookies \Framework\HTTP\Redirection \Framework\HTTP\Request \Framework\HTTP\Session \Framework\HTTP\UserAgent \Framework\I18N\CompanyTypes \Framework\I18N\Countries \Framework\I18N\Languages \Framework\Network\GeoIP
Methods

\Components\Commerce\Carts\Current::

Access and modify the shopping cart of the current visitor.

Methods

Invoke via \Components\Commerce\Carts\Current::method()
Click a method name to copy it.
bool addProduct($arrOptions)
Adds a product to the shopping cart

product_id => The id of the product to add to the cart product_quantity => The quantity to add to the cart product_order_options_user => User selected options when ordering a product product_price => Price disable_merge => When true, if an identical product already exists in the cart, no merge will occur bought_for_contact_id => Allows the product to be linked to a different contact product_title => Used only if no product_id set product_sales_description => Sales invoice description ]
Parameters
$arrOptions
array
[
Return
Success
bool addProducts($arrAllOptions)
Adds products to the shopping cart

[ [ product_id => The id of the product to add to the cart product_quantity => The quantity to add to the cart product_order_options_user => User selected options when ordering a product product_price => Price disable_merge => When true, if an identical product already exists in the cart, no merge will occur bought_for_contact_id => Allows the product to be linked to a different contact product_title => Used only if no product_id set product_sales_description => Sales invoice description ], ... ]
Parameters
$arrAllOptions
array
Return
Success
array calculateDimensionsMM($iCubicBreak, $fWeightBreak)
Returns the shipment items
Parameters
$iCubicBreak
int
$fWeightBreak
float
Return
array
void clear()
Clears the cart
void clearItems()
Clears the cart
void convertPostedProductOptionsToAssoc($iProductId, $arrOrderOptionsPost)
Parameters
$iProductId
mixed
$arrOrderOptionsPost
mixed
array getAllDetailed()
Returns the shopping cart as an array with the details of the products, calculated tax and shipping
Return
Products in shopping cart
string getComments()
Returns any comments the customer may have on their order
Return
string
int getCount()
Returns the number of item rows in the shopping cart
Return
Number of rows
int getCountProducts()
Returns the total quantity of products in the shopping cart
Return
Number of products
string getCountry()
Returns the country of the contact uses this cart
Return
string
string getCurrencyId()
Returns the current currency id
Return
string
array getDiscounts()
Returns an array of discounts for this order
Return
Discounts
bool getIsAdmin()
Determines if the the current cart is used from an admin or public page.
This should be set to true on any admin page using the cart.
Return
bool
bool getIsGuestCheckoutDisabled()
Returns whether or not the 'guest checkout' option is disabled for cart.

This is derived from the products in the cart.
Return
bool
bool getIsShippingRequired()
Returns whether shipping is required for the products currently in the cart
Return
bool
void getIsSubmittable()
Returns whether the cart is submittable or not
float getOrderMinimumAmount()
Retrieves the order minimum value as configured in the config item
Return
float
\Components\Commerce\Configuration\PaymentMethods\Methods\ABC getPaymentMethodClass()
Returns the payment method used when the order is processed
Return
Payment method
int getProductOrderedQuantity($iProductId, $iContactId)
Retrieves the ordered quantity for a specific product for a specific contact
Parameters
$iProductId
int
$iContactId
int
Return
int
void getRowProductId($iCartRowId)
Parameters
$iCartRowId
mixed
string getShippingColumn($strColumn)
Returns a column of the orders shipping details
Parameters
$strColumn
string
Column name
Return
Value
array getShippingErrors()
Returns an array of any errors encountered when calculating shipping
Return
array
void getShippingMethodClass()
array getShippingMethodConfiguration()
Returns the configuration options for the shipping method
Return
array
string getStep($bHasProducts, $bContact, $bContactUpdate, $bShipping)
Returns the page of the recommended step in the ordering process
Parameters
$bHasProducts
bool
Check if the cart has products in it
$bContact
bool
Check if the contact is currently logged in
$bContactUpdate
bool
Check for all the required fields
$bShipping
bool
Check if shipping is required
Return
Page id
float getTotal($bIncludeShipping, $bIncludeDiscounts)
Returns the total dollar value of the items in the shopping cart
Parameters
$bIncludeShipping
bool
$bIncludeDiscounts
bool
Return
Total amount
float getTotalProducts()
Returns the dollar value total of just the products in the cart
Return
Total for products
float getTotalShipping()
Returns the dollar value total of the shipping
Return
Total shipping
float getTotalTax()
Returns the dollar value total tax for the items in the cart
Return
Total tax
string getTotalTaxLabel()
Returns the label for the tax rate - eg: 'GST'
Return
string
string getTotalTaxPercent()
Returns the tax rate - eg: '10%'
Return
string
int getTotalWeight()
Returns the total weight for the cart.
Return
int
bool hasDiscountFreeShipping()
Returns whether the cart has free shipping
Return
bool
bool hasDiscounts()
Returns whether the cart has discounts
Return
bool
bool hasProduct($iProductId)
Returns whether or not a product is in the cart
Parameters
$iProductId
int
Return
bool
bool isProductInCart($iProductId)
Returns whether or not a product has been added to the cart
Parameters
$iProductId
int
Return
bool
void orderProduct($iProductId, $iQuantity, $arrOptions, $iContactId)
Adds a product to the cart with quantity $iQuantity

If the product already exists in the cart, the quantity is increased by $iQuantity

TODO: deprecate
Parameters
$iProductId
int
$iQuantity
int
$arrOptions
array
$iContactId
mixed
void removeAllItems()
Removes all the items from the cart.
void removeInvalidItems()
Removes all items in the cart that do not have quantity
void removeProduct($iProductId)
Removes all of a particular product from the cart
Parameters
$iProductId
int
void removeRow($iCartRowId)
Removes a product
Parameters
$iCartRowId
int
void renderPriceExtras()
Renders any extra pricing information such as discounts or payment method hooks
void renderShipping()
void setComments($strComments)
Sets any comments the customer may have on their order
Parameters
$strComments
string
void setContactId($iContactId)
Sets the context of the contact who owns the cart

Note: Setting this value only persists for the length of the current request
Parameters
$iContactId
int
void setContactShouldInvoiceCompany($bContactShouldInvoiceCompany)
When set to true, the invoice will be created on the contact's company on cart completion
Parameters
$bContactShouldInvoiceCompany
bool
void setShipping($arrEntity)
Sets the shipping values
Parameters
$arrEntity
array
Shipping details array
void setShippingColumn($strKey, $strValue)
Parameters
$strKey
mixed
$strValue
mixed
void setShippingMethodId($iMethodId)
Parameters
$iMethodId
mixed
void updateRow($iCartRowId, $iQuantity, $arrOptions, $iContactId, $arrOrderData)
Updates a row in the cart to have a different quantity / options

If the product already exists in the cart, the quantity is set to $iQuantity
Parameters
$iCartRowId
int
$iQuantity
int|bool
$arrOptions
array|bool
Product order options
$iContactId
int|bool
$arrOrderData
array|bool

Database Fields

The following fields are used when retrieving and saving entities.