Skip to content

#28431 issue fixed #28689

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

Conversation

syed-ziffity
Copy link
Contributor

@syed-ziffity syed-ziffity commented Jun 11, 2020

Description (*)

When we get the bundle product through REST API we get the null values for all child products. Because of conditions.

Finding

They have checked the Product type in the first step of the ternary operator. If product type is dynamic it will return "0" and the second step they consider the selected products. in this case, there is no selected product so it will return "0". So the condition returns false. in this case null value return for all child products.

Fixes: #28431

Manual testing scenarios (*)

  1. Create a bundle product and assign simple products to it.
  2. Enable 'Allow Anonymous Guest Access' from Store -> Configuration -> Services -> Magento Web API.
  3. GET /rest/V1/products/{sku} to get details of bundle products.
    "id": 46,
    "sku": "24-WG080",
    "name": "Sprite Yoga Companion Kit",
    "attribute_set_id": 11,
    "price": 0,
    "status": 1,
    "visibility": 4,
    "type_id": "bundle",
    "created_at": "2020-06-01 06:43:20",
    "updated_at": "2020-06-11 13:59:36",
    "weight": 0,
    "extension_attributes": {
        "website_ids": [
            1
        ],
        "category_links": [
            {
                "position": 0,
                "category_id": "3"
            },
            {
                "position": 0,
                "category_id": "5"
            }
        ],
        "bundle_product_options": [
            {
                "option_id": 1,
                "title": "Sprite Stasis Ball",
                "required": true,
                "type": "radio",
                "position": 1,
                "sku": "24-WG080",
                "product_links": [
                    {
                        "id": "1",
                        "sku": "24-WG081-blue",
                        "option_id": 1,
                        "qty": 1,
                        "position": 1,
                        "is_default": true,
                        "price": 23,  \\Price
                        "price_type": null,
                        "can_change_quantity": 1
                    },
                    {
                        "id": "2",
                        "sku": "24-WG082-blue",
                        "option_id": 1,
                        "qty": 1,
                        "position": 2,
                        "is_default": false,
                        "price": 27,  \\Price
                        "price_type": null,
                        "can_change_quantity": 1
                    },
                    {
                        "id": "3",
                        "sku": "24-WG083-blue",
                        "option_id": 1,
                        "qty": 1,
                        "position": 3,
                        "is_default": false,
                        "price": 32,  \\Price
                        "price_type": null,
                        "can_change_quantity": 1
                    }
                ]
            },
            {
                "option_id": 2,
                "title": "Sprite Foam Yoga Brick",
                "required": true,
                "type": "radio",
                "position": 2,
                "sku": "24-WG080",
                "product_links": [
                    {
                        "id": "4",
                        "sku": "24-WG084",
                        "option_id": 2,
                        "qty": 1,
                        "position": 1,
                        "is_default": true,
                        "price": 5,  \\Price
                        "price_type": null,
                        "can_change_quantity": 1
                    }
                ]
            },
            {
                "option_id": 3,
                "title": "Sprite Yoga Strap",
                "required": true,
                "type": "radio",
                "position": 3,
                "sku": "24-WG080",
                "product_links": [
                    {
                        "id": "5",
                        "sku": "24-WG085",
                        "option_id": 3,
                        "qty": 1,
                        "position": 1,
                        "is_default": true,
                        "price": 14,  \\Price
                        "price_type": null,
                        "can_change_quantity": 1
                    },
                    {
                        "id": "6",
                        "sku": "24-WG086",
                        "option_id": 3,
                        "qty": 1,
                        "position": 2,
                        "is_default": false,
                        "price": 17,  \\Price
                        "price_type": null,
                        "can_change_quantity": 1
                    },
                    {
                        "id": "7",
                        "sku": "24-WG087",
                        "option_id": 3,
                        "qty": 1,
                        "position": 3,
                        "is_default": false,
                        "price": 21,  \\Price
                        "price_type": null,
                        "can_change_quantity": 1
                    }
                ]
            },
            {
                "option_id": 4,
                "title": "Sprite Foam Roller",
                "required": true,
                "type": "radio",
                "position": 4,
                "sku": "24-WG080",
                "product_links": [
                    {
                        "id": "8",
                        "sku": "24-WG088",
                        "option_id": 4,
                        "qty": 1,
                        "position": 1,
                        "is_default": true,
                        "price": 19,  \\Price
                        "price_type": null,
                        "can_change_quantity": 1
                    }
                ]
            }
        ]
    },
    "product_links": [],
    "options": [],
    "media_gallery_entries": [
        {
            "id": 52,
            "media_type": "image",
            "label": "Image",
            "position": 1,
            "disabled": false,
            "types": [
                "image",
                "small_image",
                "thumbnail"
            ],
            "file": "/l/u/luma-yoga-kit-2.jpg"
        }
    ],
    "tier_prices": [],
    "custom_attributes": [
        {
            "attribute_code": "image",
            "value": "/l/u/luma-yoga-kit-2.jpg"
        },
        {
            "attribute_code": "shipment_type",
            "value": "0"
        },
        {
            "attribute_code": "small_image",
            "value": "/l/u/luma-yoga-kit-2.jpg"
        },
        {
            "attribute_code": "thumbnail",
            "value": "/l/u/luma-yoga-kit-2.jpg"
        },
        {
            "attribute_code": "options_container",
            "value": "container2"
        },
        {
            "attribute_code": "msrp_display_actual_price_type",
            "value": "0"
        },
        {
            "attribute_code": "url_key",
            "value": "sprite-yoga-companion-kit"
        },
        {
            "attribute_code": "gift_message_available",
            "value": "0"
        },
        {
            "attribute_code": "price_view",
            "value": "0"
        },
        {
            "attribute_code": "required_options",
            "value": "1"
        },
        {
            "attribute_code": "has_options",
            "value": "1"
        },
        {
            "attribute_code": "image_label",
            "value": "Image"
        },
        {
            "attribute_code": "small_image_label",
            "value": "Image"
        },
        {
            "attribute_code": "thumbnail_label",
            "value": "Image"
        },
        {
            "attribute_code": "sku_type",
            "value": "0"
        },
        {
            "attribute_code": "price_type",
            "value": "0"
        },
        {
            "attribute_code": "tax_class_id",
            "value": "2"
        },
        {
            "attribute_code": "weight_type",
            "value": "0"
        },
        {
            "attribute_code": "category_ids",
            "value": [
                "3",
                "5"
            ]
        },
        {
            "attribute_code": "description",
            "value": "<p>A well-rounded yoga workout takes more than a mat. The Sprite Yoga Companion Kit helps stock your studio with the basics you need for a full-range workout. The kit is composed of four best-selling Luma Sprite accessories in one easy bundle: statis ball, foam block, yoga strap, and foam roller. Choose sizes and colors and leave the rest to us. The kit includes:</p>\n<ul>\n<li> Sprite Statis Ball\n<li> Sprite Foam Yoga Brick\n<li> Sprite Yoga Strap\n<li> Sprite Foam Roller\n</ul>"
        },
        {
            "attribute_code": "activity",
            "value": "8,11"
        },
        {
            "attribute_code": "gender",
            "value": "80,81,84"
        },
        {
            "attribute_code": "category_gear",
            "value": "87"
        },
        {
            "attribute_code": "eco_collection",
            "value": "0"
        },
        {
            "attribute_code": "performance_fabric",
            "value": "0"
        },
        {
            "attribute_code": "erin_recommends",
            "value": "0"
        },
        {
            "attribute_code": "new",
            "value": "0"
        },
        {
            "attribute_code": "sale",
            "value": "0"
        }
    ]
}

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Jun 11, 2020

