From f547c6e1589b155c891e71c9625b538744e6cb81 Mon Sep 17 00:00:00 2001 From: Bayu Lukman Yusuf Date: Wed, 11 Feb 2026 21:09:09 +0700 Subject: [PATCH] fix checkout --- .env.example | 7 +- app/Http/Controllers/CheckoutController.php | 1 + app/Models/Transaction.php | 4 + .../Member/ShippingRepository.php | 8 +- lang/en/catalog_fashion.php | 1 + lang/id/catalog_fashion.php | 1 + .../components/footer-category.blade.php | 13 +-- .../components/home/product-card.blade.php | 1 + .../views/components/order/details.blade.php | 2 +- .../views/layouts/partials/footer2.blade.php | 29 +------ .../views/shop/catalog-fashion.blade.php | 8 +- .../views/shop/product-fashion.blade.php | 84 ++++--------------- 12 files changed, 50 insertions(+), 109 deletions(-) diff --git a/.env.example b/.env.example index 9d0899c..d054ece 100644 --- a/.env.example +++ b/.env.example @@ -70,9 +70,12 @@ WMS_ASSET_URL="https://dev.smgdev.top/api/storage" BITESHIP_URL= BITESHIP_KEY= -BITESHIP_COURIER_ALL=grab,gojek,tiki,jnt,anteraja +BITESHIP_COURIER=grab,gojek,tiki,jnt,anteraja GOOGLE_CLIENT_ID=1023147148625-3igh5253tr1lkflmbfj76iopvp2n52od.apps.googleusercontent.com GOOGLE_CLIENT_SECRET=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 -GOOGLE_REDIRECT_URI=http://localhost:8000/login/google/callback \ No newline at end of file +GOOGLE_REDIRECT_URI=http://localhost:8000/login/google/callback + + +XENDIT_PRIVATE_KEY= \ No newline at end of file diff --git a/app/Http/Controllers/CheckoutController.php b/app/Http/Controllers/CheckoutController.php index 6a43dfc..e3856a0 100644 --- a/app/Http/Controllers/CheckoutController.php +++ b/app/Http/Controllers/CheckoutController.php @@ -116,6 +116,7 @@ class CheckoutController extends Controller 'shipping_list' => $shipping_list, ]); } catch (\Exception $e) { + Log::info($e); return redirect()->route('checkout.delivery')->with('error', 'Invalid checkout data'); } } diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index db55da9..f9ceebd 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -104,4 +104,8 @@ class Transaction extends Model return __('order.status.'.strtolower($this->attributes['status'])); } + public function getTotalAttribute() + { + return $this->attributes['subtotal'] + $this->attributes['shipping_price']; + } } diff --git a/app/Repositories/Member/ShippingRepository.php b/app/Repositories/Member/ShippingRepository.php index 9de053d..6b6d924 100644 --- a/app/Repositories/Member/ShippingRepository.php +++ b/app/Repositories/Member/ShippingRepository.php @@ -12,6 +12,7 @@ use App\Models\Transaction; use Illuminate\Support\Facades\DB; use Illuminate\Validation\ValidationException; use Carbon\Carbon; +use Illuminate\Support\Facades\Log; class ShippingRepository { @@ -95,20 +96,23 @@ class ShippingRepository }); if ($hasLatLong){ - return $biteship->rateByLatLong([ + $list = $biteship->rateByLatLong([ "origin_latitude" => $location->latitude, "origin_longitude" => $location->longitude, "destination_latitude" => $address->latitude, "destination_longitude" => $address->longitude, "items" => $items ]); + }else{ - return $biteship->rateByPostal([ + $list = $biteship->rateByPostal([ "origin_postal_code" => $location->postal_code, "destination_postal_code" => $address->postal_code, "items" => $items ]); } + + return $list; } diff --git a/lang/en/catalog_fashion.php b/lang/en/catalog_fashion.php index d368cc2..d406f9a 100644 --- a/lang/en/catalog_fashion.php +++ b/lang/en/catalog_fashion.php @@ -5,6 +5,7 @@ return [ 'categories' => 'Categories', 'genders' => 'Genders', 'price' => 'Price', + 'brands' => 'Brands', 'filter' => 'Filter', 'sort_by' => 'Sort by', 'sort_relevance' => 'Relevance', diff --git a/lang/id/catalog_fashion.php b/lang/id/catalog_fashion.php index b662781..102449b 100644 --- a/lang/id/catalog_fashion.php +++ b/lang/id/catalog_fashion.php @@ -4,6 +4,7 @@ return [ "title" => "Katalog", 'categories' => 'Kategori', 'genders' => 'Gender', + 'brands' => 'Merek', 'price' => 'Harga', 'filter' => 'Filter', 'sort_by' => 'Urutkan', diff --git a/resources/views/components/footer-category.blade.php b/resources/views/components/footer-category.blade.php index 42dd5e7..560e493 100644 --- a/resources/views/components/footer-category.blade.php +++ b/resources/views/components/footer-category.blade.php @@ -1,12 +1,13 @@ @if($categories && $categories->count() > 0) -