84 lines
1.7 KiB
PHP
Executable File
84 lines
1.7 KiB
PHP
Executable File
<?php
|
|
namespace JR\NetSuite\Model\Config\Source;
|
|
|
|
use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
|
|
use Magento\Eav\Model\Entity\Attribute\Source\SourceInterface;
|
|
use Magento\Framework\Data\OptionSourceInterface;
|
|
|
|
/**
|
|
* Product status functionality model
|
|
*
|
|
* @api
|
|
* @since 100.0.2
|
|
*/
|
|
class Status extends AbstractSource implements SourceInterface, OptionSourceInterface
|
|
{
|
|
/**#@+
|
|
* Product Status values
|
|
*/
|
|
const STATUS_PENDING = 'pending';
|
|
|
|
const STATUS_PROCESSING = 'processing';
|
|
|
|
const STATUS_SUCCESS = 'success';
|
|
|
|
const STATUS_FAILED = 'failed';
|
|
|
|
const STATUS_ERROR = 'error';
|
|
|
|
|
|
/**#@-*/
|
|
|
|
/**
|
|
* Retrieve Visible Status Ids
|
|
*
|
|
* @return string[]
|
|
*/
|
|
public function getVisibleStatusIds()
|
|
{
|
|
return [self::STATUS_SUCCESS];
|
|
}
|
|
|
|
/**
|
|
* Retrieve Saleable Status Ids
|
|
* Default Product Enable status
|
|
*
|
|
* @return string[]
|
|
*/
|
|
public function getSaleableStatusIds()
|
|
{
|
|
return [self::STATUS_SUCCESS];
|
|
}
|
|
|
|
/**
|
|
* Retrieve option array
|
|
*
|
|
* @return string[]
|
|
*/
|
|
public function getOptionArray()
|
|
{
|
|
return [
|
|
self::STATUS_PENDING => __('Pending'),
|
|
self::STATUS_ERROR => __('Error'),
|
|
self::STATUS_FAILED => __('Failed'),
|
|
self::STATUS_PROCESSING => __('Processing'),
|
|
self::STATUS_SUCCESS => __('Success'),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Retrieve option array with empty value
|
|
*
|
|
* @return string[]
|
|
*/
|
|
public function getAllOptions()
|
|
{
|
|
$result = [];
|
|
|
|
foreach (self::getOptionArray() as $index => $value) {
|
|
$result[] = ['value' => $index, 'label' => $value];
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
} |