Product Error

products

#1

Hello, I’m new to Moltin.
I’m trying to make an app that list products depending on Categories, Like sections for each category. I created the products in the website, and the categories.
But when I try to Get the products, it shows this error that I cant understand.

Products error couldNotParseData(underlyingError: Optional(Swift.DecodingError.keyNotFound(CodingKeys(stringValue: “width”, intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: “meta”, intValue: nil), CodingKeys(stringValue: “dimensions”, intValue: nil)], debugDescription: “No value associated with key CodingKeys(stringValue: “width”, intValue: nil) (“width”).”, underlyingError: nil))))


#2

Hi @futaim!

Have you by any chance created a custom product model with a flow field? This looks like Swift’s Codable method is trying to parse a field called width under the dimensions model, but it can’t find it and it believes that it should not be optional.

Thanks,
Craig


#3

Hi , Thank you for replying to me ^^

I actually, created product on my Moltin dashboard, and filled the fields for product. And I created categories also.
So I cant understand what do you mean by custom product model ^^
I understand from the code error, that it cant find width… but I didn’t know how to fix this ^^

I use the project sample, which is provided by Moltin… and it works… But, when I put my client ID and change it to match my store… It doesn’t work… it doesn’t show the products I have or anything ^^


#4

Hey @futaim ,

Wanted to see if you were still having a problem. Can you pass through some of the code you are using or I am happy to hope on a quick screen share to help you get rolling.

-George


#5

Heyy @GeorgeF,
Thank you… Yess I couldnt solve this problem :frowning:
The thing is… I downloaded Swift project ( from Moltin website)…I run it and it works fine.
Then I changed the ID to my client ID… and some things to suit my store.
Then it didnt work at all… it doesn’t show category Name, and show Product Error.
I didn’t play with the code… thats why I don’t know where is the problem ^^


#6

It is most likely that your products do not have the same fields or that same catalog hierarchy.


#7

Hi @futaim

Just checking on, did you manage to resolve this issue with @GeorgeF ?

Thanks

Drew


#8

Hi @drew
yes everything’s fine ^^
Thank you