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

Items not getting displayed #19

Open
parshureddy06 opened this issue Jul 10, 2017 · 11 comments
Open

Items not getting displayed #19

parshureddy06 opened this issue Jul 10, 2017 · 11 comments

Comments

@parshureddy06
Copy link

Hello, i am trying to deploy my project through heroku, this is my first thing which i am doing since i am a beginner, when i upload my json, i am able to see the view but i am not getting the items displayed, please can you give me a proper guidance like how to implement this .

This is the view which i am getting
screenshot
I am unable to get the items displayed, here i am sending 10 items in an array which is valid.
Please report me with the issue, and provide me a proper guidance,

Thank you

@cigolpl
Copy link
Member

cigolpl commented Jul 10, 2017

Hello, make sure you are sending correct JSON file i.e. it should be a proper array of objects. You can find some working examples here https://github.com/itemsapi/itemsapi-example-data/tree/master/items.
If you want you can also send me your json and I can tell if that's valid.

@parshureddy06
Copy link
Author

Hi @cigolpl, thanks for your quick reply, below is the JSON which i am sending. please have a look at it and tell me what all things can be done to get an output.
[
{
"id": 9590699650,
"title": "Chain",
"vendor": "xfgfdh",
"product_type": "Necklace",
"tags": "beautiful, bridal wear, Casual Wear",
"variants": [
{
"id": 35468918018,
"product_id": 9590699650,
"title": "Default Title",
"price": "400.00",
"sku": "",
"position": 1,
"grams": 0,
"inventory_policy": "deny",
"compare_at_price": "400.00",
"fulfillment_service": "djnkjd",
"inventory_management": "jkjkvdfk",
"option1": "Title",
"option2": null,
"option3": null,
"created_at": "2017-06-08T17:40:45+05:30",
"updated_at": "2017-06-08T17:40:45+05:30",
"taxable": true,
"barcode": "",
"image_id": null,
"inventory_quantity": 10,
"weight": 0,
"weight_unit": "g",
"old_inventory_quantity": 15,
"requires_shipping": true
}
],
"options": [
{
"id": 11522324034,
"product_id": 9590699650,
"name": "Title",
"position": 1,
"values": [
"Default Title"
]
}
],
"images": [
{
"id": 23,
"product_id": 45,
"position": 1,
"created_at": "2017-06-08T17:40:45+05:30",
"updated_at": "2017-06-08T17:40:45+05:30",
"width": 10,
"height": 10,
"src": "https://cdn.shopify.com/s/files/1/1849/4447/products/CH01.jpg?v=1496923845",
"variant_ids": []
},
{
"id": 46,
"product_id": 50,
"position": 2,
"created_at": "2017-06-08T17:40:45+05:30",
"updated_at": "2017-06-08T17:40:45+05:30",
"width": 48,
"height": 38,
"src": "https://cdn.shopify.com/s/files/1/1849/4447/products/CH01_1.jpg?v=1496923845",
"variant_ids": []
},
{
"id": 10,
"product_id": 50,
"position": 3,
"created_at": "2017-06-08T17:40:45+05:30",
"updated_at": "2017-06-08T17:40:45+05:30",
"width": 200,
"height": 100,
"src": "https://cdn.shopify.com/s/files/1/1849/4447/products/CH01_2.jpg?v=1496923845",
"variant_ids": []
}
]
},
{
"id": 9590228386,
"title": "dlkfdl",
"vendor": "sdjjd",
"product_type": "nkjdd",
"tags": "fnkjdfjd, fkjlfd, ffdllf",
"variants": [
{
"id": 3754,
"product_id": 8386,
"title": "fffd",
"price": "60.00",
"sku": "AKRR34",
"position": 1,
"grams": 0,
"inventory_policy": "fdjhfd",
"compare_at_price": "270.00",
"fulfillment_service": "fdgf",
"inventory_management": "jdffd",
"option1": "fdklkfd",
"option2": null,
"option3": null,
"created_at": "2017-06-08T13:54:50+05:30",
"updated_at": "2017-06-08T13:54:50+05:30",
"taxable": true,
"barcode": "",
"image_id": null,
"inventory_quantity": 1,
"weight": 0,
"weight_unit": "g",
"old_inventory_quantity": 1,
"requires_shipping": true
}
],
"options": [
{
"id": 11527912770,
"product_id": 9590688386,
"name": "Title",
"position": 1,
"values": [
"Default Title"
]
}
],
"images": [
{
"id": 94,
"product_id": 6,
"position": 1,
"created_at": "2017-06-08T13:54:50+05:30",
"updated_at": "2017-06-08T13:54:50+05:30",
"width": 10,
"height": 10,
"src": "dskjfkdf.jpg",
"variant_ids": []
},
{
"id": 58,
"product_id": 86,
"position": 2,
"created_at": "2017-06-08T13:54:50+05:30",
"updated_at": "2017-06-08T13:54:50+05:30",
"width": 10,
"height": 10,
"src": "dshfjdhs.jpg",
"variant_ids": []
},
{
"id":22,
"product_id": 86,
"position": 3,
"created_at": "2017-06-08T13:54:50+05:30",
"updated_at": "2017-06-08T13:54:51+05:30",
"width": 10,
"height": 10,
"src": "safsdjnf.jpg",
"variant_ids": []
},
{
"id": 86,
"product_id": 86,
"position": 4,
"created_at": "2017-06-08T13:54:50+05:30",
"updated_at": "2017-06-08T13:54:51+05:30",
"width": 10,
"height": 10,
"src": "dkshfkds.png",
"variant_ids": []
},
{
"id": 50,
"product_id": 86,
"position": 5,
"created_at": "2017-06-08T13:54:50+05:30",
"updated_at": "2017-06-08T13:54:51+05:30",
"width": 10,
"height": 10,
"src": "images.png",
"variant_ids": []
},
{
"id": 14,
"product_id": 86,
"position": 6,
"created_at": "2017-06-08T13:54:50+05:30",
"updated_at": "2017-06-08T13:54:51+05:30",
"width": 10,
"height": 10,
"src": "images.png",
"variant_ids": []
},
{
"id": 78,
"product_id": 86,
"position": 7,
"created_at": "2017-06-08T13:54:50+05:30",
"updated_at": "2017-06-08T13:54:51+05:30",
"width": 10,
"height": 10,
"src": "image.jpg",
"variant_ids": []
},
{
"id": 42,
"product_id": 86,
"position": 8,
"created_at": "2017-06-08T13:54:50+05:30",
"updated_at": "2017-06-08T13:54:51+05:30",
"width": 10,
"height": 10,
"src": "image1.jpg",
"variant_ids": []
}
]
},
{
"id": 9594454866,
"title": "dffjhdsfjh",
"vendor": "cfdsnkjdfs",
"product_type": "dmsnkjd",
"tags": "dsfdskfjdsh,dsdsvhds,dsjfdjshds,dsvfdvshj,dsvfdsmds",
"variants": [
{
"id": 3234,
"product_id": 4866,
"title": "dgfgfg",
"price": "20.00",
"sku": "dfbghxhb",
"position": 1,
"grams": 0,
"inventory_policy": "xghg",
"compare_at_price": "40.00",
"fulfillment_service": "dfgvgfd",
"inventory_management": "dfgfdgdf",
"option1": "fdgfdzgdf",
"option2": null,
"option3": null,
"created_at": "2017-06-08T13:44:58+05:30",
"updated_at": "2017-06-08T13:44:58+05:30",
"taxable": true,
"barcode": null,
"image_id": null,
"inventory_quantity": 1,
"weight": 0,
"weight_unit": "g",
"old_inventory_quantity": 1,
"requires_shipping": true
}
],
"options": [
{
"id": 50,
"product_id": 66,
"name": "Title",
"position": 1,
"values": [
"Default Title"
]
}
],
"images": [
{
"id": 18,
"product_id": 66,
"position": 1,
"created_at": "2017-06-08T13:44:58+05:30",
"updated_at": "2017-06-08T13:44:59+05:30",
"width": 20,
"height": 48,
"src": "image2.jph",
"variant_ids": []
},
{
"id": 82,
"product_id": 66,
"position": 2,
"created_at": "2017-06-08T13:44:58+05:30",
"updated_at": "2017-06-08T13:44:59+05:30",
"width": 20,
"height": 48,
"src": "images.png",
"variant_ids": []
},
{
"id": 46,
"product_id": 66,
"position": 3,
"created_at": "2017-06-08T13:44:58+05:30",
"updated_at": "2017-06-08T13:44:59+05:30",
"width": 20,
"height": 48,
"src": "dvshfvsdfv.jpg",
"variant_ids": []
},
{
"id": 10,
"product_id": 66,
"position": 4,
"created_at": "2017-06-08T13:44:58+05:30",
"updated_at": "2017-06-08T13:44:59+05:30",
"width": 20,
"height": 48,
"src": "sdhjfshd.jpg",
"variant_ids": []
}
]

    },
    {
        "id": 55454453431502,
        "title": "hdbhcjdv",
        "vendor": "kjvfjlkvfd",
        "product_type": "vklfkvlkfd",
        "tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh",
        "variants": [
            {
                "id": 6642,
                "product_id": 8402,
                "title": "vjbbgf",
                "price": "80.00",
                "sku": "gggfgf",
                "position": 1,
                "grams": 0,
                "inventory_policy": "gfhgf",
                "compare_at_price": "40.00",
                "fulfillment_service": "bcvdbvd",
                "inventory_management": "dkjdk",
                "option1": "dkcdjkcd",
                "option2": null,
                "option3": null,
                "created_at": "2017-06-08T13:18:04+05:30",
                "updated_at": "2017-06-08T13:18:04+05:30",
                "taxable": true,
                "barcode": "",
                "image_id": null,
                "inventory_quantity": 10,
                "weight": 0,
                "weight_unit": "g",
                "old_inventory_quantity": 10,
                "requires_shipping": true
            }
        ],
        "options": [
            {
                "id": 2786,
                "product_id": 8402,
                "name": "Title",
                "position": 1,
                "values": [
                    "Default Title"
                ]
            }
        ],
        "images": [
            {
                "id": 6066,
                "product_id": 8402,
                "position": 1,
                "created_at": "2017-06-08T13:18:04+05:30",
                "updated_at": "2017-06-08T13:18:04+05:30",
                "width": 10,
                "height": 25,
                "src": "images.png",
                "variant_ids": []
            },
            {
                "id": 23158976130,
                "product_id": 9590678402,
                "position": 2,
                "created_at": "2017-06-08T13:18:04+05:30",
                "updated_at": "2017-06-08T13:18:04+05:30",
                "width": 1000,
                "height": 1125,
                "src": "images.png",
                "variant_ids": []
            },
            {
                "id": 23158976194,
                "product_id": 9590678402,
                "position": 3,
                "created_at": "2017-06-08T13:18:04+05:30",
                "updated_at": "2017-06-08T13:18:04+05:30",
                "width": 1000,
                "height": 1125,
                "src": "images.png",
                "variant_ids": []
            },
            {
                "id": 23158976258,
                "product_id": 9590678402,
                "position": 4,
                "created_at": "2017-06-08T13:18:04+05:30",
                "updated_at": "2017-06-08T13:18:04+05:30",
                "width": 1000,
                "height": 1125,
                "src": "images.png",
                "variant_ids": []
            }
        ]
        
    }

]

