\Commerce\Products
Templating
Global Functions
Website
\Components\Website\Designs \Components\Website\Media \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\Categories \Components\Marketing\Events\Locations \Components\Marketing\Events\Recurring \Components\Marketing\Events\Recurring\Rules \Components\Marketing\SMSMarketing
Commerce
\Components\Commerce\Carts \Components\Commerce\Carts\Current \Components\Commerce\Discounts \Components\Commerce\Products
METHODS
\Components\Commerce\Products\Brands \Components\Commerce\Products\Categories \Components\Commerce\Products\Inventory \Components\Commerce\RecurringSales\Items \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\DOM\CurrentContext \Framework\HTML\Converters \Framework\HTTP\Cookies \Framework\HTTP\Redirection \Framework\HTTP\Request \Framework\HTTP\Session \Framework\HTTP\TabState \Framework\HTTP\UserAgent \Framework\I18N\CompanyTypes \Framework\I18N\Countries \Framework\I18N\Languages

Products

Access, create, update and delete the products in your online catalogue.

Methods

Invoke via \Components\Commerce\Products::method()
Click a method name to copy it.
- ` \Iterator dbGetAllIterable($arrQuery) `
Returns the raw rows dbGetAll() would return as an iterator, without building them all into an array

The dbGetAll() counterpart of getAllIterable(), for scans over every stored row of a large table (eg: the site-wide content scans in \Framework\Developer\Refactoring). Rows are as stored - JSON fields are not decoded - and are not entity-cached. Because it bypasses getAll(), components that override getAll() are iterated; search queries and components overriding dbGetAll() are refused.
Parameters:
- $arrQuery
mixed
Return
Yields Products
- ` void determinePriceWithOrderOptions($iProductId, $arrOrderOptionsPost, $sKey) `
Parameters:
- $iProductId
mixed
- $arrOrderOptionsPost
mixed
- $sKey
mixed
- ` array fieldsGetAll($bCached) `
Returns all the columns this component supports
Parameters:
- $bCached
mixed
Return
array
- ` array get($iProductId) `
Gets a record from the database
Parameters:
- $iProductId
int unsigned
A record's product_id
Return
- ` array getAll($arrQuery) `
Return a set of records from the database
Parameters:
- $arrQuery
mixed
Return
Array of Products
- ` array getAllDeleted($arrQuery) `
Return all soft deleted records in the database.
Parameters:
- $arrQuery
mixed
Return
Array of Products
- ` array getAllForCategoryAndBrand($iCategoryId, $iBrandId, $arrQuery) `
Returns all products for a given category and brand
Parameters:
- $iCategoryId
mixed
- $iBrandId
mixed
- $arrQuery
mixed
Return
Array of Products
- ` array getAllForCategoryAndBrandRecursive($iCategoryId, $iBrandId, $arrQuery) `
Returns all products for a given category and brand
Parameters:
- $iCategoryId
mixed
- $iBrandId
mixed
- $arrQuery
mixed
Return
Array of Products
- ` \Iterator getAllIterable($arrQuery) `
Returns the entities getAll() would return as an iterator, without building them all into an array

