add shipping cost

This commit is contained in:
franknstayn
2020-08-10 22:41:40 +08:00
parent 02361ca64e
commit 5918eded8c
11 changed files with 228 additions and 189 deletions

View File

@@ -4,44 +4,18 @@ use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Auth;
use Illuminate\Support\Facades\Auth;
use App\Models\user\UserModel;
use App\Models\teamstore\TeamStoreModel;
use App\Models\MainModel;
use Illuminate\Support\Facades\Hash;
use Paypal;
use View;
use Mail;
use Validator;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Storage;
class UserController extends Controller {
// private $_apiContext;
// public function __construct()
// {
// $this->_apiContext = PayPal::ApiContext(
// config('services.paypal.client_id'),
// config('services.paypal.secret'));
// $this->_apiContext->setConfig(array(
// 'mode' => 'sandbox',
// 'service.EndPoint' => 'https://api.sandbox.paypal.com',
// 'http.ConnectionTimeOut' => 30,
// 'log.LogEnabled' => true,
// 'log.FileName' => storage_path('logs/paypal.log'),
// 'log.LogLevel' => 'FINE'
// ));
// // view()->share('datas', [1, 2, 3]);
// }
//
public function index(){
return view('user-layouts.index');
@@ -333,10 +307,12 @@ class UserController extends Controller {
$product_array = $newTeamStoreModel->selectTeamStoreProducts('ProductURL', $url);
$thumbnails_array = $newTeamStoreModel->getThumbnails($product_array[0]->Id);
$available_size = explode(",", $product_array[0]->AvailableSizes);
// var_dump($product_array);
$shipping_cost = $newUserModel->selectShippingCost();
return view('user-layouts.view-store-item')->with('product_array', $product_array)
->with('available_size', $available_size)
->with('thumbnails_array', $thumbnails_array);
->with('thumbnails_array', $thumbnails_array)
->with('shipping_cost', $shipping_cost);
}
@@ -346,6 +322,12 @@ class UserController extends Controller {
$post = $request->all();
$newTeamStoreModel = new TeamStoreModel;
if($post['shipping_cost'] == 0){
$shipping_cost_id = null;
}else{
$shipping_cost_id = $post['shipping_cost'];
}
$item_url = $post['item_url'];
$data = array(
'ProductName' => $post['itemName'],
@@ -353,7 +335,9 @@ class UserController extends Controller {
'ProductDescription' => $post['itemDescription'],
'PrivacyStatus' => $post['item_privacy'],
'ProductForm' => $post['itemForm'],
'AvailableSizes' => implode(",", $post['available_size'])
'AvailableSizes' => implode(",", $post['available_size']),
'ShippingCostId' => $shipping_cost_id
);
$i = $newTeamStoreModel->updateStoreItem($data, $item_url);