createdotnet / API-Documentation

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

The "products" feed does not include the product options associated with a product. #2

Closed robertoldaker closed 9 years ago

Dayjo commented 9 years ago

Essentially a duplicate of https://github.com/createdotnet/API-Documentation/issues/3.

One fix to rule them all.

robertoldaker commented 9 years ago

No, I think this is a separate issue.

The "products" feed needs to list what product options and values are available for a given product (along with other data such as price).

The "order products" feed need to list what specific product option(s) were chosen by the customer when making the order.

Dayjo commented 9 years ago

Ah yes, I see what you mean!

Dayjo commented 9 years ago

The entire model for products is currently incorrect and needs updating.

robertoldaker commented 9 years ago

Where are we with this one - is it going to be a bit of a pig to do?

Dayjo commented 9 years ago

Hi Rob,

It's a little bit of a pig in regards to stock (kind of how we discussed before about option-based stock records versus standard stock). Working on a solution though, hopefully have something for next week!

robertoldaker commented 9 years ago

Hi Joel,

Not sure if this is of any help but I don;t need any stock information - just the names of the product options and the set of name/value pairs that correspond to each option.

This is the last fix required and then I will let Jessica use it in anger.

Rob.

On 6 February 2015 at 11:08, Joel notifications@github.com wrote:

Hi Rob,

It's a little bit of a pig in regards to stock (kind of how we discussed before about option-based stock records versus standard stock). Working on a solution though, hopefully have something for next week!

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

Dayjo commented 9 years ago

I've managed to put together a fix for this. As per the documentation it will look something like this;

{  
    "product":{  
        "ID":898440,
        "parent_category":123133,
        "title":"Retro T-Shirt",
        "short_description":"Quisque sed arcu quis nunc porttitor rutrum faucibus a nunc.",
        "long_description":"",
        "price":"25.99",
        "sku":"898440",
        "weight":"4.60",
        "stock_number":121,
        "title_tag":"Retro T-Shirt",
        "meta_keywords":"Tshirt, retro, clothing",
        "meta_description":"A retro T-shirt",
        "was_price":"0.00",
        "rrp":"0.00",
        "trade_price":"0.00",
        "options":[  
            {  
                "ID":"137379",
                "title":"Colour",
                "required":"1",
                "items":[  
                    {  
                        "ID":"561041",
                        "title":"Red",
                        "price_adjustment":"0.00",
                        "weight_adjustment":"0.000",
                        "is_custom_input":"0"
                    },
                    {  
                        "ID":"561045",
                        "title":"Blue",
                        "price_adjustment":"0.00",
                        "weight_adjustment":"0.000",
                        "is_custom_input":"0"
                    }
                ]
            }
        ]
    }
}

Will try and get this up on Monday for you Rob!

robertoldaker commented 9 years ago

Great - thanks for this, Joel and have a great weekend.

Hopefully I can get Jessica started on Mon or Tues. She is looking forward to using it and trying it out as it will save her a lot of time downloading and uploading files (as she does now).

Regards,

Rob.

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

I've managed to put together a fix for this. As per the documentation it will look something like this;

{ "product":{ "ID":898440, "parent_category":123133, "title":"Retro T-Shirt", "short_description":"Quisque sed arcu quis nunc porttitor rutrum faucibus a nunc.", "long_description":"", "price":"25.99", "sku":"898440", "weight":"4.60", "stock_number":121, "title_tag":"Retro T-Shirt", "meta_keywords":"Tshirt, retro, clothing", "meta_description":"A retro T-shirt", "was_price":"0.00", "rrp":"0.00", "trade_price":"0.00", "options":[ { "ID":"137379", "title":"Colour", "required":"1", "items":[ { "ID":"561041", "title":"Red", "price_adjustment":"0.00", "weight_adjustment":"0.000", "is_custom_input":"0" }, { "ID":"561045", "title":"Blue", "price_adjustment":"0.00", "weight_adjustment":"0.000", "is_custom_input":"0" } ] } ] } }

Will try and get this up on Monday for you Rob!

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

Dayjo commented 9 years ago

This is all live now @robertoldaker!

Hope this resolves the issue :)

robertoldaker commented 9 years ago

Thanks Joel. Will be testing it out today and tomorrow.

rob.

On 9 February 2015 at 15:03, Joel notifications@github.com wrote:

This is all live now @robertoldaker https://github.com/robertoldaker!

Hope this resolves the issue :)

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

robertoldaker commented 9 years ago

Hi Joel,

I found a couple of small issues ...

Product with id 126242 is including a spurious product option value that has a title of "null" for the product option "flavour". After look at the create.net website all of the production option values were there plus this spurious one.

Product with id 1172898 is returning a product option with a title of "null" when it should be "£".

access token is:- [removed]

