added sku and ready for tracking
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
@@ -8,8 +10,10 @@ use App\Models\MainModel;
|
||||
// use Illuminate\Support\Facades\Request;
|
||||
use Analytics;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class MainController extends Controller {
|
||||
class MainController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -17,25 +21,25 @@ class MainController extends Controller {
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
{
|
||||
return view('sublayouts.index');
|
||||
}
|
||||
|
||||
public function sports()
|
||||
{
|
||||
// if(Request::ajax()){
|
||||
$m = new MainModel;
|
||||
$fetchData = $m->selectAllSports();
|
||||
//var_dump($fetchData);
|
||||
$m = new MainModel;
|
||||
$fetchData = $m->selectAllSports();
|
||||
//var_dump($fetchData);
|
||||
|
||||
foreach ($fetchData as $row) {
|
||||
?>
|
||||
<div class="col-md-3 col-sm-6 col-xs-12 list-sport">
|
||||
<a href="<?php echo url('sports') . "/" . $row->URL; ?>"><img src="<?php echo config('site_config.uploads') . 'sports-thumbnails/' . $row->Thumbnail; ?>" alt="" class="img img-responsive product-center" /></a>
|
||||
<h3 class="text-center sports-title"><?php echo $row->SportsName ?></h3>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
foreach ($fetchData as $row) {
|
||||
?>
|
||||
<div class="col-md-3 col-sm-6 col-xs-12 list-sport">
|
||||
<a href="<?php echo url('sports') . "/" . $row->URL; ?>"><img src="<?php echo config('site_config.uploads') . 'sports-thumbnails/' . $row->Thumbnail; ?>" alt="" class="img img-responsive product-center" /></a>
|
||||
<h3 class="text-center sports-title"><?php echo $row->SportsName ?></h3>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
// }else{
|
||||
// return response()->view('errors/403');
|
||||
@@ -48,8 +52,8 @@ class MainController extends Controller {
|
||||
|
||||
$data = $m->selectSportsId($url);
|
||||
$categoryids = array();
|
||||
|
||||
foreach($data as $row){
|
||||
|
||||
foreach ($data as $row) {
|
||||
$categoryids[] = $row->Category;
|
||||
}
|
||||
|
||||
@@ -58,13 +62,13 @@ class MainController extends Controller {
|
||||
// $array_templateby_category = $m->selectTemplatesByCategory($url, $id);
|
||||
|
||||
// var_dump($array_category);
|
||||
|
||||
|
||||
return view('sublayouts.sports-category')
|
||||
->with('array_sports', $array_sports)
|
||||
->with('row', $array_category);
|
||||
->with('array_sports', $array_sports)
|
||||
->with('row', $array_category);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function templatesByCategory($url, $id)
|
||||
{
|
||||
$m = new MainModel;
|
||||
@@ -75,9 +79,9 @@ class MainController extends Controller {
|
||||
$array_category = $m->selectCategory($categoryids);
|
||||
// var_dump($array_category);
|
||||
return view('sublayouts.sports-styles')
|
||||
->with('cat', $url)
|
||||
->with('row', $data)
|
||||
->with('array_category', $array_category);
|
||||
->with('cat', $url)
|
||||
->with('row', $data)
|
||||
->with('array_category', $array_category);
|
||||
// if(count($data) > 1){
|
||||
// return view('sublayouts.sports-styles')
|
||||
// ->with('cat', $url)
|
||||
@@ -88,72 +92,81 @@ class MainController extends Controller {
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function fetchTemplates()
|
||||
{
|
||||
// if(Request::ajax()){
|
||||
// $m = new MainModel;
|
||||
//
|
||||
// $data = $m->selectSportsId($url);
|
||||
// echo $data[0]->id;
|
||||
//$fetchData = $m->selectSportsTemplates();
|
||||
// $m = new MainModel;
|
||||
//
|
||||
// $data = $m->selectSportsId($url);
|
||||
// echo $data[0]->id;
|
||||
//$fetchData = $m->selectSportsTemplates();
|
||||
|
||||
|
||||
//var_dump($fetchData);
|
||||
//var_dump($fetchData);
|
||||
|
||||
// }else{
|
||||
// return response()->view('errors/403');
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
//call this from blade view
|
||||
public static function getCountCart(){
|
||||
$m = new MainModel;
|
||||
|
||||
if(Session::get('cartkey')){
|
||||
|
||||
$cartKey = Session::get('cartkey');
|
||||
//call this from blade view
|
||||
public static function getCountCart()
|
||||
{
|
||||
$m = new MainModel;
|
||||
|
||||
if (Session::get('cartkey')) {
|
||||
|
||||
$cartKey = Session::get('cartkey');
|
||||
|
||||
echo $i = $m->cartCount($cartKey);
|
||||
|
||||
}else{
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function countCart(Request $request){
|
||||
public function countCart(Request $request)
|
||||
{
|
||||
|
||||
$m = new MainModel;
|
||||
|
||||
if($request->session()->has('cartkey')){
|
||||
if ($request->session()->has('cartkey')) {
|
||||
|
||||
$cartKey = $request->session()->get('cartkey');
|
||||
$cartKey = $request->session()->get('cartkey');
|
||||
|
||||
echo $i = $m->cartCount($cartKey);
|
||||
|
||||
}else{
|
||||
echo $i = $m->cartCount($cartKey);
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function removeCartItem($id){
|
||||
public function removeCartItem($id)
|
||||
{
|
||||
|
||||
$m = new MainModel;
|
||||
|
||||
$row = $m->removeItem($id);
|
||||
if($row > 0)
|
||||
{
|
||||
// \Session::flash('message', 'Record successfully deleted.');
|
||||
echo '<script>
|
||||
|
||||
$row = $m->removeItem($id);
|
||||
if ($row > 0) {
|
||||
// \Session::flash('message', 'Record successfully deleted.');
|
||||
echo '<script>
|
||||
alert("Item removed");
|
||||
</script>';
|
||||
return redirect('cart');
|
||||
}
|
||||
|
||||
}
|
||||
return redirect('cart');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function trackingPage()
|
||||
{
|
||||
|
||||
if (Auth::check()) {
|
||||
$userId = Auth::user()->id;
|
||||
} else {
|
||||
$userId = "";
|
||||
}
|
||||
return view('merchbay.track_order')
|
||||
->with('userId', $userId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user