72 lines
1.4 KiB
PHP
Executable File
72 lines
1.4 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 IsActive extends AbstractSource implements SourceInterface, OptionSourceInterface
|
|
{
|
|
/**#@+
|
|
* Product Status values
|
|
*/
|
|
const STATUS_ENABLED = 1;
|
|
|
|
const STATUS_DISABLED = 0;
|
|
|
|
/**#@-*/
|
|
|
|
/**
|
|
* Retrieve Visible Status Ids
|
|
*
|
|
* @return int[]
|
|
*/
|
|
public function getVisibleStatusIds()
|
|
{
|
|
return [self::STATUS_ENABLED];
|
|
}
|
|
|
|
/**
|
|
* Retrieve Saleable Status Ids
|
|
* Default Product Enable status
|
|
*
|
|
* @return int[]
|
|
*/
|
|
public function getSaleableStatusIds()
|
|
{
|
|
return [self::STATUS_ENABLED];
|
|
}
|
|
|
|
/**
|
|
* Retrieve option array
|
|
*
|
|
* @return string[]
|
|
*/
|
|
public function getOptionArray()
|
|
{
|
|
return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
} |