BasketContent
extends BaseOutput
in package
This is the BasketContent class, a macro class for the basket viewHelper.
The purpose of this class is to encapsulate the logic that calculates the view parameters for the baskets output.
Tags
Table of Contents
ADDITIONAL_ITEMS_PRESENTATION | = 'additionalItems' | |
---|---|---|
GIFTS_PRESENTATION_INDEPENDENT | = 'independent' | |
GIFTS_PRESENTATION_PRODUCTS_BLOCK | = 'productsBlock' | |
MODE_CASH_TICKET | = 'cashTicket' | |
MODE_DISCLOSURE | = 'disclosure' | |
SHOW_DISCOUNT_VALUE_BOTH | = 'both' | |
SHOW_DISCOUNT_VALUE_NONE | = 'none' | |
SHOW_DISCOUNT_VALUE_PERCENTAGE | = 'percentage' | |
SHOW_DISCOUNT_VALUE_VALUE | = 'value' | |
SHOW_DISCOUNT_VALUE_VALUES | = [self::SHOW_DISCOUNT_VALUE_VALUE, self::SHOW_DISCOUNT_VALUE_PERCENTAGE, self::SHOW_DISCOUNT_VALUE_BOTH, self::SHOW_DISCOUNT_VALUE_NONE] | |
SHOW_OPTION_VALUES_NAME_NOT_SHOW | = 'notShow' | |
SHOW_OPTION_VALUES_NAME_SHOW_DESCRIPTION | = 'showDescription' | |
SHOW_OPTION_VALUES_NAME_SHOW_NAME | = 'showName' | |
WARNING_POSITION_HEADER | = 'header' | |
WARNING_POSITION_LINE | = 'line' | |
GIFTS_PRESENTATION_VALUES | = [self::GIFTS_PRESENTATION_PRODUCTS_BLOCK, self::GIFTS_PRESENTATION_INDEPENDENT] | |
MODE_VALUES | = [self::MODE_DISCLOSURE, self::MODE_CASH_TICKET] | |
SHOW_OPTION_VALUES_NAME_VALUES | = [self::SHOW_OPTION_VALUES_NAME_NOT_SHOW, self::SHOW_OPTION_VALUES_NAME_SHOW_NAME, self::SHOW_OPTION_VALUES_NAME_SHOW_DESCRIPTION] | |
TABLE_COLUMNS | = ['info', 'price', 'quantity', 'discounts', 'subtotal'] | |
WARNING_POSITION_VALUES | = [self::WARNING_POSITION_HEADER, self::WARNING_POSITION_LINE] | |
$additionalItems | : string | |
$basket | : Basket|null | |
$editable | : bool | |
$editableGifts | : bool | |
$errorWarningPosition | : string | |
$giftsPresentation | : string | |
$hiddenWarningCodes | : array<string|int, mixed> | |
$infoWarningPosition | : string | |
$linkable | : bool | |
$mode | : string | |
$productsBundleItemTemplate | : string|null | |
$productsBundleTemplate | : string|null | |
$productSelectableGiftTemplate | : string|null | |
$productsGiftTemplate | : string|null | |
$productsTemplate | : string|null | |
$quantityPlugin | : bool | |
$routeType | : string | |
$selectableBoxRows | : int | |
$showBrand | : bool | |
$showCustomTagPositions | : array<string|int, mixed> | |
$showCustomTags | : bool | |
$showDevolutionButton | : bool | |
$showDiscountName | : bool | |
$showDiscounts | : bool | |
$showDiscountValue | : string | |
$showFooter | : bool | |
$showFreeTaxMessage | : bool | |
$showImage | : bool | |
$showManufacturerSku | : bool | |
$showOffsets | : bool | |
$showOptions | : bool | |
$showOptionValuesName | : string | |
$showOptionValuesSku | : bool | |
$showPercentDifference | : bool | |
$showPreviousPrice | : bool | |
$showPriceDifference | : bool | |
$showPrices | : bool | |
$showProductStockId | : bool | |
$showSelectableBox | : bool | |
$showShippingSection | : bool | |
$showSku | : bool | |
$showTaxDisclosure | : bool | |
$showTaxesZeroTotalIncrement | : bool | |
$showTaxIncluded | : bool|null | |
$showTaxName | : bool|null | |
$showWarnings | : bool | |
$showWarningsBlock | : bool | |
$showZeroDiscount | : bool | |
$showZeroPayment | : bool | |
$showZeroShipping | : bool | |
$tableClass | : string | |
$totalProductDiscounts | : float | |
$warningWarningPosition | : string | |
$disclosure | : array<string|int, mixed> | |
$footerRows | : array<string|int, mixed> | |
$languageSheet | : Language|null | |
$tableColumns | : int | |
__construct() | Constructor method for Output class. | : mixed |
colspanCalculator() | Util for calculate colspan value of a tr depending tbody columns, default for extra table tr (row) with 2 td | : int |
getTableBodyColumns() | Based on the maximum possible columns and the parameters, calculate the maximum columns of the table's body. | : int |
getViewParameters() | This method returns all calculated arguments and new parameters for BasketViewHelper.php | : array<string|int, mixed> |
getProperties() | Return macro use properties | : array<string|int, mixed> |
getRowClassName() | Get basketRow classes for <tr> html | : string |
parametersRestrictions() | Depending mode parameter override other parameters | : void |
setCalculatedAttributes() | : void | |
setDisclosure() | : void | |
setFooter() | : void | |
setTotalProductDiscounts() | Sets the sum of the total discounts of all rows | : void |
validateMainParams() | This method check that the main params stored in this parent class are OK | : array<string|int, mixed> |
Constants
ADDITIONAL_ITEMS_PRESENTATION
public
mixed
ADDITIONAL_ITEMS_PRESENTATION
= 'additionalItems'
GIFTS_PRESENTATION_INDEPENDENT
public
mixed
GIFTS_PRESENTATION_INDEPENDENT
= 'independent'
GIFTS_PRESENTATION_PRODUCTS_BLOCK
public
mixed
GIFTS_PRESENTATION_PRODUCTS_BLOCK
= 'productsBlock'
MODE_CASH_TICKET
public
mixed
MODE_CASH_TICKET
= 'cashTicket'
MODE_DISCLOSURE
public
mixed
MODE_DISCLOSURE
= 'disclosure'
SHOW_DISCOUNT_VALUE_BOTH
public
mixed
SHOW_DISCOUNT_VALUE_BOTH
= 'both'
SHOW_DISCOUNT_VALUE_NONE
public
mixed
SHOW_DISCOUNT_VALUE_NONE
= 'none'
SHOW_DISCOUNT_VALUE_PERCENTAGE
public
mixed
SHOW_DISCOUNT_VALUE_PERCENTAGE
= 'percentage'
SHOW_DISCOUNT_VALUE_VALUE
public
mixed
SHOW_DISCOUNT_VALUE_VALUE
= 'value'
SHOW_DISCOUNT_VALUE_VALUES
public
mixed
SHOW_DISCOUNT_VALUE_VALUES
= [self::SHOW_DISCOUNT_VALUE_VALUE, self::SHOW_DISCOUNT_VALUE_PERCENTAGE, self::SHOW_DISCOUNT_VALUE_BOTH, self::SHOW_DISCOUNT_VALUE_NONE]
SHOW_OPTION_VALUES_NAME_NOT_SHOW
public
mixed
SHOW_OPTION_VALUES_NAME_NOT_SHOW
= 'notShow'
SHOW_OPTION_VALUES_NAME_SHOW_DESCRIPTION
public
mixed
SHOW_OPTION_VALUES_NAME_SHOW_DESCRIPTION
= 'showDescription'
SHOW_OPTION_VALUES_NAME_SHOW_NAME
public
mixed
SHOW_OPTION_VALUES_NAME_SHOW_NAME
= 'showName'
WARNING_POSITION_HEADER
public
mixed
WARNING_POSITION_HEADER
= 'header'
WARNING_POSITION_LINE
public
mixed
WARNING_POSITION_LINE
= 'line'
GIFTS_PRESENTATION_VALUES
protected
mixed
GIFTS_PRESENTATION_VALUES
= [self::GIFTS_PRESENTATION_PRODUCTS_BLOCK, self::GIFTS_PRESENTATION_INDEPENDENT]
MODE_VALUES
protected
mixed
MODE_VALUES
= [self::MODE_DISCLOSURE, self::MODE_CASH_TICKET]
SHOW_OPTION_VALUES_NAME_VALUES
protected
mixed
SHOW_OPTION_VALUES_NAME_VALUES
= [self::SHOW_OPTION_VALUES_NAME_NOT_SHOW, self::SHOW_OPTION_VALUES_NAME_SHOW_NAME, self::SHOW_OPTION_VALUES_NAME_SHOW_DESCRIPTION]
TABLE_COLUMNS
protected
mixed
TABLE_COLUMNS
= ['info', 'price', 'quantity', 'discounts', 'subtotal']
WARNING_POSITION_VALUES
protected
mixed
WARNING_POSITION_VALUES
= [self::WARNING_POSITION_HEADER, self::WARNING_POSITION_LINE]
Properties
$additionalItems
public
string
$additionalItems
= self::ADDITIONAL_ITEMS_PRESENTATION
$basket
public
Basket|null
$basket
= null
$editable
public
bool
$editable
= false
$editableGifts
public
bool
$editableGifts
= false
$errorWarningPosition
public
string
$errorWarningPosition
= self::WARNING_POSITION_HEADER
$giftsPresentation
public
string
$giftsPresentation
= self::GIFTS_PRESENTATION_PRODUCTS_BLOCK
$hiddenWarningCodes
public
array<string|int, mixed>
$hiddenWarningCodes
= []
$infoWarningPosition
public
string
$infoWarningPosition
= self::WARNING_POSITION_HEADER
$linkable
public
bool
$linkable
= true
$mode
public
string
$mode
= self::MODE_DISCLOSURE
$productsBundleItemTemplate
public
string|null
$productsBundleItemTemplate
= null
$productsBundleTemplate
public
string|null
$productsBundleTemplate
= null
$productSelectableGiftTemplate
public
string|null
$productSelectableGiftTemplate
= null
$productsGiftTemplate
public
string|null
$productsGiftTemplate
= null
$productsTemplate
public
string|null
$productsTemplate
= null
$quantityPlugin
public
bool
$quantityPlugin
= false
$routeType
public
string
$routeType
= ''
$selectableBoxRows
public
int
$selectableBoxRows
= 5
$showBrand
public
bool
$showBrand
= false
$showCustomTagPositions
public
array<string|int, mixed>
$showCustomTagPositions
= []
$showCustomTags
public
bool
$showCustomTags
= false
$showDevolutionButton
public
bool
$showDevolutionButton
= false
$showDiscountName
public
bool
$showDiscountName
= false
$showDiscounts
public
bool
$showDiscounts
= true
$showDiscountValue
public
string
$showDiscountValue
= self::SHOW_DISCOUNT_VALUE_BOTH
$showFooter
public
bool
$showFooter
= true
$showFreeTaxMessage
public
bool
$showFreeTaxMessage
= false
$showImage
public
bool
$showImage
= true
$showManufacturerSku
public
bool
$showManufacturerSku
= false
$showOffsets
public
bool
$showOffsets
= false
$showOptions
public
bool
$showOptions
= true
$showOptionValuesName
public
string
$showOptionValuesName
= self::SHOW_OPTION_VALUES_NAME_SHOW_NAME
$showOptionValuesSku
public
bool
$showOptionValuesSku
= false
$showPercentDifference
public
bool
$showPercentDifference
= false
$showPreviousPrice
public
bool
$showPreviousPrice
= false
$showPriceDifference
public
bool
$showPriceDifference
= false
$showPrices
public
bool
$showPrices
= true
$showProductStockId
public
bool
$showProductStockId
= false
$showSelectableBox
public
bool
$showSelectableBox
= false
$showShippingSection
public
bool
$showShippingSection
= false
$showSku
public
bool
$showSku
= false
$showTaxDisclosure
public
bool
$showTaxDisclosure
= true
$showTaxesZeroTotalIncrement
public
bool
$showTaxesZeroTotalIncrement
= false
$showTaxIncluded
public
bool|null
$showTaxIncluded
= null
$showTaxName
public
bool|null
$showTaxName
= true
$showWarnings
public
bool
$showWarnings
= true
$showWarningsBlock
public
bool
$showWarningsBlock
= true
$showZeroDiscount
public
bool
$showZeroDiscount
= false
$showZeroPayment
public
bool
$showZeroPayment
= true
$showZeroShipping
public
bool
$showZeroShipping
= false
$tableClass
public
string
$tableClass
= ''
$totalProductDiscounts
public
float
$totalProductDiscounts
= 0
$warningWarningPosition
public
string
$warningWarningPosition
= self::WARNING_POSITION_HEADER
$disclosure
protected
array<string|int, mixed>
$disclosure
= []
$footerRows
protected
array<string|int, mixed>
$footerRows
= []
$languageSheet
protected
Language|null
$languageSheet
= null
$tableColumns
protected
int
$tableColumns
= 0
Methods
__construct()
Constructor method for Output class.
public
__construct(array<string|int, mixed> $arguments, Language $languageSheet) : mixed
Parameters
- $arguments : array<string|int, mixed>
- $languageSheet : Language
Tags
Return values
mixed —colspanCalculator()
Util for calculate colspan value of a tr depending tbody columns, default for extra table tr (row) with 2 td
public
static colspanCalculator(int $tableBodyTdLength[, int $thisRowTdLength = 2 ][, int $tdWithColspanLength = 1 ]) : int
Parameters
- $tableBodyTdLength : int
-
Actual BasketRow total output columns (td)
- $thisRowTdLength : int = 2
-
Total row columns for which we are calculating colspan
- $tdWithColspanLength : int = 1
-
Total row columns with colspan to calculate, for which we are calculating colspan
Return values
int —getTableBodyColumns()
Based on the maximum possible columns and the parameters, calculate the maximum columns of the table's body.
public
getTableBodyColumns() : int
Return values
int —getViewParameters()
This method returns all calculated arguments and new parameters for BasketViewHelper.php
public
getViewParameters() : array<string|int, mixed>
Return values
array<string|int, mixed> —getProperties()
Return macro use properties
protected
getProperties() : array<string|int, mixed>
Return values
array<string|int, mixed> —getRowClassName()
Get basketRow classes for <tr> html
protected
getRowClassName(mixed $basketRow) : string
Parameters
- $basketRow : mixed
Return values
string —parametersRestrictions()
Depending mode parameter override other parameters
protected
parametersRestrictions() : void
Return values
void —setCalculatedAttributes()
protected
setCalculatedAttributes(mixed $structure) : void
Parameters
- $structure : mixed
Return values
void —setDisclosure()
protected
setDisclosure() : void
Return values
void —setFooter()
protected
setFooter() : void
Return values
void —setTotalProductDiscounts()
Sets the sum of the total discounts of all rows
protected
setTotalProductDiscounts() : void
Return values
void —validateMainParams()
This method check that the main params stored in this parent class are OK
protected
validateMainParams() : array<string|int, mixed>