Jump to content

Customer group and item quantity change in order


Recommended Posts

Hey,
So here is my question. I'm currently connecting our ERP system to PrestaShop threw modules. I was able to transfert our products, customers and I'm able to change the order id state. Now I'm having a bit of struggle with the Customer groups(create and update) and modifying the quantities of an order(the reason for this is some of our clients sell products that are weight variable so if the client asks for 1kg but we can only sell that item with 900g then we need to change it in the order).  As anyone ever done this or can link me to a topic that talks about this?
Thank you in advance.

Link to comment
Share on other sites

  • 3 months later...

Here is the solution to my own question.  Feel free to write me if you have any questions
 

public function modifyItemInOrder($order_id, $order_param)
    {
        if ($order_id) {
            $order_detail = new OrderDetail($order_id);
        
            $order_detail->total_price_tax_incl             = $order_param->total_price_tax_incl;
            $order_detail->total_price_tax_excl             = $order_param->total_price_tax_excl;
            $order_detail->total_shipping_price_tax_incl    = $order_param->total_shipping_price_tax_incl;
            $order_detail->total_shipping_price_tax_excl    = $order_param->total_shipping_price_tax_incl;
        
            $order_detail->product_quantity                 = $order_param->product_quantity;
            $order_detail->update();
        }
    }

 

Cheers

Link to comment
Share on other sites

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