Hi @syed-ziffity. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

@sidolov
Copy link
Contributor

sidolov commented Jun 11, 2020

@magento give me test instance

@magento-engcom-team
Copy link
Contributor

Hi @sidolov. Thank you for your request. I'm working on Magento instance for you

@magento-engcom-team
Copy link
Contributor

Hi @sidolov, here is your new Magento instance.
Admin access: https://pr-28689.instances.magento-community.engineering/admin_3dbd
Login: 1a80bfbb Password: 546c6d3bde9c
Instance will be terminated in up to 3 hours.

@syed-ziffity
Copy link
Contributor Author

@magento run all tests

@syed-ziffity
Copy link
Contributor Author

@magento run static, Database Compare

@syed-ziffity
Copy link
Contributor Author

@magento run Static Tests

@syed-ziffity
Copy link
Contributor Author

@magento run Static Tests

@syed-ziffity
Copy link
Contributor Author

@magento run all tests

@sidolov sidolov added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Aug 18, 2020
Copy link
Contributor

@sidolov sidolov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@syed-ziffity could you please cover changes with web API test?

@engcom-Charlie
Copy link
Contributor

@magento run all tests

@ghost ghost removed the Progress: needs update label Sep 4, 2020
@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-8131 has been created to process this Pull Request
✳️ @sidolov, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Alfa engcom-Alfa self-assigned this Sep 7, 2020
@engcom-Alfa engcom-Alfa added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label Sep 7, 2020
@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

Manual testing scenario:

  1. Create a bundle product and assign simple products to it.
  2. Enable 'Allow Anonymous Guest Access' from Store -> Configuration -> Services -> Magento Web API.
  3. GET /rest/V1/products/{sku} to get details of bundle products.

Before: ✖️ Prices for child's products are null

2020-09-07_12-24

After: ✔️ Children products have a correct price in the response

2020-09-07_12-08

@m2-assistant
Copy link

m2-assistant bot commented Sep 9, 2020

Hi @syed-ziffity, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@magento-engcom-team magento-engcom-team merged commit f044ed7 into magento:2.4-develop Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Bundle Partner: Ziffity partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REST API Bundle Product Details Price Issue
5 participants