PrestaSharp
PrestaSharp copied to clipboard
Inserting products fails with Prestashop 1.7.3
There are two new fields, one of them can't be null, so inserting fails. The fields are low_stock_alert
(a boolean/int) and low_stock_threshold
(an int).
I've put them in product
and everything worked again, but I'm not sure if that will break compatibility with previous versions (maybe if the data is sent in the REST request it will fail, I can't test it right now).
your solution doesn't break compatibility with versions 1.7 and higher
Hello! ,
Can anyone tell me how I can put that new fields in PrestaSharp in my Visual Studio 2013 project? Thanks in advance! Saray Pérez
Hello! ,
Can anyone tell me how I can put that new fields in PrestaSharp in my Visual Studio 2013 project? Thanks in advance! Saray Pérez
You have to edit Bukimedia/PrestaSharp and add the 2 fields. After that Bukimedia.PrestaSharp.Entities.product will have the 2 new fields. I have attached my Bukimedia.PrestaSharp which have the 2 fields if you cant edit it on your own
Hello, we just released the official NuGet release that fixes the related problem. Yo can find it searching by PrestaSharp in nuget repositories, or the release https://github.com/Bukimedia/PrestaSharp/releases/tag/1.0.0
Sorry for the delay and thanks for waiting.
Hi This breaks when decoding a response coming back from prestashop where low_stock_threshold is "" and it tries to convert it to an int. It throws a System.FormatException: 'Input string was not in a correct format.' on PrestaSharpDeserializer.cs ln 130
Dictionary<string, string> dtn = new Dictionary<string, string>(); dtn.Add("supplier_reference", sku); Bukimedia.PrestaSharp.Entities.product product = this.productFactory.GetByFilter(dtn, null, null).FirstOrDefault()
Prestashop 1.7.4.4 & 1.7.5
This issue haven't fixed yet, because I use the last version of Prestasharp, I try to add product to Prestahop 1.7.4.3 and it still appears.
This issue haven't fixed yet, because I use the last version of Prestasharp, I try to add product to Prestahop 1.7.4.3 and is still appearing it.
What version number are you using?
1.0.5. The last version available in Nuget Package Manager
1.0.5. The last version available in Nuget Package Manager
Ok, thanks for the feedback, are you using an example similar as mentioned in @biovolt comment?:
Hi This breaks when decoding a response coming back from prestashop where low_stock_threshold is "" and it tries to convert it to an int. It throws a System.FormatException: 'Input string was not in a correct format.' on PrestaSharpDeserializer.cs ln 130
Dictionary<string, string> dtn = new Dictionary<string, string>(); dtn.Add("supplier_reference", sku); Bukimedia.PrestaSharp.Entities.product product = this.productFactory.GetByFilter(dtn, null, null).FirstOrDefault()
Prestashop 1.7.4.4 & 1.7.5
If not, you'll help with your own code snippet :)
I'm trying to set low_stock_alert and low_stock_threshold and the error still appears. I have just tried with Prestashop 1.7.2.4 and it works properly
ProductFactory productFactory = new ProductFactory(BaseUrl, Account, Password); product p = new product();
//Here we assign several information inside of some properties
productFactory.Add(p);
Moises (mowcixo), I'm watching that other users have the same issue #365 #366 #369
Yes, I was digging into it yesterday, and it seems that in newer versions of PrestaShop, they consider 0 as "" on some webservice responses, I'll try to find a global solution for that. Thanks for your research on older issues.
Thank you to you for your efforts, as soon as you find a solution please let us know.
Mowcixo,
Have you some news about that?
Best regards