![]() 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/old/app/code/Cnc/Catalog/Block/Product/Grouped/View/ |
<?php /** * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @author Radosław Łańcucki <[email protected]> * @copyright Copyright (c) 2022 KDC (https://digitalcommerce.kaliop.com) */ declare(strict_types=1); namespace Cnc\Catalog\Block\Product\Grouped\View; use Cnc\Checkout\Model\Config; use Magento\Catalog\Api\Data\ProductInterface; class Source extends \Ecombricks\InventoryCatalog\Block\Product\View\Source { /** * @var ProductInterface */ private $product; /** * @override Block dedicated for rendering purposes of Grouped associated Products * @return ProductInterface|\Magento\Catalog\Model\Product */ public function getProduct() { if (!$this->product) { $product = $this->getData('product'); if (!$product instanceof ProductInterface) { $product = parent::getProduct(); } $this->product = $product; } return $this->product; } /** * @return string */ public function getCurrentSourceCode(): string { /** @var \Cnc\Catalog\Model\Product\Stock $stockViewModel */ $stockViewModel = $this->getData('stock_view_model'); $option = null; if ($stockViewModel) { try { $option = $stockViewModel->getDeliveryDelayOption($this->getProduct()); } catch (\Exception $e) { $this->_logger->error($e->getMessage()); } } return (is_array($option) && isset($option['source'])) ? $option['source'] : Config::SHIPPING_SOURCE_FR_CODE; } }