-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No image details in product and category #235
Comments
gtting same error please someone response! |
@Prateek58 |
I am having the same issue. |
@ddepassUSOM you mean, we just need to upload the images once again from admin?. I have the test data which nop commerce provided. and my API is not returning the image with the result of API |
Correct. I'm having the same issue you are having. |
So I think I figured out my problem. Create a new product with a product image which will be downloaded by nopCommercePOST /API/products {
"product": {
"name": "Skate Banana",
"full_description": "<strong>Great snowboard!</strong>",
"short_description": "TWIN ALL TERRAIN FUN",
**### "images": [
{
"src": "http://cdn.lib-tech.com/wp-content/uploads/2016/07/2016-2017-Lib-Tech-Skate-Banana-Yellow-Snowboard-800x800.png"
}**
]
}
}
When posting in your code, the image class you derived needs to reflect what the actual post JSON is suggesting.
so what I did was comment out what JSON is not using below example:
public class Image
{
//public int id { get; set; }
//public int picture_id { get; set; }
//public int position { get; set; }
public string src { get; set; }
public object attachment { get; set; }
}
Then amend my code as follows:
Image[] imgS = new Image[cnt];
for (int i = 0; i < cnt; i++)
{
Image img = new Image
{
//id = PFvarient.variant_id + PFvarient.files[i].id,
// picture_id = PFvarient.files[i].id,
src = PFvarient.files[i].preview_url,
//position = 1,
//attachment = PFvarient.files[i].size
//attachment = ConvertImageURLToBase64(PFvarient.files[i].preview_url)
};
imgS[i] = img;
}
Then generate the json for posting:
var dsProd = new
{
product = new
{
name = prd.name,
sku = prd.sku,
short_description = prd.short_description,
full_description = prd.full_description,
id = prd.id,
parent_grouped_product_id = prd.parent_grouped_product_id,
price = prd.price,
images = prd.images,
created_on_utc = DateTime.UtcNow
}
};
var json = JsonConvert.SerializeObject(dsProd);
Hope this helps |
image src is getting null in product API.
I tried to read all product as a list there is no image URL or a binary data
version (4.3 )
The text was updated successfully, but these errors were encountered: