Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BackordersCondition.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
12 
17 {
21  private $configuration;
22 
26  public function __construct(StockConfigurationInterface $configuration)
27  {
28  $this->configuration = $configuration;
29  }
30 
35  public function execute(Select $select): string
36  {
37  $globalBackorders = (int)$this->configuration->getBackorders();
38 
39  $condition = (1 === $globalBackorders)
40  ? 'legacy_stock_item.use_config_backorders = 1'
41  : 'legacy_stock_item.use_config_backorders = 0 AND legacy_stock_item.backorders = 1';
42  $condition .= ' AND (legacy_stock_item.min_qty >= 0 OR legacy_stock_item.qty > legacy_stock_item.min_qty)';
43 
44  return $condition;
45  }
46 }
$configuration
Definition: index.php:33