Last active
October 14, 2019 14:29
-
-
Save magevision/362a62928b06dd7621eac8d7601f8014 to your computer and use it in GitHub Desktop.
GetAListOfOrderStatusProgrammatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace MageVision\Blog49\Model; | |
use Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory; | |
class OrderStatus | |
{ | |
/** | |
* @var CollectionFactory $statusCollectionFactory | |
*/ | |
protected $orderStatusCollectionFactory; | |
/** | |
* @param CollectionFactory $orderStatusCollectionFactory | |
*/ | |
public function __construct( | |
CollectionFactory $orderStatusCollectionFactory | |
) { | |
$this->orderStatusCollectionFactory = $orderStatusCollectionFactory; | |
} | |
/** | |
* Get order status options | |
* | |
* @return array | |
*/ | |
public function getOrderStatusOptions(): array | |
{ | |
$options = $this->orderStatusCollectionFactory->create()->toOptionArray(); | |
return $options; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<field id="blog_49_order_status" translate="label" type="select" sortOrder="10" showInDefault="1" showInStore="1" showInWebsite="1"> | |
<label>Order Status</label> | |
<source_model>Magento\Sales\Model\ResourceModel\Order\Status\Collection</source_model> | |
</field> | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment