Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
Grid Class Reference
Inheritance diagram for Grid:
AbstractCreate Widget Template Template AbstractBlock DataObject BlockInterface

Public Member Functions

 __construct (\Magento\Backend\Block\Template\Context $context, \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, PriceCurrencyInterface $priceCurrency, \Magento\Wishlist\Model\WishlistFactory $wishlistFactory, \Magento\GiftMessage\Model\Save $giftMessageSave, \Magento\Tax\Model\Config $taxConfig, \Magento\Tax\Helper\Data $taxData, \Magento\GiftMessage\Helper\Message $messageHelper, StockRegistryInterface $stockRegistry, StockStateInterface $stockState, array $data=[])
 
 getItems ()
 
 getSession ()
 
 getItemEditablePrice ($item)
 
 getOriginalEditablePrice ($item)
 
 getItemOrigPrice ($item)
 
 isGiftMessagesAvailable ($item=null)
 
 isAllowedForGiftMessage ($item)
 
 displayTotalsIncludeTax ()
 
 getSubtotal ()
 
 getSubtotalWithDiscount ()
 
 getDiscountAmount ()
 
 getQuoteAddress ()
 
 usedCustomPriceForItem ($item)
 
 canApplyCustomPrice ($item)
 
 getQtyTitle ($item)
 
 getTierHtml ($item)
 
 getCustomOptions (Item $item)
 
 getMoveToCustomerStorage ()
 
 displaySubtotalInclTax ($item)
 
 displayOriginalPriceInclTax ($item)
 
 displayRowTotalWithDiscountInclTax ($item)
 
 getInclExclTaxMessage ()
 
 getStore ()
 
 getConfigureButtonHtml ($item)
 
 getItemExtraInfo ($item)
 
 isMoveToWishlistAllowed ($item)
 
 getCustomerWishlists ()
 
 getItemUnitPriceHtml (Item $item)
 
 getItemRowTotalHtml (Item $item)
 
 getItemRowTotalWithDiscountHtml (Item $item)
 
- Public Member Functions inherited from AbstractCreate
 __construct (\Magento\Backend\Block\Template\Context $context, \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, PriceCurrencyInterface $priceCurrency, array $data=[])
 
 getCreateOrderModel ()
 
 getQuote ()
 
 getCustomerId ()
 
 getStore ()
 
 getStoreId ()
 
 formatPrice ($value)
 
 getItemPrice (Product $product)
 
 convertPrice ($value, $format=true)
 
 getProduct ($item)
 
- Public Member Functions inherited from Widget
 getId ()
 
 getSuffixId ($suffix)
 
 getHtmlId ()
 
 getCurrentUrl ($params=[])
 
 getButtonHtml ($label, $onclick, $class='', $buttonId=null, $dataAttr=[])
 
- Public Member Functions inherited from Template
 __construct (\Magento\Backend\Block\Template\Context $context, array $data=[])
 
 getFormKey ()
 
 isOutputEnabled ($moduleName=null)
 
 getAuthorization ()
 
 getToolbar ()
 
- Public Member Functions inherited from Template
 __construct (Template\Context $context, array $data=[])
 
 setTemplateContext ($templateContext)
 
 getTemplate ()
 
 setTemplate ($template)
 
 getTemplateFile ($template=null)
 
 getArea ()
 
 assign ($key, $value=null)
 
 fetchView ($fileName)
 
 getBaseUrl ()
 
 getObjectData (\Magento\Framework\DataObject $object, $key)
 
 getCacheKeyInfo ()
 
