Updated refund for new product types
This commit is contained in:
parent
c8505d3fbc
commit
b707a855fc
|
|
@ -129,8 +129,11 @@ class RefundRepository extends Repository
|
|||
'additional' => $orderItem->additional
|
||||
]);
|
||||
|
||||
if ($orderItem->type == 'configurable' && $orderItem->child) {
|
||||
$childOrderItem = $orderItem->child;
|
||||
if ($orderItem->getTypeInstance()->isComposite()) {
|
||||
foreach ($orderItem->children as $childOrderItem) {
|
||||
$finalQty = $childOrderItem->qty_ordered
|
||||
? ($childOrderItem->qty_ordered / $orderItem->qty_ordered) * $qty
|
||||
: $childOrderItem->qty_ordered;
|
||||
|
||||
$refundItem->child = $this->refundItemRepository->create([
|
||||
'refund_id' => $refund->id,
|
||||
|
|
@ -138,11 +141,11 @@ class RefundRepository extends Repository
|
|||
'parent_id' => $refundItem->id,
|
||||
'name' => $childOrderItem->name,
|
||||
'sku' => $childOrderItem->sku,
|
||||
'qty' => $qty,
|
||||
'qty' => $finalQty,
|
||||
'price' => $childOrderItem->price,
|
||||
'base_price' => $childOrderItem->base_price,
|
||||
'total' => $childOrderItem->price * $qty,
|
||||
'base_total' => $childOrderItem->base_price * $qty,
|
||||
'total' => $childOrderItem->price * $finalQty,
|
||||
'base_total' => $childOrderItem->base_price * $finalQty,
|
||||
'tax_amount' => 0,
|
||||
'base_tax_amount' => 0,
|
||||
'discount_amount' => 0,
|
||||
|
|
@ -152,7 +155,12 @@ class RefundRepository extends Repository
|
|||
'additional' => $childOrderItem->additional
|
||||
]);
|
||||
|
||||
$this->refundItemRepository->returnQtyToProductInventory($childOrderItem, $qty);
|
||||
if ($childOrderItem->product->getTypeInstance()->showQuantityBox())
|
||||
$this->refundItemRepository->returnQtyToProductInventory($childOrderItem, $finalQty);
|
||||
|
||||
$this->orderItemRepository->collectTotals($childOrderItem);
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->refundItemRepository->returnQtyToProductInventory($orderItem, $qty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
</div>
|
||||
|
||||
<div style="display: flex;flex-direction: row;margin-top: 20px;justify-content: space-between;margin-bottom: 40px;">
|
||||
@if ($order->shipping_address)
|
||||
<div style="line-height: 25px;">
|
||||
<div style="font-weight: bold;font-size: 16px;color: #242424;">
|
||||
{{ __('shop::app.mail.order.shipping-address') }}
|
||||
|
|
@ -62,6 +63,7 @@
|
|||
{{ $order->shipping_title }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div style="line-height: 25px;">
|
||||
<div style="font-weight: bold;font-size: 16px;color: #242424;">
|
||||
|
|
@ -113,6 +115,16 @@
|
|||
<tr>
|
||||
<td data-value="{{ __('shop::app.customer.account.order.view.product-name') }}" style="text-align: left;padding: 8px">
|
||||
{{ $item->name }}
|
||||
|
||||
@if (isset($item->additional['attributes']))
|
||||
<div class="item-options">
|
||||
|
||||
@foreach ($item->additional['attributes'] as $attribute)
|
||||
<b>{{ $attribute['attribute_name'] }} : </b>{{ $attribute['option_label'] }}</br>
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td data-value="{{ __('shop::app.customer.account.order.view.price') }}" style="text-align: left;padding: 8px">
|
||||
|
|
@ -122,14 +134,6 @@
|
|||
<td data-value="{{ __('shop::app.customer.account.order.view.qty') }}" style="text-align: left;padding: 8px">
|
||||
{{ $item->qty }}
|
||||
</td>
|
||||
|
||||
@if ($html = $item->getOptionDetailHtml())
|
||||
<div style="">
|
||||
<label style="margin-top: 10px; font-size: 16px;color: #5E5E5E; display: block;">
|
||||
{{ $html }}
|
||||
</label>
|
||||
</div>
|
||||
@endif
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
|
|
@ -146,7 +150,7 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
@if ($refund->shipping_amount > 0)
|
||||
@if ($order->shipping_address)
|
||||
<div>
|
||||
<span>{{ __('shop::app.mail.order.shipping-handling') }}</span>
|
||||
<span style="float: right;">
|
||||
|
|
|
|||
Loading…
Reference in New Issue