As, of now i am giving you 4 objects but in real i'm sending more than 100 objects. so , please check whether the JSON is valid or any other issue?

Thank you

@cigolpl
Copy link
Member

cigolpl commented Jul 11, 2017

The only one problem which I see - the array should list a flat objects.

Instead of:

{
  "id": 55454453431502,
  "title": "hdbhcjdv",
  "vendor": "kjvfjlkvfd",
  "product_type": "vklfkvlkfd",
  "tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh",
  "variants": [{
    "id": 6642,
    "product_id": 8402,
    "title": "vjbbgf",
    "price": "80.00",
    "sku": "gggfgf",
    "position": 1,
    "grams": 0,
    "inventory_policy": "gfhgf",
    "compare_at_price": "40.00",
    "fulfillment_service": "bcvdbvd",
    "inventory_management": "dkjdk",
    "option1": "dkcdjkcd",
    "option2": null,
    "option3": null,
    "created_at": "2017-06-08T13:18:04+05:30",
    "updated_at": "2017-06-08T13:18:04+05:30",
    "taxable": true,
    "barcode": "",
    "image_id": null,
    "inventory_quantity": 10,
    "weight": 0,
    "weight_unit": "g",
    "old_inventory_quantity": 10,
    "requires_shipping": true
  }]
}