- Public Member Functions inherited from AbstractBlock
 __construct (\Magento\Framework\View\Element\Context $context, array $data=[])
 
 getJsLayout ()
 
 getRequest ()
 
 getParentBlock ()
 
 setLayout (\Magento\Framework\View\LayoutInterface $layout)
 
 getLayout ()
 
 setNameInLayout ($name)
 
 getChildNames ()
 
 setAttribute ($name, $value=null)
 
 setChild ($alias, $block)
 
 addChild ($alias, $block, $data=[])
 
 unsetChild ($alias)
 
 unsetCallChild ($alias, $callback, $result, $params)
 
 unsetChildren ()
 
 getChildBlock ($alias)
 
 getChildHtml ($alias='', $useCache=true)
 
 getChildChildHtml ($alias, $childChildAlias='', $useCache=true)
 
 getBlockHtml ($name)
 
 insert ($element, $siblingName=0, $after=true, $alias='')
 
 append ($element, $alias='')
 
 getGroupChildNames ($groupName)
 
 getChildData ($alias, $key='')
 
 getUiId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getJsId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getUrl ($route='', $params=[])
 
 getViewFileUrl ($fileId, array $params=[])
 
 formatDate ( $date=null, $format=\IntlDateFormatter::SHORT, $showTime=false, $timezone=null)
 
 formatTime ( $time=null, $format=\IntlDateFormatter::SHORT, $showDate=false)
 
 getModuleName ()
 
 escapeHtml ($data, $allowedTags=null)
 
 escapeJs ($string)
 
 escapeHtmlAttr ($string, $escapeSingleQuote=true)
 
 escapeCss ($string)
 
 stripTags ($data, $allowableTags=null, $allowHtmlEntities=false)
 
 escapeUrl ($string)
 
 escapeXssInUrl ($data)
 
 escapeQuote ($data, $addSlashes=false)
 
 escapeJsQuote ($data, $quote='\'')
 
 getNameInLayout ()
 
 getCacheKeyInfo ()
 
 getCacheKey ()
 
 getVar ($name, $module=null)
 
 isScopePrivate ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 
- Public Member Functions inherited from BlockInterface
 toHtml ()
 

Protected Member Functions

 _construct ()
 
 _getBundleTierPriceInfo ($prices)
 
 _getTierPriceInfo ($prices)
 
- Protected Member Functions inherited from AbstractCreate
 _getSession ()
 
- Protected Member Functions inherited from Widget
 _addBreadcrumb ($label, $title=null, $link=null)
 
- Protected Member Functions inherited from Template
 _toHtml ()
 
- Protected Member Functions inherited from Template
 _construct ()
 
 _toHtml ()
 
 getRootDirectory ()
 
 getMediaDirectory ()
 
- Protected Member Functions inherited from AbstractBlock
 _construct ()
 
 _prepareLayout ()
 
 _beforeToHtml ()
 
 _afterToHtml ($html)
 
 _toHtml ()
 
 _getNotFoundUrl ($route='', $params=['_direct'=> 'core/index/notFound'])
 
 getCacheTags ()
 
 getCacheLifetime ()
 
 _loadCache ()
 
 _saveCache ($data)
 
 _getSidPlaceholder ($cacheKey=null)
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Protected Attributes

 $_moveToCustomerStorage = true
 
 $_taxData
 
 $_wishlistFactory
 
 $_giftMessageSave
 
 $_taxConfig
 
 $_messageHelper
 
 $stockRegistry
 
 $stockState
 
- Protected Attributes inherited from AbstractCreate
 $_sessionQuote
 
 $_orderCreate
 
 $priceCurrency
 
- Protected Attributes inherited from Template
 $_authorization
 
 $mathRandom
 
 $_backendSession
 
 $formKey
 
 $nameBuilder
 
- Protected Attributes inherited from Template
 $_viewVars = []
 
 $_baseUrl
 
 $_jsUrl
 
 $_allowSymlinks
 
 $_filesystem
 
 $_template
 
 $templateEnginePool
 
 $_storeManager
 
 $_appState
 
 $directory
 
 $templateContext
 
 $pageConfig
 
 $resolver
 
 $validator
 
- Protected Attributes inherited from AbstractBlock
 $_design
 
 $_session
 
 $_sidResolver
 
 $_nameInLayout
 
 $_layout
 
 $jsLayout = []
 
 $_request
 
 $_urlBuilder
 
 $_eventManager
 
 $_frontController
 
 $_assetRepo
 
 $_viewConfig
 
 $_cacheState
 
 $_logger
 
 $_escaper
 
 $filterManager
 
 $_localeDate
 
 $inlineTranslation
 
 $_isScopePrivate = false
 
 $_scopeConfig
 
 $_cache
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractBlock
static extractModuleName ($className)
 
- Data Fields inherited from Template
const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink'
 
- Data Fields inherited from AbstractBlock
const CACHE_GROUP = \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER
 
const CACHE_KEY_PREFIX = 'BLOCK_'
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Adminhtml sales order create items grid block @api @SuppressWarnings(PHPMD.CouplingBetweenObjects)

Since
100.0.2

