updated again

This commit is contained in:
franknstayn
2021-10-09 20:45:22 +08:00
parent f8b87ea787
commit cb77e3b423
3 changed files with 8 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ class PaypalController extends Controller
public function __construct() public function __construct()
{ {
$paypal_env = "live"; $paypal_env = "sandbox";
$paypal_apiUrl = 'https://api.paypal.com'; // default $paypal_apiUrl = 'https://api.paypal.com'; // default
if ($paypal_env == 'live') { if ($paypal_env == 'live') {
@@ -87,6 +87,8 @@ class PaypalController extends Controller
$userId = Auth::user()->id; $userId = Auth::user()->id;
$array_address_book = $UserModel->selectAddresBook('UserId', $userId); $array_address_book = $UserModel->selectAddresBook('UserId', $userId);
$shipping_address_url = "user/address-book/edit/" . $array_address_book[0]->Id;
if ( if (
count($array_address_book) <= 0 || count($array_address_book) <= 0 ||
$array_address_book[0]->Fullname == null || $array_address_book[0]->Fullname == null ||
@@ -97,7 +99,7 @@ class PaypalController extends Controller
$array_address_book[0]->ZipCode == null $array_address_book[0]->ZipCode == null
) { ) {
$message = 'Please complete your <a href="'.url('user/address-book').'"><u>shipping address</u></a>.'; $message = 'Please complete your shipping address. <a href="' . url($shipping_address_url) . '"> <strong> <u>click here</u> </strong></a>.';
Session::flash('cartkeyError', $message); Session::flash('cartkeyError', $message);
return Redirect::back(); return Redirect::back();
} }

View File

@@ -329,13 +329,13 @@
<p><strong>Ship to:</strong></p> <p><strong>Ship to:</strong></p>
@if ($address_book === null) @if ($address_book === null)
<a href="{{ url('user/address-book') }}">[ Add ]</a> <a href="{{ url('user/address-book/create') }}">[ Add ]</a>
@else @else
<div>{{ $address_book[0]->Fullname }}</div> <div>{{ $address_book[0]->Fullname }}</div>
<div>{{ $address_book[0]->ContactNumber }}</div> <div>{{ $address_book[0]->ContactNumber }}</div>
<div> <div>
{{ $address_book[0]->Address . ', ' . $address_book[0]->State . ', ' . $address_book[0]->City . ', ' . $address_book[0]->Country . ', ' . $address_book[0]->CountryCode . ' ' . $address_book[0]->ZipCode }} {{ $address_book[0]->Address . ', ' . $address_book[0]->State . ', ' . $address_book[0]->City . ', ' . $address_book[0]->Country . ', ' . $address_book[0]->CountryCode . ' ' . $address_book[0]->ZipCode }}
<a href="{{ url('user/address-book') }}">[ Edit ]</a> <a href="{{ url('user/address-book/edit/'.$address_book[0]->Id) }}">[ Edit ]</a>
</div> </div>
@endif @endif

View File

@@ -1981,7 +1981,7 @@
// console.log(response); // console.log(response);
if (response) { if (response) {
alert("Address is successfully added."); alert("Address is successfully added.");
window.location = "{{ url('user/address-book') }}"; window.location = "{{ url('/cart') }}";
} else { } else {
alert("Something went wrong. Please try again!"); alert("Something went wrong. Please try again!");
location.reload(); location.reload();
@@ -2013,7 +2013,7 @@
// console.log(response); // console.log(response);
if (response) { if (response) {
alert("Address is successfully updated."); alert("Address is successfully updated.");
window.location = "{{ url('user/address-book') }}"; window.location = "{{ url('/cart') }}";
} else { } else {
alert("Something went wrong. Please try again!"); alert("Something went wrong. Please try again!");
location.reload(); location.reload();