PrestaSharp icon indicating copy to clipboard operation
PrestaSharp copied to clipboard

I cannot upload or add products images.

Open kulunkadeco opened this issue 10 years ago • 8 comments

Hello everybody,

First of all, thank you for this usefull library.

I'm working with Prestashop Cloud and I have found a problem I'm not able to solve. I can get products, Manufacturers and so on without problem. But I cannot upload or add products images.

Here is the code where I upload or add a new image:

ImageFactory myFactory = new ImageFactory(BaseUrl, Account, Password); string image = @"D:\test1.jpg";

myFactory.AddProductImage(1, image); myFactory.UpdateProductImage(1, 1, image);

error {"\r\nCC8N5UKFD62I4VDLPSMUXQNUWS5DVYPG\r\n\r\nBasic Q0M4TjVVS0ZENjJJNFZETFBTTVVYUU5VV1M1RFZZUEc6\r\n\r\napplication/json, application/xml, text/json, text/x-json, text/javascript, text/xml\r\n\r\n HttpStatusCode: InternalServerError"}

Thanks in advance

kulunkadeco avatar Jan 29 '15 11:01 kulunkadeco

Hello @kulunkadeco Is it possible to enable display php errors in PrestaShop Cloud? Regards.

EduLeonPavon avatar Jan 29 '15 15:01 EduLeonPavon

@EduLeonPavon Exception thrown: 'Bukimedia.PrestaSharp.PrestaSharpException' in Bukimedia.PrestaSharp.dll

Additional information:

full

HGMSBST9J6XRV9J2RQ7CAWDF459GZQ7I

Basic SEdNU0JTVDlKNlhSVjlKMlJRN0NBV0RGNDU5R1pRN0kgIDo=

text/xml

HttpStatusCode: InternalServerError

Code:

                var ImagesList = this.ImageFactory.GetProductImages((long)ProductPresta.id);
                //remove old images
                if (ImagesList.Count != 0)
                {
                    foreach (var Image in ImagesList)
                    {
                        this.ImageFactory.DeleteProductImage((long)ProductPresta.id, Image.id);
                    }
                }

meron1122 avatar Aug 17 '15 11:08 meron1122

Web service was authorized?

n3xpect avatar Aug 17 '15 11:08 n3xpect

@mcaykara Yep, everything expect this works fine, This Product have no image, I expect empty enumerator, no Exception from PrestaShop. Btw associations.images always is empty

meron1122 avatar Aug 17 '15 12:08 meron1122

Hımmm, yes, now i saw exception

n3xpect avatar Aug 17 '15 12:08 n3xpect

Hi, news about this bug? I'm in the same condition when i use

ImageFactory images = new ImageFactory(BaseUrl, Account, Password);
var ImageList = images.GetProductImages((long)product.id);

Thank you anyway for this great work :)

N0is3 avatar Apr 20 '16 16:04 N0is3

Hi, news about this? I'm having the same problem.

ImageFactory images = new ImageFactory(BaseUrl, Account, Password); var ImageList = images.GetProductImages((long)product.id);

How can i solve this?

JM63 avatar Nov 14 '16 13:11 JM63

I was able to work around it by checking the id_default_image property. If its null I assume it has no Image associated to it, so I can make the query for product Images on the Image Factory.

ifiora avatar Feb 26 '18 19:02 ifiora