Definition at line 21 of file Grid.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Backend\Block\Template\Context  $context,
\Magento\Backend\Model\Session\Quote  $sessionQuote,
\Magento\Sales\Model\AdminOrder\Create  $orderCreate,
PriceCurrencyInterface  $priceCurrency,
\Magento\Wishlist\Model\WishlistFactory  $wishlistFactory,
\Magento\GiftMessage\Model\Save  $giftMessageSave,
\Magento\Tax\Model\Config  $taxConfig,
\Magento\Tax\Helper\Data  $taxData,
\Magento\GiftMessage\Helper\Message  $messageHelper,
StockRegistryInterface  $stockRegistry,
StockStateInterface  $stockState,
array  $data = [] 
)
Parameters
\Magento\Backend\Block\Template\Context$context
\Magento\Backend\Model\Session\Quote$sessionQuote
\Magento\Sales\Model\AdminOrder\Create$orderCreate
PriceCurrencyInterface$priceCurrency
\Magento\Wishlist\Model\WishlistFactory$wishlistFactory
\Magento\GiftMessage\Model\Save$giftMessageSave
\Magento\Tax\Model\Config$taxConfig
\Magento\Tax\Helper\Data$taxData
\Magento\GiftMessage\Helper\Message$messageHelper
StockRegistryInterface$stockRegistry
StockStateInterface$stockState
array$data@SuppressWarnings(PHPMD.ExcessiveParameterList)

Definition at line 90 of file Grid.php.

103  {
104  $this->_messageHelper = $messageHelper;
105  $this->_wishlistFactory = $wishlistFactory;
106  $this->_giftMessageSave = $giftMessageSave;
107  $this->_taxConfig = $taxConfig;
108  $this->_taxData = $taxData;
109  $this->stockRegistry = $stockRegistry;
110  $this->stockState = $stockState;
111  parent::__construct($context, $sessionQuote, $orderCreate, $priceCurrency, $data);
112  }

Member Function Documentation

◆ _construct()

_construct ( )
protected

Constructor

Returns
void

Definition at line 119 of file Grid.php.

120  {
121  parent::_construct();
122  $this->setId('sales_order_create_search_grid');
123  }

◆ _getBundleTierPriceInfo()

_getBundleTierPriceInfo (   $prices)
protected

Get tier price info to display in grid for Bundle product

Parameters
array$prices
Returns
string[]

Definition at line 398 of file Grid.php.

399  {
400  $info = [];
401  foreach ($prices as $data) {
402  $qty = $data['price_qty'] * 1;
403  $info[] = __('%1 with %2 discount each', $qty, $data['price'] * 1 . '%');
404  }
405  return $info;
406  }
__()
Definition: __.php:13
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52

◆ _getTierPriceInfo()

_getTierPriceInfo (   $prices)
protected

Get tier price info to display in grid

Parameters
array$prices
Returns
string[]

Definition at line 414 of file Grid.php.

415  {
416  $info = [];
417  foreach ($prices as $data) {
418  $qty = $data['price_qty'] * 1;
419  $price = $this->convertPrice($data['price']);
420  $info[] = __('%1 for %2', $qty, $price);
421  }
422  return $info;
423  }
__()
Definition: __.php:13
$price
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52

◆ canApplyCustomPrice()

canApplyCustomPrice (   $item)

Define if custom price can be applied for specified item

Parameters
Item$item
Returns
bool

Definition at line 341 of file Grid.php.

342  {
343  return !$item->isChildrenCalculated();
344  }

◆ displayOriginalPriceInclTax()

displayOriginalPriceInclTax (   $item)

Display original price including tax

Parameters
Item$item
Returns
float

Definition at line 488 of file Grid.php.

489  {
490  $tax = 0;
491  if ($item->getTaxPercent()) {
492  $tax = $item->getPrice() * ($item->getTaxPercent() / 100);
493  }
494  return $this->convertPrice($item->getPrice() + $tax / $item->getQty());
495  }

◆ displayRowTotalWithDiscountInclTax()

displayRowTotalWithDiscountInclTax (   $item)

Display row total with discount including tax

Parameters
Item$item
Returns
string

Definition at line 503 of file Grid.php.

504  {
505  $tax = $item->getTaxAmount() ? $item->getTaxAmount() : 0;
506  return $this->formatPrice($item->getRowTotal() - $item->getDiscountAmount() + $tax);
507  }

◆ displaySubtotalInclTax()

displaySubtotalInclTax (   $item)

Display subtotal including tax

Parameters
Item$item
Returns
string

Definition at line 472 of file Grid.php.

473  {
474  if ($item->getTaxBeforeDiscount()) {
475  $tax = $item->getTaxBeforeDiscount();
476  } else {
477  $tax = $item->getTaxAmount() ? $item->getTaxAmount() : 0;
478  }
479  return $this->formatPrice($item->getRowTotal() + $tax);
480  }

◆ displayTotalsIncludeTax()

displayTotalsIncludeTax ( )

Check if we need display grid totals include tax

Returns
bool

Definition at line 258 of file Grid.php.

259  {
260  $result = $this->_taxConfig->displayCartSubtotalInclTax($this->getStore())
261  || $this->_taxConfig->displayCartSubtotalBoth($this->getStore());
262  return $result;
263  }

◆ getConfigureButtonHtml()

getConfigureButtonHtml (   $item)

Return html button which calls configure window

Parameters
Item$item
Returns
string

Definition at line 539 of file Grid.php.

540  {
541  $product = $item->getProduct();
542 
543  $options = ['label' => __('Configure')];
544  if ($product->canConfigure()) {
545  $options['onclick'] = sprintf('order.showQuoteItemConfiguration(%s)', $item->getId());
546  } else {
547  $options['class'] = ' disabled';
548  $options['title'] = __('This product does not have any configurable options');
549  }
550 
551  return $this->getLayout()->createBlock(
552  \Magento\Backend\Block\Widget\Button::class
553  )->setData($options)->toHtml();
554  }
__()
Definition: __.php:13

◆ getCustomerWishlists()

getCustomerWishlists ( )

Retrieve collection of customer wishlists

Returns
\Magento\Wishlist\Model\ResourceModel\Wishlist\Collection

Definition at line 583 of file Grid.php.

584  {
585  return $this->_wishlistFactory->create()->getCollection()->filterByCustomerId($this->getCustomerId());
586  }

◆ getCustomOptions()

getCustomOptions ( Item  $item)

Get Custom Options of item

Parameters
Item$item
Returns
string
Deprecated:
101.0.0

Definition at line 433 of file Grid.php.

434  {
435  $optionStr = '';
436  $this->_moveToCustomerStorage = true;
437  if ($optionIds = $item->getOptionByCode('option_ids')) {
438  foreach (explode(',', $optionIds->getValue()) as $optionId) {
439  $option = $item->getProduct()->getOptionById($optionId);
440  if ($option) {
441  $optionStr .= $option->getTitle() . ':';
442  $quoteItemOption = $item->getOptionByCode('option_' . $option->getId());
443  $group = $option->groupFactory($option->getType())
444  ->setOption($option)
445  ->setQuoteItemOption($quoteItemOption);
446 
447  $optionStr .= $group->getEditableOptionValue($quoteItemOption->getValue());
448  $optionStr .= "\n";
449  }
450  }
451  }
452  return $optionStr;
453  }
$group
Definition: sections.phtml:16

◆ getDiscountAmount()

getDiscountAmount ( )

Get discount amount

Returns
float

Definition at line 305 of file Grid.php.

306  {
307  return $this->getQuote()->getShippingAddress()->getDiscountAmount();
308  }

◆ getInclExclTaxMessage()

getInclExclTaxMessage ( )

Get including/excluding tax message

Returns
\Magento\Framework\Phrase

Definition at line 514 of file Grid.php.

515  {
516  if ($this->_taxData->priceIncludesTax($this->getStore())) {
517  return __('* - Enter custom price including tax');
518  } else {
519  return __('* - Enter custom price excluding tax');
520  }
521  }
__()
Definition: __.php:13

◆ getItemEditablePrice()

getItemEditablePrice (   $item)

Get item editable price

Parameters
Item$item
Returns
float

Definition at line 190 of file Grid.php.

191  {
192  return $item->getCalculationPrice() * 1;
193  }

◆ getItemExtraInfo()

getItemExtraInfo (   $item)

Get order item extra info block

Parameters
Item$item
Returns
\Magento\Framework\View\Element\AbstractBlock

Definition at line 562 of file Grid.php.

563  {
564  return $this->getLayout()->getBlock('order_item_extra_info')->setItem($item);
565  }

◆ getItemOrigPrice()

getItemOrigPrice (   $item)

Get item original price

Parameters
Item$item
Returns
float

Definition at line 223 of file Grid.php.

224  {
225  return $this->convertPrice($item->getPrice());
226  }

◆ getItemRowTotalHtml()

getItemRowTotalHtml ( Item  $item)

Get the item row total html

Parameters
Item$item
Returns
string

Definition at line 607 of file Grid.php.

