ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Elastic Search Base for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\ElasticSearch\Model\Source;
|
||||
|
||||
class CombiningType implements \Magento\Framework\Option\ArrayInterface
|
||||
{
|
||||
public const ANY = '0';
|
||||
public const ALL = '1';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [['value' => self::ANY, 'label' => __('OR')], ['value' => self::ALL, 'label' => __('AND')]];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Elastic Search Base for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\ElasticSearch\Model\Source;
|
||||
|
||||
use Amasty\ElasticSearch\Model\Indexer\Structure\CustomAnalyzersMetaInfoProvider;
|
||||
|
||||
class CustomAnalyzer implements \Magento\Framework\Data\OptionSourceInterface
|
||||
{
|
||||
public const DISABLED = 'disabled';
|
||||
public const CHINESE = 'smartcn';
|
||||
public const JAPANESE = 'kuromoji';
|
||||
public const KOREAN = 'nori';
|
||||
|
||||
/**
|
||||
* @var CustomAnalyzersMetaInfoProvider
|
||||
*/
|
||||
private $metaInfoProvider;
|
||||
|
||||
public function __construct(
|
||||
CustomAnalyzersMetaInfoProvider $customAnalyzersMetaInfoProvider
|
||||
) {
|
||||
$this->metaInfoProvider = $customAnalyzersMetaInfoProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
*/
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
$customAnalyzers = array_map(function ($alias) {
|
||||
return [
|
||||
'value' => $alias,
|
||||
'label' => $this->metaInfoProvider->getAnalyzerLabel($alias)
|
||||
];
|
||||
}, $this->metaInfoProvider->getAllAnalyzers());
|
||||
array_unshift($customAnalyzers, ['value' => self::DISABLED, 'label' => __('Disabled')]);
|
||||
|
||||
return $customAnalyzers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Elastic Search Base for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\ElasticSearch\Model\Source;
|
||||
|
||||
class ElasticLanguage implements \Magento\Framework\Option\ArrayInterface
|
||||
{
|
||||
public const ANY = '0';
|
||||
public const ALL = '1';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $laguages = [
|
||||
'arabic' => 'Arabic (General)',
|
||||
'armenian' => 'Armenian',
|
||||
'basque' => 'Basque (Spain)',
|
||||
'bengali' => 'Bengali (Bangladesh)',
|
||||
'brazilian' => 'Portuguese (Brasil)',
|
||||
'bulgarian' => 'Bulgarian',
|
||||
'catalan' => 'Catalan (Spain)',
|
||||
'czech' => 'Czech',
|
||||
'danish' => 'Danish',
|
||||
'dutch' => 'Dutch (Gemeral)',
|
||||
'english' => 'English',
|
||||
'finnish' => 'Finnish',
|
||||
'french' => 'French (General)',
|
||||
'galician' => 'Galician (Spain)',
|
||||
'german' => 'German',
|
||||
'greek' => 'Greek',
|
||||
'hindi' => 'Hindi',
|
||||
'hungarian' => 'Hungarian',
|
||||
'indonesian' => 'Indonesian',
|
||||
'irish' => 'English (Ireland)',
|
||||
'italian' => 'Italian',
|
||||
'latvian' => 'Latvian',
|
||||
'norwegian' => 'Norwegian (General)',
|
||||
'persian' => 'Persian',
|
||||
'portuguese' => 'Portuguese (General)',
|
||||
'romanian' => 'Romanian',
|
||||
'russian' => 'Russian',
|
||||
'sorani' => 'Sorani',
|
||||
'spanish' => 'Spanish (General)',
|
||||
'swedish' => 'Swedish',
|
||||
'thai' => 'Thai',
|
||||
'turkish' => 'Turkish'
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
$options = [];
|
||||
foreach ($this->laguages as $key => $label) {
|
||||
$options[] = [
|
||||
'value' => $key,
|
||||
'label' => __($label),
|
||||
];
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Elastic Search Base for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\ElasticSearch\Model\Source;
|
||||
|
||||
use Amasty\ElasticSearch\Model\GetNonTextAttributes;
|
||||
use Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection as AttributeCollection;
|
||||
use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory as AttributeCollectionFactory;
|
||||
|
||||
class FulltextAttributes implements \Magento\Framework\Option\ArrayInterface
|
||||
{
|
||||
/**
|
||||
* @var GetNonTextAttributes
|
||||
*/
|
||||
private $getNonTextAttributes;
|
||||
|
||||
/**
|
||||
* @var AttributeCollection
|
||||
*/
|
||||
private $attributeCollection;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $fulltextAttributes;
|
||||
|
||||
public function __construct(
|
||||
GetNonTextAttributes $getNonTextAttributes,
|
||||
AttributeCollectionFactory $attributeCollectionFactory
|
||||
) {
|
||||
$this->getNonTextAttributes = $getNonTextAttributes;
|
||||
$this->attributeCollection = $attributeCollectionFactory->create();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
$attributes = [];
|
||||
foreach ($this->toArray() as $code => $label) {
|
||||
$attributes[] = ['value' => $code, 'label' => $label];
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
if ($this->fulltextAttributes === null) {
|
||||
$this->fulltextAttributes = [];
|
||||
/** @var \Magento\Eav\Model\Attribute $attribute */
|
||||
$this->attributeCollection->addIsSearchableFilter()
|
||||
->setAttributesExcludeFilter($this->getNonTextAttributes->execute());
|
||||
foreach ($this->attributeCollection as $attribute) {
|
||||
$this->fulltextAttributes[$attribute->getAttributeCode()] = $attribute->getFrontendLabel();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->fulltextAttributes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Elastic Search Base for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\ElasticSearch\Model\Source;
|
||||
|
||||
class KuromojiReadingForm implements \Magento\Framework\Option\ArrayInterface
|
||||
{
|
||||
public const NONE = 0;
|
||||
public const ROMAJI = 1;
|
||||
public const KATAKANA = 2;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [
|
||||
['value' => self::NONE, 'label' => __('None')],
|
||||
['value' => self::ROMAJI, 'label' => __('Romaji')],
|
||||
['value' => self::KATAKANA, 'label' => __('Katakana')]
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Elastic Search Base for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\ElasticSearch\Model\Source;
|
||||
|
||||
class KuromojiTokenMode implements \Magento\Framework\Option\ArrayInterface
|
||||
{
|
||||
public const NORMAL = 'normal';
|
||||
public const SEARCH = 'search';
|
||||
public const EXTENDED = 'extended';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [
|
||||
['value' => self::NORMAL, 'label' => __('Normal')],
|
||||
['value' => self::SEARCH, 'label' => __('Search')],
|
||||
['value' => self::EXTENDED, 'label' => __('Extended')]
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Elastic Search Base for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\ElasticSearch\Model\Source;
|
||||
|
||||
class NoriTokenMode implements \Magento\Framework\Option\ArrayInterface
|
||||
{
|
||||
public const NONE = 'none';
|
||||
public const DISCARD = 'discard';
|
||||
public const MIXED = 'mixed';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [
|
||||
['value' => self::NONE, 'label' => __('None')],
|
||||
['value' => self::DISCARD, 'label' => __('Discard')],
|
||||
['value' => self::MIXED, 'label' => __('Mixed')]
|
||||
];
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Elastic Search Base for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\ElasticSearch\Model\Source;
|
||||
|
||||
class RelevanceRuleModificationType implements \Magento\Framework\Option\ArrayInterface
|
||||
{
|
||||
public const INCREASE = '0';
|
||||
public const DECREASE = '1';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [
|
||||
['value' => self::INCREASE, 'label' => __('Increase by')],
|
||||
['value' => self::DECREASE, 'label' => __('Decrease by')]
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Elastic Search Base for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\ElasticSearch\Model\Source;
|
||||
|
||||
class WildcardMode implements \Magento\Framework\Option\ArrayInterface
|
||||
{
|
||||
public const BOTH = '1';
|
||||
public const SUFFIX = '2';
|
||||
public const PREFIX = '3';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => self::BOTH,
|
||||
'label' => __('*word*'),
|
||||
],
|
||||
[
|
||||
'value' => self::SUFFIX,
|
||||
'label' => __('word*'),
|
||||
],
|
||||
[
|
||||
'value' => self::PREFIX,
|
||||
'label' => __('*word'),
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user