forked from Smile-SA/elasticsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Smile-SA#78 from Elastic-Suite/feat-ESP-252-Layere…
…d-navigation-add-stock-discount-attributes #ESP-252 Add is discounted and is in stock attributes on layered nav…
- Loading branch information
Showing
25 changed files
with
516 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ | |
* @package Smile\ElasticsuiteAbCampaign | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* @license * @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
|
||
namespace Smile\ElasticsuiteAbCampaign\Block\Tracker\Variables\Page; | ||
|
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 |
---|---|---|
|
@@ -9,7 +9,8 @@ | |
* @package Smile\ElasticsuiteAbCampaign | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
|
||
namespace Smile\ElasticsuiteAbCampaign\Cron; | ||
|
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 |
---|---|---|
|
@@ -9,7 +9,8 @@ | |
* @package Smile\ElasticsuiteConfigurableProduct | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
|
||
namespace Smile\ElasticsuiteConfigurableProduct\Model\Search\Configurable; | ||
|
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 |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
* @package Smile\ElasticsuiteConfigurableProduct | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
namespace Smile\ElasticsuiteConfigurableProduct\Plugin\Block\Product; | ||
|
||
|
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 |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
* @package Smile\ElasticsuiteConfigurableProduct | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
namespace Smile\ElasticsuiteConfigurableProduct\Plugin\Block\Product; | ||
|
||
|
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 |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
* @package Smile\ElasticsuiteConfigurableProduct | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
namespace Smile\ElasticsuiteConfigurableProduct\Plugin\Model\Resolver\Product; | ||
|
||
|
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 |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
* @package Smile\ElasticsuiteConfigurableProduct | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
namespace Smile\ElasticsuiteConfigurableProduct\Plugin\Model\Resolver; | ||
|
||
|
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 |
---|---|---|
|
@@ -11,7 +11,8 @@ | |
* @package Smile\ElasticsuiteConfigurableProduct | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> | ||
|
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 |
---|---|---|
|
@@ -12,7 +12,8 @@ | |
* @package Smile\ElasticsuiteConfigurableProduct | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
--> | ||
<requests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
|
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 |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
* @package Smile\ElasticsuiteExplain | ||
* @author Pierre Gauthier <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
namespace Smile\ElasticsuiteExplain\Plugin; | ||
|
||
|
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 |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
* @package Smile\ElasticsuiteExplain | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
|
||
var config = { | ||
|
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,16 @@ | ||
# Standard composer ignored paths | ||
composer.phar | ||
/vendor/ | ||
|
||
# Standard IDEs ignored paths | ||
.metadata | ||
*.tmp | ||
*.bak | ||
*.swp | ||
*~.nib | ||
local.properties | ||
.settings/ | ||
.loadpath | ||
.project | ||
.buildpath | ||
.idea |
85 changes: 85 additions & 0 deletions
85
src/module-elasticsuite-layered-navigation/Model/LayeredNavAttribute/IsDiscounted.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,85 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteLayeredNavigation | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
namespace Smile\ElasticsuiteLayeredNavigation\Model\LayeredNavAttribute; | ||
|
||
use Magento\Customer\Model\Session as CustomerSession; | ||
use Smile\ElasticsuiteCatalog\Api\LayeredNavAttributeInterface; | ||
|
||
/** | ||
* IsDiscounted class. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteLayeredNavigation | ||
* @author Botis <[email protected]> | ||
*/ | ||
class IsDiscounted implements LayeredNavAttributeInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public const ATTRIBUTE_CODE = 'es_is_discounted'; | ||
|
||
/** | ||
* @var CustomerSession | ||
*/ | ||
protected $customerSession; | ||
|
||
/** | ||
* IsDiscount constructor. | ||
* | ||
* @param CustomerSession $customerSession Customer session. | ||
*/ | ||
public function __construct( | ||
CustomerSession $customerSession | ||
) { | ||
$this->customerSession = $customerSession; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getAttributeCode(): string | ||
{ | ||
return self::ATTRIBUTE_CODE; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFilterField(): string | ||
{ | ||
return 'price.is_discount'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getAdditionalAggregationData(): array | ||
{ | ||
$customerGroupId = $this->customerSession->getCustomerGroupId(); | ||
|
||
return [ | ||
'nestedFilter' => ['price.customer_group_id' => $customerGroupId], 'minDocCount' => 1, | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function skipAttribute(): bool | ||
{ | ||
return false; | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
src/module-elasticsuite-layered-navigation/Model/LayeredNavAttribute/IsInStock.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,82 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteLayeredNavigation | ||
* @author Botis <[email protected]> | ||
* @copyright 2021 Smile | ||
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided. | ||
* Unauthorized copying of this file, via any medium, is strictly prohibited. | ||
*/ | ||
namespace Smile\ElasticsuiteLayeredNavigation\Model\LayeredNavAttribute; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Smile\ElasticsuiteCatalog\Api\LayeredNavAttributeInterface; | ||
use Magento\CatalogInventory\Model\Configuration as CatalogInventoryConfiguration; | ||
|
||
/** | ||
* IsInStock class. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteLayeredNavigation | ||
* @author Botis <[email protected]> | ||
*/ | ||
class IsInStock implements LayeredNavAttributeInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public const ATTRIBUTE_CODE = 'es_is_in_stock'; | ||
|
||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
protected $scopeConfig; | ||
|
||
/** | ||
* IsInStock constructor. | ||
* | ||
* @param ScopeConfigInterface $scopeConfig Scope config. | ||
*/ | ||
public function __construct( | ||
ScopeConfigInterface $scopeConfig | ||
) { | ||
$this->scopeConfig = $scopeConfig; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getAttributeCode(): string | ||
{ | ||
return self::ATTRIBUTE_CODE; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFilterField(): string | ||
{ | ||
return 'stock.is_in_stock'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getAdditionalAggregationData(): array | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function skipAttribute(): bool | ||
{ | ||
return !(bool) $this->scopeConfig->getValue(CatalogInventoryConfiguration::XML_PATH_SHOW_OUT_OF_STOCK); | ||
} | ||
} |
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,15 @@ | ||
## README | ||
|
||
Readme for the whole Smile ElasticSuite is available [here](https://github.com/Smile-SA/elasticsuite). | ||
|
||
|
||
**Which version should I use ?** | ||
|
||
The module version patterns are identical to those of Elasticsuite. | ||
|
||
Magento Version | ElasticSuite Version | Module version | Module composer install | Supported Elasticsearch Version | Actively maintained | ||
----------------------------------------------------|-------------------------|----------------|----------------------------------------------------------------------|---------------------------------|--------------------- | ||
Magento **<2.3.5** Opensource (CE) / Commerce (EE) | ElasticSuite **2.8.x** | **2.8.x** | ```composer require smile/module-elasticsuite-layered-navigation ~2.8.0``` | 5.x & 6.x | No | ||
Magento **>=2.3.5** Opensource (CE) / Commerce (EE) | ElasticSuite **2.9.x** | **2.9.x** | ```composer require smile/module-elasticsuite-layered-navigation ~2.9.0``` | 6.x & 7.x | **Yes** | ||
Magento **>=2.4.1** Opensource (CE) / Commerce (EE) | ElasticSuite **2.10.x** | **2.10.x** | ```composer require smile/module-elasticsuite-layered-navigation ~2.10.0``` | 6.x & 7.x | **Yes** | ||
|
Oops, something went wrong.