This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,41 @@
<?php
/**
* @category WeltPixel
* @package WeltPixel_LayeredNavigation
* @copyright Copyright (c) 2018 Weltpixel
* @author Weltpixel TEAM
*/
namespace WeltPixel\LayeredNavigation\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class CategoryShowAs
* @package WeltPixel\LayeredNavigation\Model\Config\Source
*/
class CategoryShowAs implements ArrayInterface
{
/**
* @var array
*/
protected $_showAs = array(
0 => 'Closed',
1 => 'Fully Opened'
);
/**
* @return array
*/
public function toOptionArray()
{
$options = array();
foreach ($this->_showAs as $id => $showAs) :
$options[] = array(
'value' => $id,
'label' => $showAs
);
endforeach;
return $options;
}
}
@@ -0,0 +1,42 @@
<?php
/**
* @category WeltPixel
* @package WeltPixel_LayeredNavigation
* @copyright Copyright (c) 2018 Weltpixel
* @author Weltpixel TEAM
*/
namespace WeltPixel\LayeredNavigation\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class FilterButton
* @package WeltPixel\LayeredNavigation\Model\Config\Source
*/
class FilterButton implements ArrayInterface
{
/**
* @var array
*/
protected $_styles = array(
0 => 'Icon Only',
1 => 'Icon + Label',
2 => 'Label Only',
);
/**
* @return array
*/
public function toOptionArray()
{
$options = array();
foreach ($this->_styles as $id => $style) :
$options[] = array(
'value' => $id,
'label' => $style
);
endforeach;
return $options;
}
}
@@ -0,0 +1,42 @@
<?php
/**
* @category WeltPixel
* @package WeltPixel_LayeredNavigation
* @copyright Copyright (c) 2018 Weltpixel
* @author Weltpixel TEAM
*/
namespace WeltPixel\LayeredNavigation\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class FilterDisplay
* @package WeltPixel\LayeredNavigation\Model\Config\Source
*/
class FilterDisplay implements ArrayInterface
{
/**
* @var array
*/
protected $_styles = array(
0 => 'Close',
1 => 'Open',
2 => 'Expand',
);
/**
* @return array
*/
public function toOptionArray()
{
$options = array();
foreach ($this->_styles as $id => $style) :
$options[] = array(
'value' => $id,
'label' => $style
);
endforeach;
return $options;
}
}
@@ -0,0 +1,41 @@
<?php
/**
* @category WeltPixel
* @package WeltPixel_LayeredNavigation
* @copyright Copyright (c) 2018 Weltpixel
* @author Weltpixel TEAM
*/
namespace WeltPixel\LayeredNavigation\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class FilterShowHideState
* @package WeltPixel\LayeredNavigation\Model\Config\Source
*/
class FilterShowHideState implements ArrayInterface
{
/**
* @var array
*/
protected $_styles = [
'open' => 'Open',
'closed' => 'Closed',
];
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->_styles as $id => $style) :
$options[] = [
'value' => $id,
'label' => $style
];
endforeach;
return $options;
}
}
@@ -0,0 +1,73 @@
<?php
namespace WeltPixel\LayeredNavigation\Model\Config\Source;
use Magento\Eav\Model\Entity\Attribute\Source\SourceInterface;
use Magento\Framework\Data\OptionSourceInterface;
class HorizontalSidebarDesignVersion implements SourceInterface, OptionSourceInterface
{
/**
* block type
*/
const VERSION_1 = 'v1';
const VERSION_2 = 'v2';
const VERSION_3 = 'v3';
/**
* Prepare display options.
*
* @return array
*/
public function getAvailableModes()
{
return [
self::VERSION_1 => __('Version 1'),
self::VERSION_2 => __('Version 2'),
self::VERSION_3 => __('Version 3'),
];
}
/**
* Retrieve All options
*
* @return array
*/
public function getAllOptions()
{
$result = [];
foreach ($this->getAvailableModes() as $index => $value) {
$result[] = ['value' => $index, 'label' => $value];
}
return $result;
}
/**
* Retrieve Option value text
*
* @param string $value
* @return mixed
*/
public function getOptionText($value)
{
$options = $this->getAvailableModes();
return isset($options[$value]) ? $options[$value] : null;
}
/**
* Return array of options as value-label pairs
*
* @return array Format: array(array('value' => '<value>', 'label' => '<label>'), ...)
*/
public function toOptionArray()
{
return $this->getAllOptions();
}
}
@@ -0,0 +1,71 @@
<?php
namespace WeltPixel\LayeredNavigation\Model\Config\Source;
use Magento\Eav\Model\Entity\Attribute\Source\SourceInterface;
use Magento\Framework\Data\OptionSourceInterface;
class HorizontalSidebarFilterPosition implements SourceInterface, OptionSourceInterface
{
/**
* block type
*/
const LEFT = 'left';
const CENTER = 'center';
/**
* Prepare display options.
*
* @return array
*/
public function getAvailableModes()
{
return [
self::LEFT => __('Left'),
self::CENTER => __('Center')
];
}
/**
* Retrieve All options
*
* @return array
*/
public function getAllOptions()
{
$result = [];
foreach ($this->getAvailableModes() as $index => $value) {
$result[] = ['value' => $index, 'label' => $value];
}
return $result;
}
/**
* Retrieve Option value text
*
* @param string $value
* @return mixed
*/
public function getOptionText($value)
{
$options = $this->getAvailableModes();
return isset($options[$value]) ? $options[$value] : null;
}
/**
* Return array of options as value-label pairs
*
* @return array Format: array(array('value' => '<value>', 'label' => '<label>'), ...)
*/
public function toOptionArray()
{
return $this->getAllOptions();
}
}
@@ -0,0 +1,41 @@
<?php
/**
* @category WeltPixel
* @package WeltPixel_LayeredNavigation
* @copyright Copyright (c) 2018 Weltpixel
* @author Weltpixel TEAM
*/
namespace WeltPixel\LayeredNavigation\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class PriceFilter
* @package WeltPixel\LayeredNavigation\Model\Config\Source
*/
class PriceFilter implements ArrayInterface
{
/**
* @var array
*/
protected $_styles = array(
'1' => 'Default',
'2' => 'Slider'
);
/**
* @return array
*/
public function toOptionArray()
{
$options = array();
foreach ($this->_styles as $id => $style) :
$options[] = array(
'value' => $id,
'label' => $style
);
endforeach;
return $options;
}
}
@@ -0,0 +1,41 @@
<?php
/**
* @category WeltPixel
* @package WeltPixel_LayeredNavigation
* @copyright Copyright (c) 2018 Weltpixel
* @author Weltpixel TEAM
*/
namespace WeltPixel\LayeredNavigation\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class RatingFilterDisplay
* @package WeltPixel\LayeredNavigation\Model\Config\Source
*/
class RatingFilterDisplay implements ArrayInterface
{
/**
* @var array
*/
protected $_styles = array(
0 => 'Close',
1 => 'Open'
);
/**
* @return array
*/
public function toOptionArray()
{
$options = array();
foreach ($this->_styles as $id => $style) :
$options[] = array(
'value' => $id,
'label' => $style
);
endforeach;
return $options;
}
}
@@ -0,0 +1,43 @@
<?php
/**
* @category WeltPixel
* @package WeltPixel_LayeredNavigation
* @copyright Copyright (c) 2018 Weltpixel
* @author Weltpixel TEAM
*/
namespace WeltPixel\LayeredNavigation\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class SidebarStyle
* @package WeltPixel\LayeredNavigation\Model\Config\Source
*/
class SidebarStyle implements ArrayInterface
{
/**
* @var array
*/
protected $_styles = array(
'0' => 'Default',
'1' => 'Slide In',
'2' => 'Slide Down',
'3' => 'Horizontal View'
);
/**
* @return array
*/
public function toOptionArray()
{
$options = array();
foreach ($this->_styles as $id => $style) :
$options[] = array(
'value' => $id,
'label' => $style
);
endforeach;
return $options;
}
}
@@ -0,0 +1,120 @@
<?php
/**
* @category WeltPixel
* @package WeltPixel_LayeredNavigation
* @copyright Copyright (c) 2018 Weltpixel
* @author Weltpixel TEAM
*/
namespace WeltPixel\LayeredNavigation\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
use \Magento\Store\Model\StoreManagerInterface;
use \Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\View\Design\Theme\ThemeProviderInterface;
/**
* Class SlideDownFilterColumns
* @package WeltPixel\LayeredNavigation\Model\Config\Source
*/
class SlideDownFilterColumns implements ArrayInterface
{
/**
* @var array
*/
protected $_styles = array(
'99%' => '1 column',
'48.5%' => '2 columns',
'31.9%' => '3 columns',
'23.4%' => '4 columns',
'18.4%' => '5 columns',
'15.2%' => '6 columns',
);
/**
* @var array
*/
protected $_pearl_styles = array(
'99%' => '1 column',
'49%' => '2 columns',
'32.33%' => '3 columns',
'24%' => '4 columns',
'19%' => '5 columns',
'16.33%' => '6 columns',
);
/**
* @var StoreManagerInterface
*/
protected $storeManager;
/**
* @var ScopeConfigInterface
*/
protected $scopeConfig;
/** @var ThemeProviderInterface */
protected $themeProvider;
public function __construct(
StoreManagerInterface $storeManager,
ScopeConfigInterface $scopeConfig,
ThemeProviderInterface $themeProvider
)
{
$this->storeManager = $storeManager;
$this->scopeConfig = $scopeConfig;
$this->themeProvider = $themeProvider;
}
/**
* @return array
*/
public function toOptionArray()
{
$options = array();
if($this->_isPearlTheamActive()) {
foreach ($this->_pearl_styles as $id => $style) :
$options[] = array(
'value' => $id,
'label' => $style
);
endforeach;
} else {
foreach ($this->_styles as $id => $style) :
$options[] = array(
'value' => $id,
'label' => $style
);
endforeach;
}
return $options;
}
/**
* @return bool
* @throws \Exception
*/
protected function _isPearlTheamActive()
{
try {
$store = $this->storeManager->getStore();
$themeId = $this->scopeConfig->getValue(
\Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$store->getId()
);
$theme = $this->themeProvider->getThemeById($themeId);
$themePath = $theme->getThemePath();
if (strpos($themePath, 'Pearl') !== false) {
return true;
}
return false;
} catch (\Exception $ex) {
throw new \Exception('Store with id or code ' . $store->getId() . ' not found.');
}
}
}
@@ -0,0 +1,41 @@
<?php
/**
* @category WeltPixel
* @package WeltPixel_LayeredNavigation
* @copyright Copyright (c) 2018 Weltpixel
* @author Weltpixel TEAM
*/
namespace WeltPixel\LayeredNavigation\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class SortBy
* @package WeltPixel\LayeredNavigation\Model\Config\Source
*/
class SortBy implements ArrayInterface
{
/**
* @var array
*/
protected $_styles = array(
'position' => 'Position',
'name' => 'Name'
);
/**
* @return array
*/
public function toOptionArray()
{
$options = array();
foreach ($this->_styles as $id => $style) :
$options[] = array(
'value' => $id,
'label' => $style
);
endforeach;
return $options;
}
}