From 94b891c66e25f16038016b3ac157d8a3d23f1de7 Mon Sep 17 00:00:00 2001 From: merdan Date: Thu, 10 Mar 2022 13:24:15 +0500 Subject: [PATCH] category default limit --- .../Resources/Customer/OrderItemResource.php | 19 ++--- .../Http/Resources/Customer/OrderResource.php | 25 +++--- .../Sarga/API/Http/Resources/Sales/Order.php | 77 ------------------- 3 files changed, 22 insertions(+), 99 deletions(-) delete mode 100644 packages/Sarga/API/Http/Resources/Sales/Order.php diff --git a/packages/Sarga/API/Http/Resources/Customer/OrderItemResource.php b/packages/Sarga/API/Http/Resources/Customer/OrderItemResource.php index 7d0ceb979..03d1df5f8 100644 --- a/packages/Sarga/API/Http/Resources/Customer/OrderItemResource.php +++ b/packages/Sarga/API/Http/Resources/Customer/OrderItemResource.php @@ -3,6 +3,7 @@ namespace Sarga\API\Http\Resources\Customer; use Illuminate\Http\Resources\Json\JsonResource; +use Sarga\API\Http\Resources\Checkout\CartItemProduct; class OrderItemResource extends JsonResource { @@ -19,7 +20,7 @@ class OrderItemResource extends JsonResource 'sku' => $this->sku, 'type' => $this->type, 'name' => $this->name, - 'product_id' => $this->product_id, + 'product' => $this->when($this->product_id, new CartItemProduct($this->product)), 'coupon_code' => $this->coupon_code, 'weight' => (double) $this->weight, 'total_weight' => $this->total_weight, @@ -29,28 +30,28 @@ class OrderItemResource extends JsonResource 'qty_shipped' => (int) $this->qty_shipped, 'qty_refunded' => (int) $this->qty_refunded, 'price' => (double) $this->price, - 'formated_price' => core()->formatPrice($this->base_price, $this->order->order_currency_code), + 'formatted_price' => core()->formatPrice($this->base_price, $this->order->order_currency_code), 'total' => $this->total, - 'formated_total' => core()->formatPrice($this->base_total, $this->order->order_currency_code), + 'formatted_total' => core()->formatPrice($this->base_total, $this->order->order_currency_code), 'total_invoiced' => $this->total_invoiced, - 'formated_total_invoiced' => core()->formatPrice($this->base_total_invoiced, $this->order->order_currency_code), + 'formatted_total_invoiced' => core()->formatPrice($this->base_total_invoiced, $this->order->order_currency_code), 'amount_refunded' => $this->amount_refunded, - 'formated_amount_refunded' => core()->formatPrice($this->base_amount_refunded, $this->order->order_currency_code), + 'formatted_amount_refunded' => core()->formatPrice($this->base_amount_refunded, $this->order->order_currency_code), 'discount_percent' => $this->discount_percent, 'discount_amount' => (double) $this->discount_amount, - 'formated_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->order->order_currency_code), + 'formatted_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->order->order_currency_code), 'discount_invoiced' => $this->discount_invoiced, - 'formated_discount_invoiced' => core()->formatPrice($this->base_discount_invoiced, $this->order->order_currency_code), + 'formatted_discount_invoiced' => core()->formatPrice($this->base_discount_invoiced, $this->order->order_currency_code), 'discount_refunded' => $this->discount_refunded, - 'formated_discount_refunded' => core()->formatPrice($this->base_discount_refunded, $this->order->order_currency_code), + 'formatted_discount_refunded' => core()->formatPrice($this->base_discount_refunded, $this->order->order_currency_code), 'grant_total' => $this->total + $this->tax_amount, - 'formated_grant_total' => core()->formatPrice($this->base_total + $this->base_tax_amount, $this->order->order_currency_code), + 'formatted_grant_total' => core()->formatPrice($this->base_total + $this->base_tax_amount, $this->order->order_currency_code), 'downloadable_links' => $this->downloadable_link_purchased, 'additional' => is_array($this->resource->additional) ? $this->resource->additional diff --git a/packages/Sarga/API/Http/Resources/Customer/OrderResource.php b/packages/Sarga/API/Http/Resources/Customer/OrderResource.php index 37ab34cee..7e6bc3c55 100644 --- a/packages/Sarga/API/Http/Resources/Customer/OrderResource.php +++ b/packages/Sarga/API/Http/Resources/Customer/OrderResource.php @@ -25,7 +25,6 @@ class OrderResource extends JsonResource public function toArray($request){ return [ 'id' => $this->id, - 'increment_id' => $this->increment_id, 'status' => $this->status, 'status_label' => $this->status_label, 'customer_first_name' => $this->customer_first_name, @@ -42,40 +41,40 @@ class OrderResource extends JsonResource 'channel_currency_code' => $this->channel_currency_code, 'order_currency_code' => $this->order_currency_code, 'grand_total' => (double)$this->grand_total, - 'formated_grand_total' => core()->formatPrice($this->base_grand_total, $this->order_currency_code), + 'formatted_grand_total' => core()->formatPrice($this->base_grand_total, $this->order_currency_code), 'grand_total_invoiced' => (double)$this->grand_total_invoiced, - 'formated_grand_total_invoiced' => core()->formatPrice($this->base_grand_total_invoiced, $this->order_currency_code), + 'formatted_grand_total_invoiced' => core()->formatPrice($this->base_grand_total_invoiced, $this->order_currency_code), 'grand_total_refunded' => (double)$this->grand_total_refunded, - 'formated_grand_total_refunded' => core()->formatPrice($this->base_grand_total_refunded, $this->order_currency_code), + 'formatted_grand_total_refunded' => core()->formatPrice($this->base_grand_total_refunded, $this->order_currency_code), 'sub_total' => (double)$this->sub_total, - 'formated_sub_total' => core()->formatPrice($this->base_sub_total, $this->order_currency_code), + 'formatted_sub_total' => core()->formatPrice($this->base_sub_total, $this->order_currency_code), 'sub_total_invoiced' => (double)$this->sub_total_invoiced, - 'formated_sub_total_invoiced' => core()->formatPrice($this->base_sub_total_invoiced, $this->order_currency_code), + 'formatted_sub_total_invoiced' => core()->formatPrice($this->base_sub_total_invoiced, $this->order_currency_code), 'sub_total_refunded' => (double)$this->sub_total_refunded, -// 'formated_sub_total_refunded' => core()->formatPrice($this->sub_total_refunded, $this->order_currency_code), +// 'formatted_sub_total_refunded' => core()->formatPrice($this->sub_total_refunded, $this->order_currency_code), 'discount_percent' => $this->discount_percent, 'discount_amount' => (double)$this->discount_amount, - 'formated_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->order_currency_code), + 'formatted_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->order_currency_code), 'discount_invoiced' => (double)$this->discount_invoiced, - 'formated_discount_invoiced' => core()->formatPrice($this->base_discount_invoiced, $this->order_currency_code), + 'formatted_discount_invoiced' => core()->formatPrice($this->base_discount_invoiced, $this->order_currency_code), 'discount_refunded' => (double)$this->discount_refunded, - 'formated_discount_refunded' => core()->formatPrice($this->base_discount_refunded, $this->order_currency_code), + 'formatted_discount_refunded' => core()->formatPrice($this->base_discount_refunded, $this->order_currency_code), 'shipping_amount' => (double)$this->shipping_amount, - 'formated_shipping_amount' => core()->formatPrice($this->base_shipping_amount, $this->order_currency_code), + 'formatted_shipping_amount' => core()->formatPrice($this->base_shipping_amount, $this->order_currency_code), 'shipping_invoiced' => $this->shipping_invoiced, - 'formated_shipping_invoiced' => core()->formatPrice($this->base_shipping_invoiced, $this->order_currency_code), + 'formatted_shipping_invoiced' => core()->formatPrice($this->base_shipping_invoiced, $this->order_currency_code), 'shipping_refunded' => $this->shipping_refunded, - 'formated_shipping_refunded' => core()->formatPrice($this->base_shipping_refunded, $this->order_currency_code), + 'formatted_shipping_refunded' => core()->formatPrice($this->base_shipping_refunded, $this->order_currency_code), 'shipping_address' => new OrderAddressResource($this->shipping_address), 'billing_address' => new OrderAddressResource($this->billing_address), diff --git a/packages/Sarga/API/Http/Resources/Sales/Order.php b/packages/Sarga/API/Http/Resources/Sales/Order.php deleted file mode 100644 index d0c83e8a3..000000000 --- a/packages/Sarga/API/Http/Resources/Sales/Order.php +++ /dev/null @@ -1,77 +0,0 @@ - $this->id, - 'increment_id' => $this->increment_id, - 'status' => $this->status, - 'status_label' => $this->status_label, - 'customer_first_name' => $this->customer_first_name, - 'customer_last_name' => $this->customer_last_name, - 'shipping_method' => $this->shipping_method, - 'shipping_title' => $this->shipping_title, - 'payment_title' => core()->getConfigData('sales.paymentmethods.' . $this->payment->method . '.title'), - 'shipping_description' => $this->shipping_description, - 'coupon_code' => $this->coupon_code, - 'total_item_count' => $this->total_item_count, - 'total_qty_ordered' => $this->total_qty_ordered, - 'grand_total' => $this->grand_total, - 'formated_grand_total' => core()->formatPrice($this->base_grand_total, $this->order_currency_code), - 'grand_total_invoiced' => $this->grand_total_invoiced, - 'formated_grand_total_invoiced' => core()->formatPrice($this->base_grand_total_invoiced, $this->order_currency_code), - 'grand_total_refunded' => $this->grand_total_refunded, - 'formated_grand_total_refunded' => core()->formatPrice($this->base_grand_total_refunded, $this->order_currency_code), - 'sub_total' => $this->sub_total, - 'formated_sub_total' => core()->formatPrice($this->base_sub_total, $this->order_currency_code), - 'sub_total_invoiced' => $this->sub_total_invoiced, - 'formated_sub_total_invoiced' => core()->formatPrice($this->base_sub_total_invoiced, $this->order_currency_code), - 'sub_total_refunded' => $this->sub_total_refunded, - 'discount_percent' => $this->discount_percent, - 'discount_amount' => $this->discount_amount, - 'formated_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->order_currency_code), - 'discount_invoiced' => $this->discount_invoiced, - 'formated_discount_invoiced' => core()->formatPrice($this->base_discount_invoiced, $this->order_currency_code), - 'discount_refunded' => $this->discount_refunded, - 'formated_discount_refunded' => core()->formatPrice($this->base_discount_refunded, $this->order_currency_code), - 'tax_amount' => $this->tax_amount, - 'formated_tax_amount' => core()->formatPrice($this->base_tax_amount, $this->order_currency_code), - 'tax_amount_invoiced' => $this->tax_amount_invoiced, - 'formated_tax_amount_invoiced' => core()->formatPrice($this->base_tax_amount_invoiced, $this->order_currency_code), - 'tax_amount_refunded' => $this->tax_amount_refunded, - 'formated_tax_amount_refunded' => core()->formatPrice($this->base_tax_amount_refunded, $this->order_currency_code), - 'shipping_amount' => $this->shipping_amount, - 'formated_shipping_amount' => core()->formatPrice($this->base_shipping_amount, $this->order_currency_code), - 'shipping_invoiced' => $this->shipping_invoiced, - 'formated_shipping_invoiced' => core()->formatPrice($this->base_shipping_invoiced, $this->order_currency_code), - 'shipping_refunded' => $this->shipping_refunded, - 'formated_shipping_refunded' => core()->formatPrice($this->base_shipping_refunded, $this->order_currency_code), - 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), - 'shipping_address' => new OrderAddressResource($this->shipping_address), - 'billing_address' => new OrderAddressResource($this->billing_address), - 'items' => OrderItemResource::collection($this->items), - 'invoices' => InvoiceResource::collection($this->invoices), - 'shipments' => ShipmentResource::collection($this->shipments), - 'updated_at' => $this->updated_at, - 'created_at' => $this->created_at, - ]; - } -} \ No newline at end of file