Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API /rest/V1/products/attributes doesn't distinguish between "Filterable(with results)" and "Filterable(no results)" options #37979

Closed
github-jira-sync-bot opened this issue Sep 8, 2023 · 4 comments
Labels
Evaluated Issue: ready for confirmation Progress: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.

Comments

@github-jira-sync-bot
Copy link

github-jira-sync-bot commented Sep 8, 2023

Short issue description

REST API GET/POST /rest/V1/products/attributes returns the same value for "is_filterable" attribute for both "Filterable(with results)" and "Filterable(no results)" options.

Steps to reproduce

  • Create a product attribute with Storefront Properties > Use in Layered Navigation = "No"
  • Query GET /rest/V1/products/attributes?searchCriteria<sortOrders][0][field]=attribute*group*id&searchCriteria[sortOrders][0][direction]=ASC
  • The results returns "is_filterable": false (/)
  • Change the product attribute "Use in Layered Navigation" property value to "Filterable(with results)"
  • Run the same query
  • The results returns "is_filterable": true (/)
  • Change the product attribute "Use in Layered Navigation" property value to "Filterable(no results)"
  • Run the same query
  • The results returns "is_filterable": true (x)

Actual results

  • Same value is returned for 2 different options of the "Use in Layered Navigation" property. It's impossible to set "Filterable(no results)" from REST API.

Expected results

  • "is_filterable" accepts 3 values for each of the options. ### (!) Updated Expected results
    We can't change 'isfilterable' attribute property type for existing web-api endpoints since it would be a backward incompatible change. So two new web-api endpoints were implemented that allow setting 'isfilterable' attribute property value as an integer: 0 => "No, 1 => "Filterable(with results)", 2 => "Filterable(no results)".
<route url="/V1/products/attributes/:attributeCode/is-filterable/:isFilterable" method="PUT">
        <service class="Magento\Catalog\Api\ProductAttributeIsFilterableManagementInterface" method="set"/>
        <resources>
            <resource ref="Magento*Catalog::attributes*attributes" />
        </resources>
    </route>
    <route url="/V1/products/attributes/:attributeCode/is-filterable" method="GET">
        <service class="Magento\Catalog\Api\ProductAttributeIsFilterableManagementInterface" method="get"/>
        <resources>
            <resource ref="Magento*Catalog::attributes*attributes" />
        </resources>
    </route>

Example:
PUT /rest/V1/products/attributes/is_returnable/is-filterable/2 - return true
GET /rest/V1/products/attributes/is_returnable/is-filterable - return 2

Additional information

Example of the payload for the 'is_returnable' attribute
{{ "is*wysiwyg*enabled": false, "is*html_allowed_on*front": false, "used*for_sort*by": false, "is_filterable": false, "is*filterable_in*search": false, "is*used_in*grid": false, "is*visible_in*grid": false, "is*filterable_in*grid": false, "position": 0, "apply_to": [], "is_searchable": "0", "is*visible_in_advanced*search": "0", "is_comparable": "0", "is*used_for_promo*rules": "0", "is*visible_on*front": "0", "used*in_product*listing": "0", "is_visible": true, "scope": "website", "attribute_id": 177, "attribute*code": "is*returnable", "frontend_input": "select", "entity*type*id": "4", "is_required": false, "options": [ { "label": "Yes", "value": "1" }, { "label": "No", "value": "0" } ], "is*user*defined": false, "default*frontend*label": "Enable RMA", "frontend_labels": [], "backend_type": "varchar", "source_model": "Magento\\Rma\\Model\\Product\\Source", "default_value": "2", "is_unique": "0", "validation_rules": [> }}

@github-jira-sync-bot github-jira-sync-bot added Evaluated Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Progress: ready for dev Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Sep 8, 2023
@github-jira-sync-bot
Copy link
Author

The issue was exported from the internal Jira. The link to the original Jira issue: https://jira.corp.adobe.com/browse/ACP2E-2275

@m2-assistant
Copy link

m2-assistant bot commented Sep 8, 2023

Hi @github-jira-sync-bot. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@m2-community-project m2-community-project bot added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation and removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Sep 8, 2023
@github-jira-sync-bot
Copy link
Author

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

@chittima
Copy link
Contributor

Here is the Commit Id: 9ac3eb3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Evaluated Issue: ready for confirmation Progress: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
None yet
Development

No branches or pull requests

2 participants