1

Magento 2 how to implement configurable product collection formate as shown blow can you please suggest me.

Required format:-

{
    "id": 10,
    "name": "Hello",
    "sku": "hello"
    "description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."
    "brand": "Nutridiet",
    "position": 1,
    "url_key": "null",
    "url": "http://hostmname.com/hello.html",
    "express_delivery":"yes",
    "collection":"no",
    "status":1,
    "is_offer": "yes",
    "offer_text": "Buy 1 get 1 free",
    "store_id": 1
    "children_data": [
        {
            "id": 3,
            "parent_id": 2,
            "name": "Hello Test 2",
            "sku": "Hello-Test-2",
            "status": 1,
            "position": 1,
            "weight": "500",
            "price": 7.50,
            "special_price": 5,
        },
        {
            "id": 4,
            "parent_id": 2,
            "name": "Hello",
            "sku": "Hello-Test-3",
            "status": 1,
            "position": 2,
            "weight": "1.00",
            "price": 15,
            "special_price": ,
        },
        {
            "id": 5,
            "parent_id": 2,
            "name": "Hello-Test-4",
            "sku": "Hello-Test-5",
            "status": 1,
            "position": 3,
            "weight": "1.00",
            "price": 20,
            "special_price": ,
        }
    ]
}

default Magento 2 existing format:

Note:- As of now by default Magento 2 providing the format is

             "id": 82,
            "sku": "Jai",
            "name": "javan",
            "attribute_set_id": 4,
            "price": 0,
            "status": 1,
            "visibility": 4,
            "type_id": "configurable",
            "created_at": "2017-12-13 06:05:03",
            "updated_at": "2017-12-13 06:05:03",
            "product_links": [],
            "tier_prices": [],
            "custom_attributes": [
                {
                    "attribute_code": "meta_title",
                    "value": "Onions17"
                },
                {
                    "attribute_code": "meta_keyword",
                    "value": "Onions17"
                },
                {
                    "attribute_code": "meta_description",
                    "value": "Onions17 "
                },
                {
                    "attribute_code": "image",
                    "value": "/o/n/onion-05_copy_9_1.png"
                },
                {
                    "attribute_code": "small_image",
                    "value": "/o/n/onion-05_copy_9_1.png"
                },
                {
                    "attribute_code": "thumbnail",
                    "value": "/o/n/onion-05_copy_9_1.png"
                },
                {
                    "attribute_code": "options_container",
                    "value": "container2"
                },
                {
                    "attribute_code": "required_options",
                    "value": "1"
                },
                {
                    "attribute_code": "has_options",
                    "value": "1"
                },
                {
                    "attribute_code": "url_key",
                    "value": "onions17"
                },
                {
                    "attribute_code": "gift_message_available",
                    "value": "2"
                },
                {
                    "attribute_code": "tax_class_id",
                    "value": "2"
                }
            ]
        }
6
  • Why don't you add it to extension attributes? Commented Dec 27, 2017 at 10:57
  • thanks for your reply @KhoaTruongDinh let me know is it possible to add custom key and value? Commented Dec 27, 2017 at 11:04
  • What's your Magento version? I cannot find /V1/configurable/product on my Magento version 2.2.2. Commented Dec 27, 2017 at 11:10
  • actually i am using 2.1.7 i have customized code with custom url please check the code github.com/NagarajuKasa/Magento2Notes/blob/master/… Commented Dec 27, 2017 at 11:21
  • I hope you will understood the concept now am i correct? Commented Dec 27, 2017 at 11:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.