ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,45 @@
<?php
namespace Olegnax\BrandSlider\Model\Config\Source;
use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory;
use Magento\Framework\Option\ArrayInterface;
class BrandAttribute implements ArrayInterface
{
protected $collectionFactory;
public function __construct( CollectionFactory $collectionFactory)
{
$this->collectionFactory = $collectionFactory;
}
public function toOptionArray()
{
$options = [];
foreach ($this->_getOptions() as $optionValue => $optionLabel) {
$options[] = ['value' => $optionValue, 'label' => $optionLabel];
}
return $options;
}
public function toArray()
{
return $this->_getOptions();
}
protected function _getOptions()
{
$collection = $this->collectionFactory->create();
$collection->addIsFilterableFilter();
$collection->addOrder('attribute_code', 'asc');
$options = ['' => __('-- Empty --')];
foreach ($collection->getItems() as $attribute) {
$options[$attribute->getAttributeCode()] = $attribute->getAttributeCode();
}
return $options;
}
}