Bukimedia / PrestaSharp

CSharp .Net client library for the PrestaShop API via web service
GNU General Public License v3.0
155 stars 153 forks source link

Update a stock_availible #443

Open ymonnet opened 2 years ago

ymonnet commented 2 years ago

Please consider making a Pull Request if you are capable of doing so.

If your problem is how to implement anything with PrestaSharp or make a question, please, refer to our Slack# group with this request link: https://join.slack.com/t/prestasharp/shared_invite/enQtNTM2OTI1OTg0NzUyLTY4NDdkZDFmY2EwMGE4MTMzZjk5YzZiMTk3MzUwNzUxNTdhMWEwZjFjNDJiZTIyMjI0MDM0NTcwMzIzNGI0Njc

Library Version:

1.x.x

NuGet Package Url:

https://www.nuget.org/packages/PrestaSharp/1.x.x

Prestashop version:

1.7.8

Describe the Bug:

Hi, I have an issue with prestasharp. I can't upate a data into prestasharp without have this error :

<?xml version="1.0" encoding="UTF-8"?>

stock_availables HttpStatusCode: NotFound System.Collections.Generic.List1[InterfacePrestashop.Models.StocksAvailible] System.Collections.Generic.List1[Bukimedia.PrestaSharp.Entities.stock_available]

But in my database, i have an id of it. I use an object generate with the row so data are same. Add() doesn't work too. My code : `var temp = new stock_available();

                var tmp = GetStockAvailibleByIdProduct(data.id_product.ToString());

                if (tmp != null)
                {
                    tmp.quantity = data.quantity;

                    //stkAvailibleFact.Update(tmp);
                    stkAvailibleFact.Update(tmp);
                }
                else
                {
                    temp.id_product = data.id_product;
                    temp.id = id;
                    temp.depends_on_stock = data.depends_on_stock;
                    temp.id_product_attribute = data.id_product_attribute;
                    temp.id_shop = data.id_shop;
                    temp.id_shop_group = data.id_shop_group;
                    temp.out_of_stock = data.out_of_stock;
                    temp.quantity = data.quantity;
                    id++;
                    stocksBulkAvailibles.Add(temp);
                }

            }
            stkAvailibleFact.AddList(stocksBulkAvailibles);`

To Reproduce:

  1. juste do an update on this table

Expected Behavior:

something i can do to bypass or correct code behind.