Skip to content

Commit

Permalink
Merge pull request #2397 from romainruaud/fix_widget-sort-order-29x
Browse files Browse the repository at this point in the history
Implement "low stock first" and "high stock first" based on an ES query.
  • Loading branch information
romainruaud authored Dec 17, 2021
2 parents 16182db + 4437148 commit d5f9e30
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/module-elasticsuite-virtual-category/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,29 @@
</arguments>
</virtualType>

<virtualType name="Smile\ElasticsuitePageBuilder\Model\Catalog\Sorting\Stock\Ascending" type="Magento\PageBuilder\Model\Catalog\Sorting\SimpleOption">
<arguments>
<argument name="label" xsi:type="string">Stock: low stock first</argument>
<argument name="sortDirection" xsi:type="string">asc</argument>
<argument name="attributeField" xsi:type="string">stock.qty</argument>
</arguments>
</virtualType>

<virtualType name="Smile\ElasticsuitePageBuilder\Model\Catalog\Sorting\Stock\Descending" type="Magento\PageBuilder\Model\Catalog\Sorting\SimpleOption">
<arguments>
<argument name="label" xsi:type="string">Stock: high stock first</argument>
<argument name="sortDirection" xsi:type="string">desc</argument>
<argument name="attributeField" xsi:type="string">stock.qty</argument>
</arguments>
</virtualType>

<type name="Magento\PageBuilder\Model\Catalog\Sorting">
<arguments>
<argument name="sortClasses" xsi:type="array">
<item name="price_high_to_low" xsi:type="string">Smile\ElasticsuitePageBuilder\Model\Catalog\Sorting\Price\HighToLow</item>
<item name="price_low_to_high" xsi:type="string">Smile\ElasticsuitePageBuilder\Model\Catalog\Sorting\Price\LowToHigh</item>
<item name="low_stock_first" xsi:type="string">Smile\ElasticsuitePageBuilder\Model\Catalog\Sorting\Stock\Ascending</item>
<item name="high_stock_first" xsi:type="string">Smile\ElasticsuitePageBuilder\Model\Catalog\Sorting\Stock\Descending</item>
</argument>
</arguments>
</type>
Expand Down

0 comments on commit d5f9e30

Please sign in to comment.