You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (stock != null)
{
stock.First().quantity = stock.First().quantity + (int)Math.Floor(qtychange);
// DATA IS PERFECT UP TO THIS POINT
StockAvailableFactory.Update(stock.First());
}
public void Update(Entities.stock_available StockAvailable)
{
RestRequest request = this.RequestForUpdate("stock_availables", StockAvailable.id, StockAvailable);
// DATA IS PERFECT UP TO THIS POINT
this.Execute<Entities.stock_available>(request); // NOW IT FALLS APART AND API RETURNS ERROR NULL REFERENCE.
}
The text was updated successfully, but these errors were encountered:
Hi. We have a problem. I don’t have access to the site I use for testing. It is a live site of a customer.
From: Eduardo León Pavón [mailto:notifications@github.com]
Sent: Monday, 9 February 2015 9:50 PM
To: Bukimedia/PrestaSharp
Cc: Ian Gold
Subject: Re: [PrestaSharp] Getting null reference from api when updating stock availability (#120)
Hi
I have the same issue as @iang0ld experienced (null reference when I tried to update the stock_available), any ideas to fix it?
I used fiddler to compose the PUT request for updating stock_available and the error message is
Fatal error: Class name must be a valid object or a string in C:\inetpub\wwwroot\PrestashopDemo\classes\webservice\WebserviceRequest.php on line 1408
This has been working previously, but not now.
StockAvailableFactory StockAvailableFactory = new StockAvailableFactory(ApiAddress, ApiAccount, ApiSecretKey);
Dictionary<string, string> dtn = new Dictionary<string, string>();
dtn.Add("id_product", product["ExtID"].ToString());
dtn.Add("id_product_attribute", product["ExtGroupID"].ToString()); // id_attribute_id is actually the combinationid
List<stock_available> stock = StockAvailableFactory.GetByFilter(dtn, null, null);
if (stock != null)
{
stock.First().quantity = stock.First().quantity + (int)Math.Floor(qtychange);
// DATA IS PERFECT UP TO THIS POINT
StockAvailableFactory.Update(stock.First());
}
public void Update(Entities.stock_available StockAvailable)
{
RestRequest request = this.RequestForUpdate("stock_availables", StockAvailable.id, StockAvailable);
// DATA IS PERFECT UP TO THIS POINT
this.Execute<Entities.stock_available>(request); // NOW IT FALLS APART AND API RETURNS ERROR NULL REFERENCE.
}
The text was updated successfully, but these errors were encountered: