createdotnet / API-Documentation

Create. API Documenation
http://developers.create.net/API-Documentation/
0 stars 2 forks source link

The "order products" feed does not show what product options were selected by the customer. #3

Closed robertoldaker closed 9 years ago

Dayjo commented 9 years ago

This is undecided as to whether they should be included within the product item as sub items or be a separate request.

It's probably nicer if it's just included within the product item.

Dayjo commented 9 years ago

Currently just a serialized string is included so we just need to unserialise it and format it nicer.

Dayjo commented 9 years ago

Hi Rob,

I've done a fix for this which hopefully I'll be able to test and release tomorrow.

It will change the options element of an order/product into an object like so;

 options: {
    71099: { // Unique ID for the Option
        name: "Label Pack Size",
        value: "5 Sheets",
        custom_value: null
   }
}

How does this work for you? I'm thinking we may need to provide the unique ID for the item too (the item being '5 sheets', the option being 'Label Pack Size') as the value could be changed by the user and the ID is more useful.

robertoldaker commented 9 years ago

Hi Joel,

Its not ideal since a database id is being used as a json variable name (e.g. 71099). To perform the json to c# mapping I create classes that need fixed variable names.

Ideally I would like an array of options e.g. options: [ { name: "pack size", value: "small", }, { name: "colour", value: "red" } ]

What do you think?

Rob.

On 3 February 2015 at 17:21, Joel notifications@github.com wrote:

Hi Rob,

I've done a fix for this which hopefully I'll be able to test and release tomorrow.

It will change the options element of an order/product into an object like so;

options: { 71099: { // Unique ID for the Option name: "Label Pack Size", value: "5 Sheets", custom_value: null } }

How does this work for you?

— Reply to this email directly or view it on GitHub https://github.com/createdotnet/API-Documentation/issues/3#issuecomment-72693207 .

Dayjo commented 9 years ago

To allow us the full scope of the options system, I think it should probably be more like;

options: [
{
     ID: 71099,
     name: "pack size",
     items: [
         {
              ID: 12584,
              value: "small",
              custom_value: null
         }
         ...
    ]
}
...
]

The reason for making items an array is while currently it's not possible, some day we might allow a product option with multiple options (i.e. a checkbox list, or multi select box) This is much closer to the true structure of the options and ensures the full information from the order.

You should be fine with just using items[0] to get the selected item from the option.

robertoldaker commented 9 years ago

That's fine by me.

On 4 February 2015 at 10:10, Joel notifications@github.com wrote:

To allow us the full scope of the options system, I think it should probably be more like;

options: [ { ID: 71099, name: "pack size", items: [ { ID: 12584, value: "small", custom_value: null } ... ] } ... ]

The reason for making items an array is while currently it's not possible, some day we might allow a product option with multiple options (i.e. a checkbox list, or multi select box) This is much closer to the true structure of the options and ensures the full information from the order.

You should be fine with just using items[0] to get the selected item from the option.

— Reply to this email directly or view it on GitHub https://github.com/createdotnet/API-Documentation/issues/3#issuecomment-72829829 .

Dayjo commented 9 years ago

Hi Rob,

This has now been put into production, please let me know if it's working for you and close the issue if you're happy!

Dayjo commented 9 years ago

I have updated the Documentation accordingly; http://developers.create.net/API-Documentation/resources/shop/order_managment/order_products.html

robertoldaker commented 9 years ago

Hi Joel,

I don't think its working where there are more than 1 product option for a product.

This is a snippet of the json returned for sale 1948564 and the product "(125033) Organic & Fairtrade Shea Butter (Refined / Unrefined)". This product has two options "g" and "refined / unrefined".

"options": [ {"ID":71248,"name":"g","items": [{"ID":378974,"value":"100g","custom_value":""}]}, {"ID":78908,"name":"Refined \/ Unrefined","items": [{"ID":378974,"value":"100g","custom_value":""}, {"ID":2741018,"value":"Unrefined (Cream)","custom_value":""}] }],

As you can see the second option is returning 2 items for the options value (which shouldn't happen!). It looks like it's erroneously inserting the value for the first option.

Rob.

Dayjo commented 9 years ago

Hi Rob,

Apologies, I've resolved that issue for you.

Dayjo commented 9 years ago

Hi @robertoldaker

Quick update on this, I'm changing the 'value' key on an item to be 'title' as it's a more accurate representation of a product option item, and will be replicated across the /Products model too.

So it'll now look like;;

options: [
{
     ID: 71099,
     name: "pack size",
     items: [
         {
              ID: 12584,
              title: "small", // <---- this is now 'title'
              custom_value: null
         }
         ...
    ]
}
...
]
robertoldaker commented 9 years ago

OK - thanks for letting me know.

rob.

On 6 February 2015 at 12:30, Joel notifications@github.com wrote:

Hi Rob,

Quick update on this, I'm changing the 'value' key on an item to be 'title' as it's a more accurate representation of a product option item, and will be replicated across the /Products model too.

So it'll now look like;;

options: [ { ID: 71099, name: "pack size", items: [ { ID: 12584, title: "small", custom_value: null } ... ] } ... ]

— Reply to this email directly or view it on GitHub https://github.com/createdotnet/API-Documentation/issues/3#issuecomment-73229659 .

Dayjo commented 9 years ago

On top of that, for consistency, I will be changing option.name to be title also, although this probably won't happen until Monday.

I figure we may as well use the same terminology across each thing that has a 'title/name/etc', this is the internal terminology too. Just when the documentation was written it was changed to 'name'.

I will keep you posted.