Skip to content
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

Inserting products fails with Prestashop 1.7.3 #318

Open
javiercampos opened this issue Mar 23, 2018 · 15 comments
Open

Inserting products fails with Prestashop 1.7.3 #318

javiercampos opened this issue Mar 23, 2018 · 15 comments
Assignees

Comments

@javiercampos
Copy link

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).

@javiercampos javiercampos changed the title Inserting products fail with Prestashop 1.7.3 Inserting products fails with Prestashop 1.7.3 Mar 23, 2018
rodolfoghi added a commit to Maxiprod/PrestaSharp that referenced this issue May 17, 2018
@KouzelisChris
Copy link

your solution doesn't break compatibility with versions 1.7 and higher

@SarayPerez
Copy link

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

@KouzelisChris
Copy link

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

Bukimedia.PrestaSharp.zip

@mowcixo
Copy link
Collaborator

mowcixo commented Dec 20, 2018

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.

@mowcixo mowcixo closed this as completed Dec 20, 2018
@biovolt
Copy link

biovolt commented Jan 8, 2019

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

@albertg5
Copy link

albertg5 commented Aug 13, 2019

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.

@mowcixo
Copy link
Collaborator

mowcixo commented Aug 13, 2019

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?

@albertg5
Copy link

albertg5 commented Aug 13, 2019

1.0.5. The last version available in Nuget Package Manager

@mowcixo
Copy link
Collaborator

mowcixo commented Aug 13, 2019

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 :)

@mowcixo mowcixo reopened this Aug 13, 2019
@albertg5
Copy link

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

@albertg5
Copy link

ProductFactory productFactory = new ProductFactory(BaseUrl, Account, Password);
product p = new product();

//Here we assign several information inside of some properties

productFactory.Add(p);

@albertg5
Copy link

Moises (mowcixo), I'm watching that other users have the same issue #365 #366 #369

@mowcixo
Copy link
Collaborator

mowcixo commented Aug 14, 2019

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.

@mowcixo mowcixo self-assigned this Aug 14, 2019
@albertg5
Copy link

Thank you to you for your efforts, as soon as you find a solution please let us know.

@albertg5
Copy link

Mowcixo,

Have you some news about that?

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants