![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/vendor/magento/module-catalog-inventory/Block/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\CatalogInventory\Block; use Magento\Framework\DataObject\IdentityInterface; use Magento\Framework\View\Element\Template; /** * Product qty increments block * * @api * @since 100.0.2 * * @deprecated 100.3.0 Replaced with Multi Source Inventory * @link https://devdocs.magento.com/guides/v2.4/inventory/index.html * @link https://devdocs.magento.com/guides/v2.4/inventory/inventory-api-reference.html */ class Qtyincrements extends Template implements IdentityInterface { /** * Qty Increments cache * * @var float|false */ protected $_qtyIncrements; /** * Core registry * * @var \Magento\Framework\Registry */ protected $_coreRegistry; /** * @var \Magento\CatalogInventory\Api\StockRegistryInterface */ protected $stockRegistry; /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, array $data = [] ) { $this->_coreRegistry = $registry; $this->stockRegistry = $stockRegistry; parent::__construct($context, $data); } /** * Retrieve current product object * * @return \Magento\Catalog\Model\Product */ public function getProduct() { return $this->_coreRegistry->registry('current_product'); } /** * Retrieve current product name * * @return string */ public function getProductName() { return $this->getProduct()->getName(); } /** * Retrieve product qty increments * * @return float|false */ public function getProductQtyIncrements() { if ($this->_qtyIncrements === null) { $stockItem = $this->stockRegistry->getStockItem( $this->getProduct()->getId(), $this->getProduct()->getStore()->getWebsiteId() ); $this->_qtyIncrements = $stockItem->getQtyIncrements(); if (!$this->getProduct()->isSaleable()) { $this->_qtyIncrements = false; } } return $this->_qtyIncrements; } /** * Return identifiers for produced content * * @return array */ public function getIdentities() { return $this->getProduct()->getIdentities(); } }