Jump to content

Edit History

teratux

teratux

Hello, I'm having trouble generating a partial refund for a product in an order from my prestashop 16 module.  For some reason it still keeps displaying the product as available for a partial refund but as you can see in the code I think I managed to create a refund.  Any ideas on where the issue might be?

                        $orderDetail->product_quantity_return = 1;
                        $orderDetail->product_quantity_refunded = 1;
                        $orderDetail->product_quantity = 1;
                        $orderDetail->update();

                        $list = [];
                        $list[] = $item;

                        $currency = new Currency($order->id_currency);
                        $orderSlip = new OrderSlip();
                        $orderSlip->id_customer = (int)$order->id_customer;
                        $orderSlip->id_order = (int)$order->id;
                        $orderSlip->amount = (float)(-$item['product_price']);
                        $orderSlip->shipping_cost = false;
                        $orderSlip->shipping_cost_amount = 0;
                        $orderSlip->conversion_rate = $currency->conversion_rate;
                        $orderSlip->total_products_tax_excl = 0;
                        $orderSlip->total_products_tax_incl = 0;
                        $orderSlip->total_shipping_tax_excl = 0;
                        $orderSlip->total_shipping_tax_incl = 0;
                        $orderSlip->partial = 1;
                        if ($orderSlip->add()) {
                            $orderSlip->addPartialSlipDetail($list);
                        }
                        
                        OrderSlip::create($order, $list, false, -$item['product_price'], true, false); 

 

image.png

teratux

teratux

Hello, I'm having trouble generating a partial refund for a product in an order from my prestashop 16 module.  For some reason it still keeps displaying the product as available for a partial refund but as you can see in the code I think I managed to create a refund.  Any ideas on where the issue might be?

```php

$orderDetail->product_quantity_return = 1; $orderDetail->product_quantity_refunded = 1; $orderDetail->product_quantity = 1; $orderDetail->update(); $list = []; $list[] = $item; $currency = new Currency($order->id_currency); $orderSlip = new OrderSlip(); $orderSlip->id_customer = (int)$order->id_customer; $orderSlip->id_order = (int)$order->id; $orderSlip->amount = (float)(-$item['product_price']); $orderSlip->shipping_cost = false; $orderSlip->shipping_cost_amount = 0; $orderSlip->conversion_rate = $currency->conversion_rate; $orderSlip->total_products_tax_excl = 0; $orderSlip->total_products_tax_incl = 0; $orderSlip->total_shipping_tax_excl = 0; $orderSlip->total_shipping_tax_incl = 0; $orderSlip->partial = 1; if ($orderSlip->add()) { $orderSlip->addPartialSlipDetail($list); } OrderSlip::create($order, $list, false, -$item['product_price'], true, false);

```

image.thumb.png.69f213264312a2818415279503e0edbb.png

image.png

×
×
  • Create New...