-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'mainline/develop' into develop
- Loading branch information
Showing
67 changed files
with
1,875 additions
and
898 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\CatalogSearch\Model\Adapter; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Framework\Search\Adapter\OptionsInterface; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
class Options implements OptionsInterface | ||
{ | ||
const XML_PATH_INTERVAL_DIVISION_LIMIT = 'catalog/layered_navigation/interval_division_limit'; | ||
const XML_PATH_RANGE_STEP = 'catalog/layered_navigation/price_range_step'; | ||
const XML_PATH_RANGE_MAX_INTERVALS = 'catalog/layered_navigation/price_range_max_intervals'; | ||
|
||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
private $scopeConfig; | ||
|
||
/** | ||
* @param ScopeConfigInterface $scopeConfig | ||
*/ | ||
public function __construct(ScopeConfigInterface $scopeConfig) | ||
{ | ||
$this->scopeConfig = $scopeConfig; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function get() | ||
{ | ||
return [ | ||
'interval_division_limit' => (int)$this->scopeConfig->getValue( | ||
self::XML_PATH_INTERVAL_DIVISION_LIMIT, | ||
ScopeInterface::SCOPE_STORE | ||
), | ||
'range_step' => (double)$this->scopeConfig->getValue( | ||
self::XML_PATH_RANGE_STEP, | ||
ScopeInterface::SCOPE_STORE | ||
), | ||
'min_range_power' => 10, | ||
'max_intervals_number' => (int)$this->scopeConfig->getValue( | ||
self::XML_PATH_RANGE_MAX_INTERVALS, | ||
ScopeInterface::SCOPE_STORE | ||
) | ||
]; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
app/code/Magento/CatalogSearch/Model/Adminhtml/System/Config/Backend/Engine.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\CatalogSearch\Model\Adminhtml\System\Config\Backend; | ||
|
||
/** | ||
* @author Magento Core Team <core@magentocommerce.com> | ||
*/ | ||
class Engine extends \Magento\Framework\App\Config\Value | ||
{ | ||
/** @var \Magento\Indexer\Model\IndexerRegistry */ | ||
protected $indexerRegistry; | ||
|
||
/** | ||
* @param \Magento\Framework\Model\Context $context | ||
* @param \Magento\Framework\Registry $registry | ||
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config | ||
* @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry | ||
* @param \Magento\Framework\Model\Resource\AbstractResource $resource | ||
* @param \Magento\Framework\Data\Collection\Db $resourceCollection | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
\Magento\Framework\Model\Context $context, | ||
\Magento\Framework\Registry $registry, | ||
\Magento\Framework\App\Config\ScopeConfigInterface $config, | ||
\Magento\Indexer\Model\IndexerRegistry $indexerRegistry, | ||
\Magento\Framework\Model\Resource\AbstractResource $resource = null, | ||
\Magento\Framework\Data\Collection\Db $resourceCollection = null, | ||
array $data = [] | ||
) { | ||
$this->indexerRegistry = $indexerRegistry; | ||
parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); | ||
} | ||
|
||
/** | ||
* After save call | ||
* Invalidate catalog search index if engine was changed | ||
* | ||
* @return $this | ||
*/ | ||
public function afterSave() | ||
{ | ||
parent::afterSave(); | ||
|
||
if ($this->isValueChanged()) { | ||
$this->indexerRegistry->get(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)->invalidate(); | ||
} | ||
return $this; | ||
} | ||
} |
Oops, something went wrong.