It should works:

{
  "id": 55454453431502,
  "title": "hdbhcjdv",
  "vendor": "kjvfjlkvfd",
  "product_type": "vklfkvlkfd",
  "tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh",
  "variants_id": 6642,
  "variants_product_id": 8402,
  "variants_title": "vjbbgf",
  "variants_price": "80.00",
  "variants_sku": "gggfgf",
  "variants_position": 1,
  "variants_grams": 0,
  "variants_inventory_policy": "gfhgf",
  "variants_compare_at_price": "40.00",
  "variants_fulfillment_service": "bcvdbvd",
  "variants_inventory_management": "dkjdk",
  "variants_option1": "dkcdjkcd",
  "variants_option2": null,
  "variants_option3": null,
  "variants_created_at": "2017-06-08T13:18:04+05:30",
  "variants_updated_at": "2017-06-08T13:18:04+05:30",
  "variants_taxable": true,
  "variants_barcode": "",
  "variants_image_id": null,
  "variants_inventory_quantity": 10,
  "variants_weight": 0,
  "variants_weight_unit": "g",
  "variants_old_inventory_quantity": 10,
  "variants_requires_shipping": true
}

Probably it's not super convenient but this is how it works.. Once you want to generate catalog with itemsapi it's good if you make some data pre-processing.

