Bukimedia / PrestaSharp

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

Order_history ADD doesnt work #329

Open centenario opened 6 years ago

centenario commented 6 years ago

Hi, Prestashop 1.6.1.15 Im trying to ADD a new order_history:

OrderHistoryFactory ohfac = new OrderHistoryFactory(ecomm.BASEURL_API, ecomm.ACCOUNT_API, ecomm.PASSWORD_API);

                                if (ohfac != null)
                                {

                                    /*order prsorder = ofac.Get(model.ECOMMERCEORDERID);
                                    prsorder.current_state = equivsitu.ID_ORDER_STATE;
                                    ofac.Update(prsorder);*/

                                    order_history prsorderhistory = new order_history();
                                    prsorderhistory.id_order = model.ECOMMERCEORDERID;
                                    prsorderhistory.id_employee = 0;
                                    prsorderhistory.date_add = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                                    prsorderhistory.id_order_state = equivsitu.ID_ORDER_STATE;
                                    ohfac.Add(prsorderhistory);
}

It execute right witouht any error messages but it doenst make any insert into table . What can be wrong ? thanks in advance

NearEarthObject commented 6 years ago

Hi ! i face similar issue by developing simple module, try to remove :

prsorderhistory.date_add = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

And let it use autodate core function.

Maybe It can help

centenario commented 6 years ago

Hi, i have done it but it works wrong still.

If i change state throught order: order prsorder = ofac.Get(model.ECOMMERCEORDERID); prsorder.current_state = equivsitu.ID_ORDER_STATE; ofac.Update(prsorder);

Is wrong to change order's state in this way?.

I see that in Prestashop the only difference is that in Orders list when it changes order's state with prsorder.current_state, total amount still got background in green. When i change state with order_history total amount background is transparent (or there's not)

So i dont know if it is right and enough changing state with current_state.

thanks in advance.