Jump to content

[SOLVED] Creating Order and OrderDetails Programatically


andtrx

Recommended Posts

I have the following situation:

1. in a 3rd party a client can update a order I sent when it was created in the prestashop website.
2. I check via a cron job if the order has been updated in the 3rd party software and I pull it back in our website.
3. If they added products via the 3rd party software, should I remove all of my products from my order and re-create the order with the products from theirs? Or I can simple update and add what is missing?

Currently my codes empties the cart and re-ads the prodcuts. I have all that taken care of.

I have an issue though, where the order detail products are not emptied out. I cant find a method that does this.
$listOfProducts below shows me the current products that are in the order details, but I dont know how to empty that out.
 

                        $listOfproducts = OrderDetail::getList((int)$order->NumarComanda);


                        $order_detail = new OrderDetail(null, null, null);
                        $order_detail->createList($prestashopOrder, $cart, 4, $cartProducts);
                        $order_detail_list[] = $order_detail;

$order_detail->createList($prestashopOrder, $cart, 4, $cartProducts); 

Simply add the new products to the order details, but the old ones are not emptied so I end up with the correct price of the order but with too many being shown in the product details.

Edited by andtrx
added tags to post (see edit history)
Link to comment
Share on other sites

  • andtrx changed the title to [SOLVED] Creating Order and OrderDetails Programatically

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...