@parshureddy06
Copy link
Author

Hi @cigolpl , thanks for the answer, but still its not working, can you suggest me with some other way so that i can make it work.

Thank You

@cigolpl
Copy link
Member

cigolpl commented Jul 11, 2017

@parshureddy06 let's try this:

[{
  "title": "hdbhcjdv",
  "vendor": "kjvfjlkvfd",
  "product_type": "vklfkvlkfd",
  "tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh"
}, {
  "title": "hdbhcjdv",
  "vendor": "kjvfjlkvfd",
  "product_type": "vklfkvlkfd",
  "tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh"
}, {
  "title": "hdbhcjdv",
  "vendor": "kjvfjlkvfd",
  "product_type": "vklfkvlkfd",
  "tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh"
}, {
  "title": "hdbhcjdv",
  "vendor": "kjvfjlkvfd",
  "product_type": "vklfkvlkfd",
  "tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh"
}, {
  "title": "hdbhcjdv",
  "vendor": "kjvfjlkvfd",
  "product_type": "vklfkvlkfd",
  "tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh"
}, {
  "title": "hdbhcjdv",
  "vendor": "kjvfjlkvfd",
  "product_type": "vklfkvlkfd",
  "tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh"
}, {
  "title": "hdbhcjdv",
  "vendor": "kjvfjlkvfd",
  "product_type": "vklfkvlkfd",
  "tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh"
}, {
  "title": "hdbhcjdv",
  "vendor": "kjvfjlkvfd",
  "product_type": "vklfkvlkfd",
  "tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh"
}]

Once it's working you can go into /admin/settings, reset application and try with your final JSON file.

Try to not use "id": 55454453431502 because it has big integers and it seems it is crashing elasticsearch. "id": "55454453431502" should do the jobs probably

@parshureddy06
Copy link
Author

Hi @cigolpl, this is working fine, but if i add image field to it, it's not working fine, say
[
{
"title": "hdbhcjdv",
"vendor": "kjvfjlkvfd",
"product_type": "vklfkvlkfd",
"src": "https://cdn.shopify.com/s/files/1/1849/4447/products/AKRC13c.jpg?v=1496908011",
"tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh",
"src": "https://cdn.shopify.com/s/files/1/1849/4447/products/AKRR34f.jpg?v=1496910290"
},
{
"title": "hdbhcjdv",
"vendor": "kjvfjlkvfd",
"product_type": "vklfkvlkfd",
"tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh",
"src": "https://cdn.shopify.com/s/files/1/1849/4447/products/AKR12d.jpg?v=1496909699"
}
]

@cigolpl
Copy link
Member

cigolpl commented Jul 11, 2017

Let's try image key instead of src.

[{
"title": "hdbhcjdv",
"vendor": "kjvfjlkvfd",
"product_type": "vklfkvlkfd",
"image": "https://cdn.shopify.com/s/files/1/1849/4447/products/AKRC13c.jpg?v=1496908011",
"tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh",
},
{
"title": "hdbhcjdv",
"vendor": "kjvfjlkvfd",
"product_type": "vklfkvlkfd",
"tags": "vfdbjh,dsvsdhjs,dshsdj,dhsghsd,dshjhds,dshfjdsh",
"image": "https://cdn.shopify.com/s/files/1/1849/4447/products/AKR12d.jpg?v=1496909699"
}]

You can also use src but then customize your template ./views/catalog.html.twig

@cigolpl
Copy link
Member

cigolpl commented Jul 11, 2017

Also "tags": ["vfdbjh", "dfadfaf"] instead of "tags": "vfdbjh,dfadfaf" is more reliable although both should work.

@parshureddy06
Copy link
Author

@cigolpl , is it constrained to accept only few number of key-value pairs, if so how many?

@parshureddy06
Copy link
Author

and what all the data-types it accepts? and will it accept empty and null values?

@cigolpl
Copy link
Member

cigolpl commented Jul 11, 2017

@parshureddy06 I think it accepts lot of key-value, not sure how many but probably even more than hundreds. Not sure how about null values. Empty string should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants