How to get product's collections using API

1,742 views
Skip to first unread message

Paul Z

unread,
Jan 30, 2012, 9:23:15 AM1/30/12
to shopify-api
We are working on application that should be able to extract
information about all products including the collections.
Think about list go products with comma separated collections against
each product.

After reading API documentation it looks like there is not such way
and the only option is to start from collections.
Any suggestions?


Thanks,
Paul

Dave

unread,
Jan 30, 2012, 10:18:03 AM1/30/12
to shopify-api
Think about it the other way around.

Go through all the collections and build a list of products...

You can also ask which collections a product belongs to.

So you can indeed do what you want.

Paul Z

unread,
Jan 30, 2012, 11:30:09 AM1/30/12
to shopify-api
Dave,
Thanks for answer, but how can I "ask which collections a product
belongs to".

Thanks again.

Dave

unread,
Jan 30, 2012, 12:48:58 PM1/30/12
to shopify-api
http://api.shopify.com/customcollection.html

notice you can ask for all the collections that have a product with id
product_id?

Paul Z

unread,
Feb 1, 2012, 2:19:00 PM2/1/12
to shopify-api
I see now. Thank you very much. I've missed it.

Paul B

unread,
Feb 4, 2012, 7:59:25 AM2/4/12
to shopi...@googlegroups.com
Dave

I am new to shopify and trying to find out if it is suitable for us to switch to. We sell ink and toner cartridges. I am wondering if we can use collections or some other work around to acheive something which most systems cant provide. Its like this...

for example the HP 56 and HP 57 ink cartridges fit in to 50 different printers.
we want to list the products individually 1 time.
But we want people to be able to navigate to a page which shows all relevant products for their machine the machine name wouyld effectively be the collection name.

So if they have 'printer model x' which uses HP 56 and HP 57 they need to be able to select printer model x from a navigation list or list box and then be presented with the 2 cartridges.

I have a text file which lists the sku and products details for each cartridge - then in 1 field  for each product the machine x, y, z which the cartridge fits is listed, comma separated.

example sku; product title; product image; product price;product description; printer model x, printer model y , printer model z;

(these model numbers would effectively be the 'collection names/identifiers' that the cartridge should be contained in.

can we do something with this data?


Paul B

unread,
Feb 4, 2012, 8:04:14 AM2/4/12
to shopi...@googlegroups.com
Dave

Ithink its also importnat to note that we also have a file which is structured as follows:

machine brand; machine name; product sku 1, product sku 2;

the collection would be the product brand and name concatenated. the collection would be made up of the skus in field 3.

can we create collections like this in a bulk upload - basically listing relevant skus which exist in the catalogue?


Christopher Saunders

unread,
Feb 6, 2012, 9:43:40 AM2/6/12
to shopi...@googlegroups.com
Hello Paul,

You should be able to do what you want.  What you could probably do is while you are creating your products, have a Dictionary for each printer (x, y, z in your example).  On success of adding that product also add it's product id to your printers dictionary. Finally you can then iterate through each of your printer models, create the new collection then establish the relationship.


Collect is kinda weird, but it's the link between your product and the custom collection (in your case, the printers themselves).

--
Chris // Developer @ Shopify
Reply all
Reply to author
Forward
0 new messages