Question

I currently have a site built on and hosted by bigcommerce. We have products in our store.

Additionally, I'm working on developing a mini-site with some of our store's content, by making use of the bigcommerce API (ruby version).

I have however run into a problem and a question.

1) Problem: populating images from the bigcommerce DB via the API doesn't seem to be possible. how do I do it!? When I query the images hash I receive a url to the API's route, where there are no images stored... If you know of any examples, please link me if you would. I've scoured github and got nothing.

I realize this is a fairly vague question, can update shortly with more detail if it's useful. But this ultimately provokes the following.

2) Question: is it poor design to re-persist all the db's objects (products) into the mini-site's database, purely for the purpose of making it easier to create a restful mini-site application? (I.e. creating a product page for each product object? E.g. product_path(product.id).)

I ask this because I suppose I could create a two-page or three-page app which will dynamically render the respective product information based on whichever product is clicked, and maybe just direct the user from there to the cart, but this seems awkward and forced. (for lack of a better expression.)

Was it helpful?

Solution

Speaking to your first question - it is possible to get the product images via API. It is very hard for me to understand what you are trying to do from your question (a code snippet of what you have tried would be helpful).

From the Bigcommerce Ruby lib - you should look up this method. It will do what you want. T

  def get_products_images(options={})
      @connection.get("/products/images", options)
    end

You will receive a response like the following -

{
        "id": 5,
        "product_id": 28,
        "image_file": "sample_images/picture_1__48492.png",
        "is_thumbnail": true,
        "sort_order": 0,
        "description": "",
        "date_created": "Mon, 26 Oct 2009 05:08:32 +0000"
    }

The store image can be found from http(s)://storeurl/product_images/{{image_file}}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top