FAQ
Hi!

I want to fetch all products that are available in a certain taxon, using
the Spree API.

I'm adding "&q[taxon_ids_in]=X" to the query string, in order to get the
items in the taxon with the id X, in accordance with my understanding of
<http://guides.spreecommerce.com/api/products.html> and
<https://github.com/ernie/ransack/wiki/Basic-Searching>, but it doesn't
work (the parameter seems to be ignored).

Any pointers would be appreciated!

Regards,
Jon

Search Discussions

  • Info at Jul 22, 2013 at 8:18 pm
    Hi Daniel, and thank you for your pointer! :-)

    Now if I can only figure out how to go from a permalink string (such as
    "clothing/sweaters") to the taxon identifier, I'll be all set. :-) (The
    individual taxons doesn't seem to be searchable; for example,
    "/api/taxonomies/<ID>/taxons?q[name_cont]=X" doesn't do anything.)

    Have a good week!

    Jon
    On Monday, July 22, 2013 1:42:02 AM UTC+2, Daniel Carter wrote:

    Hi Jon,

    I've been playing with the API recently and hit the same issue. I
    managed to get it work using 'classifications_taxon_id_in' instead of
    'taxon_ids_in' in the search string.

    I'm guessing the reason the former works and the latter doesn't is
    because the Product and Taxon models are associated via an intermediary
    table called 'classifications' (see

    http://guides.spreecommerce.com/developer/products.html#taxons-and-taxonomies).


    My gut feeling is that there's a better way to do this, though, so if
    anyone else has any ideas I'd really love to hear them!

    Hope that helps!

    Cheers,
    Daniel
    On 21/07/2013 6:17 AM, in...@jonkri.com <javascript:> wrote:
    Hi!

    I want to fetch all products that are available in a certain taxon, using
    the Spree API.

    I'm adding "&q[taxon_ids_in]=X" to the query string, in order to get the
    items in the taxon with the id X, in accordance with my understanding of
    <http://guides.spreecommerce.com/api/products.html> and
    <https://github.com/ernie/ransack/wiki/Basic-Searching>, but it doesn't
    work (the parameter seems to be ignored).

    Any pointers would be appreciated!

    Regards,
    Jon
  • Daniel Carter at Jul 22, 2013 at 10:32 pm
    Hi Jon,

    That's also something I was working on :) The API has a separate,
    dedicated 'taxons' endpoint in addition to the 'taxonomies' endpoint. It
    gives full access to all taxons, so your search should work there, via
    the /api/taxons route. Again, it's clunky (you have to do two separate
    searches), but it should work.

    Best of luck!

    Cheers,
    Daniel
    On 23/07/2013 5:18 AM, info@jonkri.com wrote:
    Hi Daniel, and thank you for your pointer! :-)

    Now if I can only figure out how to go from a permalink string (such as
    "clothing/sweaters") to the taxon identifier, I'll be all set. :-) (The
    individual taxons doesn't seem to be searchable; for example,
    "/api/taxonomies/<ID>/taxons?q[name_cont]=X" doesn't do anything.)

    Have a good week!

    Jon
    On Monday, July 22, 2013 1:42:02 AM UTC+2, Daniel Carter wrote:

    Hi Jon,

    I've been playing with the API recently and hit the same issue. I
    managed to get it work using 'classifications_taxon_id_in' instead of
    'taxon_ids_in' in the search string.

    I'm guessing the reason the former works and the latter doesn't is
    because the Product and Taxon models are associated via an intermediary
    table called 'classifications' (see

    http://guides.spreecommerce.com/developer/products.html#taxons-and-taxonomies).


    My gut feeling is that there's a better way to do this, though, so if
    anyone else has any ideas I'd really love to hear them!

    Hope that helps!

    Cheers,
    Daniel
    On 21/07/2013 6:17 AM, in...@jonkri.com <javascript:> wrote:
    Hi!

    I want to fetch all products that are available in a certain taxon, using
    the Spree API.

    I'm adding "&q[taxon_ids_in]=X" to the query string, in order to get the
    items in the taxon with the id X, in accordance with my understanding of
    <http://guides.spreecommerce.com/api/products.html> and
    <https://github.com/ernie/ransack/wiki/Basic-Searching>, but it doesn't
    work (the parameter seems to be ignored).

    Any pointers would be appreciated!

    Regards,
    Jon
  • Info at Jul 23, 2013 at 1:35 am
    Hi again, Daniel!

    Wonderful! It works like a charm! Thanks a lot! ;-)

    Take care!

    Jon
    On Tuesday, July 23, 2013 12:32:47 AM UTC+2, Daniel Carter wrote:

    Hi Jon,

    That's also something I was working on :) The API has a separate,
    dedicated 'taxons' endpoint in addition to the 'taxonomies' endpoint. It
    gives full access to all taxons, so your search should work there, via
    the /api/taxons route. Again, it's clunky (you have to do two separate
    searches), but it should work.

    Best of luck!

    Cheers,
    Daniel
    On 23/07/2013 5:18 AM, in...@jonkri.com <javascript:> wrote:
    Hi Daniel, and thank you for your pointer! :-)

    Now if I can only figure out how to go from a permalink string (such as
    "clothing/sweaters") to the taxon identifier, I'll be all set. :-) (The
    individual taxons doesn't seem to be searchable; for example,
    "/api/taxonomies/<ID>/taxons?q[name_cont]=X" doesn't do anything.)

    Have a good week!

    Jon
    On Monday, July 22, 2013 1:42:02 AM UTC+2, Daniel Carter wrote:

    Hi Jon,

    I've been playing with the API recently and hit the same issue. I
    managed to get it work using 'classifications_taxon_id_in' instead of
    'taxon_ids_in' in the search string.

    I'm guessing the reason the former works and the latter doesn't is
    because the Product and Taxon models are associated via an intermediary
    table called 'classifications' (see
    http://guides.spreecommerce.com/developer/products.html#taxons-and-taxonomies).

    My gut feeling is that there's a better way to do this, though, so if
    anyone else has any ideas I'd really love to hear them!

    Hope that helps!

    Cheers,
    Daniel
    On 21/07/2013 6:17 AM, in...@jonkri.com <javascript:> wrote:
    Hi!

    I want to fetch all products that are available in a certain taxon, using
    the Spree API.

    I'm adding "&q[taxon_ids_in]=X" to the query string, in order to get
    the
    items in the taxon with the id X, in accordance with my understanding
    of
    doesn't
    work (the parameter seems to be ignored).

    Any pointers would be appreciated!

    Regards,
    Jon
  • Ryan Bigg at Jul 23, 2013 at 1:51 am
    Thank you for helping Jon, Daniel. Very much appreciated.

    On Tue, Jul 23, 2013 at 11:35 AM, wrote:

    Hi again, Daniel!

    Wonderful! It works like a charm! Thanks a lot! ;-)

    Take care!

    Jon

    On Tuesday, July 23, 2013 12:32:47 AM UTC+2, Daniel Carter wrote:

    Hi Jon,

    That's also something I was working on :) The API has a separate,
    dedicated 'taxons' endpoint in addition to the 'taxonomies' endpoint. It
    gives full access to all taxons, so your search should work there, via
    the /api/taxons route. Again, it's clunky (you have to do two separate
    searches), but it should work.

    Best of luck!

    Cheers,
    Daniel
    On 23/07/2013 5:18 AM, in...@jonkri.com wrote:
    Hi Daniel, and thank you for your pointer! :-)

    Now if I can only figure out how to go from a permalink string (such as
    "clothing/sweaters") to the taxon identifier, I'll be all set. :-) (The
    individual taxons doesn't seem to be searchable; for example,
    "/api/taxonomies/<ID>/taxons?**q[name_cont]=X" doesn't do anything.)

    Have a good week!

    Jon
    On Monday, July 22, 2013 1:42:02 AM UTC+2, Daniel Carter wrote:

    Hi Jon,

    I've been playing with the API recently and hit the same issue. I
    managed to get it work using 'classifications_taxon_id_in' instead of
    'taxon_ids_in' in the search string.

    I'm guessing the reason the former works and the latter doesn't is
    because the Product and Taxon models are associated via an
    intermediary
    taxons-and-taxonomies<http://guides.spreecommerce.com/developer/products.html#taxons-and-taxonomies>).

    My gut feeling is that there's a better way to do this, though, so if
    anyone else has any ideas I'd really love to hear them!

    Hope that helps!

    Cheers,
    Daniel
    On 21/07/2013 6:17 AM, in...@jonkri.com <javascript:> wrote:
    Hi!

    I want to fetch all products that are available in a certain taxon, using
    the Spree API.

    I'm adding "&q[taxon_ids_in]=X" to the query string, in order to get
    the
    items in the taxon with the id X, in accordance with my understanding
    of
    and
    but it doesn't
    work (the parameter seems to be ignored).

    Any pointers would be appreciated!

    Regards,
    Jon

    --

    Ryan Bigg
    Community Manager
    Spree Commerce, Inc.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupspree-user @
categoriesrubyonrails
postedJul 20, '13 at 9:17p
activeJul 23, '13 at 1:51a
posts5
users3
websitespreecommerce.com
irc#RubyOnRails

3 users in discussion

Info: 3 posts Daniel Carter: 1 post Ryan Bigg: 1 post

People

Translate

site design / logo © 2022 Grokbase