4_15_2019 update
This commit is contained in:
@@ -32,7 +32,7 @@ class MainController extends Controller {
|
||||
<!-- <h2 class="text-center">Basketball</h2> -->
|
||||
<div>
|
||||
<!-- <span class="badge">Sale</span> -->
|
||||
<a href="<?php echo url('sports') . "/" . $row->URL; ?>"><img src="<?php echo './'. $row->Thumbnail; ?>" alt="" class="img img-responsive product-center" /></a>
|
||||
<a href="<?php echo url('sports') . "/" . $row->URL; ?>"><img src="<?php echo url('/public'). '/'. $row->Thumbnail; ?>" alt="" class="img img-responsive product-center" /></a>
|
||||
<h3 class="text-center sports-title"><?php echo $row->SportsName ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -486,6 +486,14 @@ class DesignerController extends Controller {
|
||||
$json_Shorts_Right = null;
|
||||
}
|
||||
|
||||
if(isset($post['json_Shirts_Front'])){
|
||||
$json_Jersey_Front = $post['json_Shirts_Front'];
|
||||
}
|
||||
|
||||
if(isset($post['json_Shirts_Back'])){
|
||||
$json_Jersey_Back = $post['json_Shirts_Back'];
|
||||
}
|
||||
|
||||
try {
|
||||
$design_info = array(
|
||||
'ClientId' => $clientId,
|
||||
@@ -509,8 +517,8 @@ class DesignerController extends Controller {
|
||||
if($res){
|
||||
|
||||
// dd(Uuid::generate());
|
||||
// return redirect('/designer/preview/'.$designCode);
|
||||
return redirect('http://localhost/crew-designer/mydesign/'.$designCode.'/');
|
||||
return redirect('/designer/preview/'.$designCode);
|
||||
// return redirect('http://localhost/crew-designer/mydesign/'.$designCode.'/');
|
||||
|
||||
}
|
||||
// else{
|
||||
|
||||
@@ -27,24 +27,24 @@ class PaypalController extends Controller {
|
||||
config('services.paypal.secret'));
|
||||
|
||||
|
||||
$this->_apiContext->setConfig(array(
|
||||
$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'
|
||||
));
|
||||
));
|
||||
|
||||
// live
|
||||
// $this->_apiContext->setConfig(array(
|
||||
// 'mode' => 'live',
|
||||
// 'service.EndPoint' => 'https://api.paypal.com',
|
||||
// 'http.ConnectionTimeOut' => 30,
|
||||
// 'log.LogEnabled' => true,
|
||||
// 'log.FileName' => storage_path('logs/paypal.log'),
|
||||
// 'log.LogLevel' => 'FINE'
|
||||
// ));
|
||||
// live
|
||||
// $this->_apiContext->setConfig(array(
|
||||
// 'mode' => 'live',
|
||||
// 'service.EndPoint' => 'https://api.paypal.com',
|
||||
// 'http.ConnectionTimeOut' => 30,
|
||||
// 'log.LogEnabled' => true,
|
||||
// 'log.FileName' => storage_path('logs/paypal.log'),
|
||||
// 'log.LogLevel' => 'FINE'
|
||||
// ));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,21 +23,28 @@ class TeamStoreController extends Controller {
|
||||
if (Auth::check()){
|
||||
$user_role = Auth::user()->role;
|
||||
$store_id = Auth::user()->store_id;
|
||||
}else{
|
||||
$user_role = null;
|
||||
$store_id = null;
|
||||
}
|
||||
|
||||
// if($request->session()->get('teamstore_data_array') == null){
|
||||
// if($store_id != $store_array[0]->Id){
|
||||
// return redirect()->back();
|
||||
// }
|
||||
// }else{
|
||||
|
||||
// if($user_role != "store_owner"){
|
||||
// if($request->session()->get('teamstore_data_array')[0]->StoreUrl != $store_array[0]->StoreUrl){
|
||||
// return redirect()->back();
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
if($store_array[0]->Password != null){
|
||||
if($request->session()->get('teamstore_data_array') == null){
|
||||
if($store_id != $store_array[0]->Id){
|
||||
return redirect('teamstore');
|
||||
}
|
||||
}else{
|
||||
|
||||
if($user_role != "store_owner"){
|
||||
if($request->session()->get('teamstore_data_array')[0]->StoreUrl != $store_array[0]->StoreUrl){
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($product_array as $p => $pr_arr) {
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ use Illuminate\Support\Facades\Hash;
|
||||
use Paypal;
|
||||
use View;
|
||||
use Mail;
|
||||
use Validator;
|
||||
|
||||
class UserController extends Controller {
|
||||
|
||||
@@ -441,8 +442,8 @@ class UserController extends Controller {
|
||||
|
||||
public function orderDetails($ck){
|
||||
$newUserModel = new UserModel;
|
||||
$order_item_array = $newUserModel->selectOrderItem($ck);
|
||||
$item_goup_array = $newUserModel->itemGroup($ck);
|
||||
$order_item_array = $newUserModel->selectOrderItem($ck);
|
||||
$item_goup_array = $newUserModel->itemGroup($ck);
|
||||
$item_thumbs = $newUserModel->selectDisplayItemThumb();
|
||||
$array_payment_details = $newUserModel->selectPaymentDetails('CartKey', $ck);
|
||||
return view('user-layouts.order_details')
|
||||
@@ -452,4 +453,123 @@ class UserController extends Controller {
|
||||
->with('order_item_array', $order_item_array);
|
||||
}
|
||||
|
||||
public function sellDesign($designCode){
|
||||
$m = new UserModel;
|
||||
$newMainModel = new MainModel;
|
||||
$newTeamStoreModel = new TeamStoreModel;
|
||||
$userId = Auth::user()->id;
|
||||
$store_id = Auth::user()->store_id;
|
||||
$array_client_designs = $m->selectClientDesignsbyCode($designCode);
|
||||
$store_array = $newTeamStoreModel->selectTeamStore('Id', $store_id);
|
||||
// check if its your design
|
||||
if($userId != $array_client_designs[0]->ClientId){
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
// var_dump($store_array);
|
||||
|
||||
$array_template_paths = $m->selectTemplatePaths('TemplateCode', $array_client_designs[0]->TemplateCode);
|
||||
$array_cat_name = $newMainModel->selectCategoryName($array_client_designs[0]->TemplateCode);
|
||||
|
||||
return view('user-layouts.sell_design')
|
||||
->with('array_client_designs', $array_client_designs)
|
||||
->with('array_template_paths', $array_template_paths)
|
||||
->with('store_array', $store_array)
|
||||
->with('array_cat_name', $array_cat_name);
|
||||
}
|
||||
|
||||
|
||||
public function saveNewStoreItem(Request $request){
|
||||
$post = $request->all();
|
||||
$UserModel = new UserModel;
|
||||
$getYear = date('y');
|
||||
|
||||
$store_id = Auth::user()->store_id;
|
||||
$templateCode = $post['templateCode'];
|
||||
$designCode = $post['designCode'];
|
||||
$itemName = $post['itemName'];
|
||||
$itemDescription = $post['itemDescription'];
|
||||
$itemPrice = $post['itemPrice'];
|
||||
$itemForm = $post['itemForm'];
|
||||
$itemUrl = $post['itemUrl'];
|
||||
$itemPrivacy = $post['itemPrivacy'];
|
||||
|
||||
$check_product_url = array(
|
||||
'ProductURL' => $itemUrl
|
||||
);
|
||||
|
||||
$validator = Validator::make($check_product_url, [
|
||||
'ProductURL' => 'unique:teamstore_products'
|
||||
],
|
||||
[
|
||||
'ProductURL.unique' => 'The Item URL has already been taken.',
|
||||
]);
|
||||
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
$errors = "";
|
||||
// var_dump(($validator->errors()->all()));
|
||||
foreach($validator->errors()->all() as $error){
|
||||
$errors .= "<li>".$error."</li>";
|
||||
}
|
||||
|
||||
$message = '
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
||||
'.$errors.
|
||||
'</div>';
|
||||
|
||||
return response()->json(array(
|
||||
'success' => false,
|
||||
'message' => $message
|
||||
));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'TeamStoreId' => $store_id,
|
||||
'ProductName' => $itemName,
|
||||
'ProductPrice' => str_replace('$ ', '', $itemPrice),
|
||||
'ProductDescription'=> $itemDescription,
|
||||
'ProductURL' => $itemUrl,
|
||||
'ProductForm' => $itemForm,
|
||||
'PrivacyStatus' => $itemPrivacy,
|
||||
'TemplateCode' => $templateCode,
|
||||
'DesignCode' => $designCode,
|
||||
);
|
||||
|
||||
$id = $UserModel->insertNewProduct($data); // product item id
|
||||
// echo $i;
|
||||
|
||||
$array_template_paths = $UserModel->selectTemplatePaths('TemplateCode', $templateCode);
|
||||
|
||||
foreach($array_template_paths as $key => $row1){
|
||||
if($key == 0){
|
||||
$thumb = $designCode . '-front-thumbnail.png';
|
||||
$class = "active";
|
||||
}else{
|
||||
$thumb = $designCode . '-' . strtolower($row1->Side) . '-thumbnail.png';
|
||||
$class = null;
|
||||
}
|
||||
|
||||
$thumbs = $data = array(
|
||||
'ProductId' => $id,
|
||||
'Image' => $thumb,
|
||||
'ImageClass' =>$class
|
||||
);
|
||||
|
||||
$UserModel->insertNewProductThumbnails($thumbs);
|
||||
|
||||
|
||||
}
|
||||
$prod_code = array('ProductCode' => $getYear . '-' .str_pad($id, 10,'0', STR_PAD_LEFT));
|
||||
$i = $UserModel->updateProductCode($prod_code, $id);
|
||||
|
||||
return response()->json(array(
|
||||
'success' => true
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user