|
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
| getAmounts () | |
| hasNegativeItemAmount () | |
Public Member Functions inherited from Cart | |
| __construct (\Magento\Payment\Model\Cart\SalesModel\Factory $salesModelFactory, \Magento\Framework\Event\ManagerInterface $eventManager, $salesModel) | |
| getSalesModel () | |
| addTax ($taxAmount) | |
| setTax ($taxAmount) | |
| getTax () | |
| addDiscount ($discountAmount) | |
| setDiscount ($discountAmount) | |
| getDiscount () | |
| addShipping ($shippingAmount) | |
| setShipping ($shippingAmount) | |
| getShipping () | |
| addSubtotal ($subtotalAmount) | |
| getSubtotal () | |
| addCustomItem ($name, $qty, $amount, $identifier=null) | |
| getAllItems () | |
| getAmounts () | |
| setTransferShippingAsItem () | |
| setTransferDiscountAsItem () | |
Protected Member Functions | |
| _calculateCustomItemsSubtotal () | |
| _validate () | |
| _importItemsFromSalesModel () | |
| _applyDiscountTaxCompensationWorkaround (\Magento\Payment\Model\Cart\SalesModel\SalesModelInterface $salesEntity) | |
Protected Member Functions inherited from Cart | |
| _collectItemsAndAmounts () | |
| _importItemsFromSalesModel () | |
| _calculateCustomItemsSubtotal () | |
| _setTransferFlag ($flagType, $value) | |
| _setAmount ($amountType, $amount) | |
| _addAmount ($amountType, $amount) | |
| _getAmount ($amountType) | |
| _createItemFromData ($name, $qty, $amount, $identifier=null) | |
| _resetAmounts () | |
Protected Attributes | |
| $_areAmountsValid = false | |
Protected Attributes inherited from Cart | |
| $_salesModel | |
| $_eventManager | |
| $_amounts | |
| $_customItems = [] | |
| $_salesModelItems = [] | |
| $_transferFlags = [] | |
| $_itemsCollectingRequired = true | |
Additional Inherited Members | |
Data Fields inherited from Cart | |
| const | AMOUNT_TAX = 'tax' |
| const | AMOUNT_SHIPPING = 'shipping' |
| const | AMOUNT_DISCOUNT = 'discount' |
| const | AMOUNT_SUBTOTAL = 'subtotal' |
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
|
protected |
Add "hidden" discount and shipping tax
Go ahead, try to understand ]:->
Tax settings for getting "discount tax":
Test case for getting "hidden shipping tax":
| \Magento\Payment\Model\Cart\SalesModel\SalesModelInterface | $salesEntity |
Definition at line 177 of file Cart.php.
|
protected |
Calculate subtotal from custom items
Definition at line 52 of file Cart.php.
|
protected |
Import items from sales model with workarounds for PayPal
Definition at line 113 of file Cart.php.
|
protected |
Check the line items and totals according to PayPal business logic limitations
numbers are intentionally converted to strings because of possible comparison error see http://php.net/float
Definition at line 65 of file Cart.php.
| getAmounts | ( | ) |
| hasNegativeItemAmount | ( | ) |