Apart from that it seems to be ok.

Cheers,

rob.

On 9 February 2015 at 17:15, Robert Oldaker roldaker@gmail.com wrote:

Thanks Joel. Will be testing it out today and tomorrow.

rob.

On 9 February 2015 at 15:03, Joel notifications@github.com wrote:

This is all live now @robertoldaker https://github.com/robertoldaker!

Hope this resolves the issue :)

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

Dayjo commented 9 years ago

Hi Rob!

Thanks for the feedback!

Imagine the £ will be some sort of encoding issue which I'll see if I get a chance to fix. The other one i'm unsure, possibly still an encoding issue, perhaps in the system it has a character that the JSON doesn't like.

robertoldaker commented 9 years ago

Hi Joel,

Found a potential issue with single quotes.

This is example json from the product feed for product 907230 { "ID": 504280, "title": "Tinted \'Strawberry Shimmer\'", "price_adjustment": "1.00", "weight_adjustment": "0.000", "is_custom_input": false }

This is being interpreted as "Tinted \'Strawberry Shimmer\'" i.e. the "\" is being escaped when I assume its the single quote that needs to be escaped. Having said that not even sure that single quotes need/should be escaped at all since double quotes are being used!

Note: this is a different account to the previous issues, token is:- [deleted - please use domain name to reference account]

Rob.

On 9 February 2015 at 23:00, Joel notifications@github.com wrote:

Imagine the £ will be some sort of encoding issue which I'll see if I get a chance to fix. The other one i'm unsure, possibly still an encoding issue, perhaps in the system it has a character that the JSON doesn't like.

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

robertoldaker commented 9 years ago

Found something else about this. The product title is correctly dealing with single quotes (an example below) - looks like they do not need to be quoted at all and they fed through correctly.

{ "ID": 235081, "sku": "235081", "categories": [ 116307 ], "title": "'Sienna Red' Pigment Colour", "short_description": "", }

Rob.

On 10 February 2015 at 09:19, Robert Oldaker roldaker@gmail.com wrote:

Hi Joel,

Found a potential issue with single quotes.

This is example json from the product feed for product 907230 { "ID": 504280, "title": "Tinted \'Strawberry Shimmer\'", "price_adjustment": "1.00", "weight_adjustment": "0.000", "is_custom_input": false }

This is being interpreted as "Tinted \'Strawberry Shimmer\'" i.e. the "\" is being escaped when I assume its the single quote that needs to be escaped. Having said that not even sure that single quotes need/should be escaped at all since double quotes are being used!

Note: this is a different account to the previous issues, token is:- [deleted - please use domain name to reference account]

Rob.

On 9 February 2015 at 23:00, Joel notifications@github.com wrote:

Imagine the £ will be some sort of encoding issue which I'll see if I get a chance to fix. The other one i'm unsure, possibly still an encoding issue, perhaps in the system it has a character that the JSON doesn't like.

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

Dayjo commented 9 years ago

Hi Rob,

Have resolved the issue of null values, as well as the encoding issue with the £.

As for the slashes, it seems like the Tinted 'strawberry shimmer' option is stored in the database with the backslashes. There should only be single slashes though, we're not doing anything to add slashes in the JSON. As seen here;

robertoldaker commented 9 years ago

Hi Joel,

Issue with nulls are resolved now. Thanks.

I just tried adding a product that contained single quotes in its title and that also used single quotes in an option name and value for the product option. What I found was.

1) Product title is stored with just single quotes. 2) Product option title and product option value store single quotes with "\".

I have by-passed the issue in AngelBooks by ripping out the spurious "\"s but I thought I would raise the issue with you just in case it causes other issues.

I am ready to try it out with Jessica now.

Are you happy for it to be used? ( i.e. no more imminent changes due?)

Cheers,

Rob.

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

Hi Rob,

Have resolved the issue of null values, as well as the encoding issue with the £.

As for the slashes, it seems like the Tinted 'strawberry shimmer' option is stored in the database with the backslashes. There should only be single slashes though, we're not doing anything to add slashes in the JSON. As seen here;

https://camo.githubusercontent.com/04c20138409b2a1acba313d13773de7f9aefd7d7/687474703a2f2f636c2e6c792f696d6167652f3058307530563035314131752f496d616765253230323031352d30322d3130253230617425323031302e32362e3130253230616d2e706e67

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

Dayjo commented 9 years ago

Hi Rob,

Thanks for the feedback, I've raised the issue with the product option name on our regular issues list as this seems to just be an issue with the options system rather than the API itself.

Happy for you to use it yeah! We haven't got any plans to change the data models at all, in fact I'm currently working on some internal SDK stuff using the API and these models.

Obviously if we plan any changes that will affect usage we will let you know ahead of the changes as early as possible!

Happy APIing!