608  {
609  $block = $this->getLayout()->getBlock('item_row_total');
610  $block->setItem($item);
611  return $block->toHtml();
612  }
$block
Definition: block.php:8

◆ getItemRowTotalWithDiscountHtml()

getItemRowTotalWithDiscountHtml ( Item  $item)

Return html for row total with discount

Parameters
Item$item
Returns
string

Definition at line 620 of file Grid.php.

621  {
622  $block = $this->getLayout()->getBlock('item_row_total_with_discount');
623  $block->setItem($item);
624  return $block->toHtml();
625  }
$block
Definition: block.php:8

◆ getItems()

getItems ( )

Get items

Returns
Item[]

Definition at line 130 of file Grid.php.

131  {
132  $items = $this->getParentBlock()->getItems();
133  $oldSuperMode = $this->getQuote()->getIsSuperMode();
134  $this->getQuote()->setIsSuperMode(false);
135  foreach ($items as $item) {
136  // To dispatch inventory event sales_quote_item_qty_set_after, set item qty
137  $item->setQty($item->getQty());
138 
139  if (!$item->getMessage()) {
140  //Getting product ids for stock item last quantity validation before grid display
141  $stockItemToCheck = [];
142 
143  $childItems = $item->getChildren();
144  if (count($childItems)) {
145  foreach ($childItems as $childItem) {
146  $stockItemToCheck[] = $childItem->getProduct()->getId();
147  }
148  } else {
149  $stockItemToCheck[] = $item->getProduct()->getId();
150  }
151 
152  foreach ($stockItemToCheck as $productId) {
153  $check = $this->stockState->checkQuoteItemQty(
154  $productId,
155  $item->getQty(),
156  $item->getQty(),
157  $item->getQty(),
158  $this->getQuote()->getStore()->getWebsiteId()
159  );
160  $item->setMessage($check->getMessage());
161  $item->setHasError($check->getHasError());
162  }
163  }
164 
165  if ($item->getProduct()->getStatus() == ProductStatus::STATUS_DISABLED) {
166  $item->setMessage(__('This product is disabled.'));
167  $item->setHasError(true);
168  }
169  }
170  $this->getQuote()->setIsSuperMode($oldSuperMode);
171  return $items;
172  }
__()
Definition: __.php:13
$items

◆ getItemUnitPriceHtml()

getItemUnitPriceHtml ( Item  $item)

Get the item unit price html

Parameters
Item$item
Returns
string

Definition at line 594 of file Grid.php.

595  {
596  $block = $this->getLayout()->getBlock('item_unit_price');
597  $block->setItem($item);
598  return $block->toHtml();
599  }
$block
Definition: block.php:8

◆ getMoveToCustomerStorage()

getMoveToCustomerStorage ( )

Get flag for rights to move items to customer storage

Returns
bool @SuppressWarnings(PHPMD.BooleanGetMethodName)

Definition at line 461 of file Grid.php.

◆ getOriginalEditablePrice()

getOriginalEditablePrice (   $item)

Get original editable price

Parameters
Item$item
Returns
float

Definition at line 201 of file Grid.php.