For result sets too large to hold as arrays (eg: every recipient of a marketing send) - only the database driver's compact buffer of the result is held, a fraction of getAll()'s memory. Runs the same SQL as getAll(), and runs it now, as getAll() would; rows are decoded as you iterate.
Search queries are not supported, rows are not entity-cached, and components that override getAll() or dbGetAll() (eg: merging in defaults) are refused rather than iterated without their extra rows.
Parameters:
- $arrQuery
mixed
Return
Yields Products
- ` mixed getColumn($iProductId, $strColumn) `
Returns a single column of an entity
Parameters:
- $iProductId
int unsigned
A record's product_id
- $strColumn
mixed
Return
mixed
- ` array getConsole($iProductId) `
Returns an entity
Parameters:
- $iProductId
int unsigned
A record's product_id
Return
Entity
- ` int getCount($arrFilter) `
Returns the number of records in the database (matching the filter if specified)
Parameters:
- $arrFilter
mixed
Return
int
- ` int getCountForCategoryAndBrand($iCategoryId, $iBrandId, $arrFilter) `
Returns the number of products in a category and brand
Parameters:
- $iCategoryId
mixed
- $iBrandId
mixed
- $arrFilter
mixed
Return
int
- ` int getCountForCategoryAndBrandRecursive($iCategoryId, $iBrandId, $arrFilter) `
Returns product count given category and brand
Parameters:
- $iCategoryId
mixed
- $iBrandId
mixed
- $arrFilter
mixed
Return
int
- ` bool delete($iProductId, $bDeleteMedia) `
Deletes a record from the database
Parameters:
- $iProductId
int unsigned
A record's product_id
- $bDeleteMedia
mixed
Return
Returns true if record existed and was deleted, otherwise false
- ` array getFromPageRequest() `
Retrieves a product from its page URI and applies any posted order options
Return
array
- ` void getFromPageURI($strPageURI) `
Retrieves a product from its page URI
Parameters:
- $strPageURI
mixed
- ` array getIncludingDeleted($iProductId) `
Returns a record, regardless of whether or not it has been deleted
Parameters:
- $iProductId
int unsigned
A record's product_id
Return
- ` string getLabelForOrderOptionValue($arrOptionValue) `
Returns a formatted label for an option value
Parameters:
- $arrOptionValue
mixed
Return
string
- ` string getUnorderableMessage($arrProduct) `
Returns the text reason why a product is unorderable
Parameters:
- $arrProduct
mixed
Return
string
- ` bool isOrderableForSomeoneElse($iProductId) `
Whether a product may be bought for a related contact rather than the purchaser.
Reads the raw row: the altered get() re-runs the tax and discount pass on every call, and storefront pages ask this several times per render.
Parameters:
- $iProductId
mixed
Return
bool
- ` void orderOptionsRequireRepost($arrOptionValues) `
Parameters:
- $arrOptionValues
mixed
- ` string renderPrice($arrProduct, $strTags) `
Renders the price of a product
Parameters:
- $arrProduct
mixed
- $strTags
mixed
Return
string
- ` string renderPriceExtras($arrProduct, $bShortDisplay) `
Renders any extra pricing information such as discounts or payment method hooks
Parameters:
- $arrProduct
mixed
- $bShortDisplay
mixed
Return
string
- ` int|null resolveBoughtForContactId($iProductId, $iPostedContactId) `
Resolves who a storefront order line is for. The posted contact is only honoured when the product allows someone-else orders AND the contact is in the purchaser's relationships - the storefront only ever offers those, so anything else is a tampered POST and falls back to the purchaser. Guests yield null - deliberately without the tracking-cookie fallback - so callers fall through to the contact their flow creates.
Parameters:
- $iProductId
mixed
- $iPostedContactId
mixed
Return
int|null
- ` string|int save($arrEntity) `
Saves a record into the database
Parameters:
- $arrEntity
mixed
Return
string|int
- ` void saveColumn($iProductId, $strColumn, $strValue) `
Saves a specific column of a row into a database
Parameters:
- $iProductId
int unsigned
A record's product_id
- $strColumn
mixed
- $strValue
mixed
- ` array search($strSearch, $arrQuery) `
Performs a search
Parameters:
- $strSearch
mixed
- $arrQuery
mixed
Return
array

Database Fields

The following fields are used when retrieving and saving entities:
- `product_id`
int unsigned (10)
- `product_title`
string (255)
- `product_price_base`
decimal unsigned (8,2)
Default value: 0.00
- `product_icon`
string (255)
- `product_gallery`
string (4294967295)
- `product_order`
int (11)
- `product_content`
string (4294967295)
- `product_order_form`
string (4294967295)
- `product_created_datetime`
datetime
- `product_modified_datetime`
datetime
- `product_deleted_datetime`
datetime
- `product_is_offline`
0 or 1
- `product_is_unorderable`
0 or 1
- `product_is_orderable_for_someone_else`
0 or 1
- `product_disables_guest_checkout`
0 or 1
- `product_code`
string (63)
- `product_barcode`
string (31)
- `product_sales_description`
string (255)
- `product_order_options`
string (16777215)
- `product_is_shipping_required`
0 or 1
Default value: 1
- `product_shipping_width_mm`
int unsigned (10)
- `product_shipping_height_mm`
int unsigned (10)
- `product_shipping_depth_mm`
int unsigned (10)
- `product_shipping_weight_g`
int unsigned (10)
- `product_inventory_level`
int unsigned (10)
- `product_inventory_is_public`
0 or 1
- `product_inventory_is_unorderable_sold_out`
0 or 1
- `product_brand_id`
int unsigned (10)
- `product_condition_id`
int unsigned (10)
- `product_condition_hidden_in_lists`
0 or 1
- `product_max_quantity`
int unsigned (10)
- `product_min_quantity`
int unsigned (10)
- `product_uri_suffix`
string (255)
- `product_uri_suffix_is_overridden`
0 or 1
- `product_search_keywords`
string (255)
- `product_search_keywords_is_overridden`
0 or 1
- `product_search_title`
string (255)
- `product_search_title_is_overridden`
0 or 1
- `product_search_description`
string (255)
- `product_search_description_is_overridden`
0 or 1
- `product_search_noindex`
0 or 1
- `product_search_nofollow`
0 or 1