77 lines
1.6 KiB
PHP
Executable File
77 lines
1.6 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* @author 18th DigiTech Team
|
|
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
|
* @package Caratlane_NetSuite
|
|
*/
|
|
namespace Caratlane\NetSuite\Model\Config\Attribute\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_SUCCESS = 1;
|
|
|
|
const STATUS_FAILED = 0;
|
|
|
|
/**#@-*/
|
|
|
|
/**
|
|
* Retrieve Visible Status Ids
|
|
*
|
|
* @return int[]
|
|
*/
|
|
public function getVisibleStatusIds()
|
|
{
|
|
return [self::STATUS_SUCCESS];
|
|
}
|
|
|
|
/**
|
|
* Retrieve Saleable Status Ids
|
|
* Default Product Enable status
|
|
*
|
|
* @return int[]
|
|
*/
|
|
public function getSaleableStatusIds()
|
|
{
|
|
return [self::STATUS_SUCCESS];
|
|
}
|
|
|
|
/**
|
|
* Retrieve option array
|
|
*
|
|
* @return string[]
|
|
*/
|
|
public function getOptionArray()
|
|
{
|
|
return [self::STATUS_SUCCESS => __('Success'), self::STATUS_FAILED => __('Failed')];
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|