202  {
203  if ($item->hasOriginalCustomPrice()) {
204  $result = $item->getOriginalCustomPrice() * 1;
205  } elseif ($item->hasCustomPrice()) {
206  $result = $item->getCustomPrice() * 1;
207  } else {
208  if ($this->_taxData->priceIncludesTax($this->getStore())) {
209  $result = $item->getPriceInclTax() * 1;
210  } else {
211  $result = $item->getOriginalPrice() * 1;
212  }
213  }
214  return $result;
215  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17

◆ getQtyTitle()

getQtyTitle (   $item)

Get qty title

Parameters
Item$item
Returns
\Magento\Framework\Phrase|string

Definition at line 352 of file Grid.php.

353  {
354  $prices = $item->getProduct()
355  ->getPriceInfo()
356  ->getPrice(\Magento\Catalog\Pricing\Price\TierPrice::PRICE_CODE)
357  ->getTierPriceList();
358  if ($prices) {
359  $info = [];
360  foreach ($prices as $data) {
361  $price = $this->convertPrice($data['price']);
362  $info[] = __('Buy %1 for price %2', $data['price_qty'], $price);
363  }
364  return implode(', ', $info);
365  } else {
366  return __('Item ordered qty');
367  }
368  }
__()
Definition: __.php:13
$price
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52

◆ getQuoteAddress()

getQuoteAddress ( )

Retrieve quote address

Returns
\Magento\Quote\Model\Quote\Address

Definition at line 315 of file Grid.php.

316  {
317  if ($this->getQuote()->isVirtual()) {
318  return $this->getQuote()->getBillingAddress();
319  } else {
320  return $this->getQuote()->getShippingAddress();
321  }
322  }

◆ getSession()

getSession ( )

Get session

Returns
SessionManagerInterface

Definition at line 179 of file Grid.php.

180  {
181  return $this->getParentBlock()->getSession();
182  }

◆ getStore()

getStore ( )

Get store

Returns
\Magento\Store\Model\Store

Definition at line 528 of file Grid.php.

529  {
530  return $this->getQuote()->getStore();
531  }

◆ getSubtotal()

getSubtotal ( )

Get subtotal

Returns
false|float

Definition at line 270 of file Grid.php.

271  {
272  $address = $this->getQuoteAddress();
273  if (!$this->displayTotalsIncludeTax()) {
274  return $address->getSubtotal();
275  }
276  if ($address->getSubtotalInclTax()) {
277  return $address->getSubtotalInclTax();
278  }
279  return $address->getSubtotal() + $address->getTaxAmount();
280  }
$address
Definition: customer.php:38

◆ getSubtotalWithDiscount()

getSubtotalWithDiscount ( )

Get subtotal with discount

Returns
float

Definition at line 287 of file Grid.php.

288  {
289  $address = $this->getQuoteAddress();
290  if ($this->displayTotalsIncludeTax()) {
291  return $address->getSubtotal()
292  + $address->getTaxAmount()
293  + $address->getDiscountAmount()
294  + $address->getDiscountTaxCompensationAmount();
295  } else {
296  return $address->getSubtotal() + $address->getDiscountAmount();
297  }
298  }
$address
Definition: customer.php:38

◆ getTierHtml()

getTierHtml (   $item)

Get tier price html

Parameters
Item$item
Returns
string

Definition at line 376 of file Grid.php.

377  {
378  $html = '';
379  $prices = $item->getProduct()->getTierPrice();
380  if ($prices) {
381  if ($item->getProductType() == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
383  } else {
384  $info = $this->_getTierPriceInfo($prices);
385  }
386 
387  $html = implode('<br />', $info);
388  }
389  return $html;
390  }
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52

◆ isAllowedForGiftMessage()

isAllowedForGiftMessage (   $item)

Check if allowed for gift message

Parameters
Item$item
Returns
bool

Definition at line 248 of file Grid.php.

249  {
250  return $this->_giftMessageSave->getIsAllowedQuoteItem($item);
251  }

◆ isGiftMessagesAvailable()

isGiftMessagesAvailable (   $item = null)

Check gift messages availability

Parameters
Item | null$item
Returns
bool|null|string

Definition at line 234 of file Grid.php.

235  {
236  if ($item === null) {
237  return $this->_messageHelper->isMessagesAllowed('items', $this->getQuote(), $this->getStore());
238  }
239  return $this->_messageHelper->isMessagesAllowed('item', $item, $this->getStore());
240  }

◆ isMoveToWishlistAllowed()

isMoveToWishlistAllowed (   $item)

Returns whether moving to wishlist is allowed for this item

Parameters
Item$item
Returns
bool

Definition at line 573 of file Grid.php.

574  {
575  return $item->getProduct()->isVisibleInSiteVisibility();
576  }

◆ usedCustomPriceForItem()

usedCustomPriceForItem (   $item)

Define if specified item has already applied custom price

Parameters
Item$item
Returns
bool

Definition at line 330 of file Grid.php.

331  {
332  return $item->hasCustomPrice();
333  }

Field Documentation

◆ $_giftMessageSave

$_giftMessageSave
protected

Definition at line 49 of file Grid.php.

◆ $_messageHelper

$_messageHelper
protected

Definition at line 63 of file Grid.php.

◆ $_moveToCustomerStorage

$_moveToCustomerStorage = true
protected

Definition at line 28 of file Grid.php.

◆ $_taxConfig

$_taxConfig
protected

Definition at line 56 of file Grid.php.

◆ $_taxData

$_taxData
protected

Definition at line 35 of file Grid.php.

◆ $_wishlistFactory

$_wishlistFactory
protected

Definition at line 42 of file Grid.php.

◆ $stockRegistry

$stockRegistry
protected

Definition at line 68 of file Grid.php.

◆ $stockState

$stockState
protected

Definition at line 73 of file Grid.php.


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