pack_purchase_flow:GWM

This commit is contained in:
sriramv 2023-06-03 16:15:32 +05:30
commit d149b22649
7 changed files with 120 additions and 37 deletions

View File

@ -111,6 +111,7 @@ $routes->match(['get','post'],'/add_package_cartdata','Cart_controller::add_pack
$routes->match(['get','post'],'/view_cart/(:any)','Cart_controller::view_cart/$1');
$routes->match(['get','post'],'/continue_shopping/(:any)','Cart_controller::continue_shopping/$1');
$routes->match(['get','post'],'/remove_product/(:any)','Cart_controller::remove_product/$1');
$routes->match(['get','post'],'/change_count_onclick','Cart_controller::change_count_onclick');
$routes->match(['get','post'],'/test/(:any)','Test_controller::index/$1');

View File

@ -48,13 +48,38 @@ class Cart_controller extends BaseController
if ($this->request->getVar('c_token')) {
$tokendata = $this->Cart_token_model->where('md5(token)', $this->request->getVar('c_token') )->find();
$data['token'] = $tokendata[0]['token'];
foreach ($tokendata as $key => $value)
{
if ($value['primary_id'] == $this->request->getVar('id'))
{
$count = $tokendata[$key]['count'] + 1;
$this->Cart_token_model->where('id', $tokendata[$key]['id'] )->set(array( 'count' => $count ))->update();
}
else
{
if (count($tokendata) == 1)
{
$data['primary_id'] = $this->request->getVar('id');
$data['table_name'] = 'packages_and_pricing';
$data['count'] = 1;
$this->Cart_token_model->save($data);
}
}
}
}
else {
else
{
$data['token'] = $token;
}
$data['primary_id'] = $this->request->getVar('id');
$data['table_name'] = 'packages_and_pricing';
$data['count'] = 1;
$this->Cart_token_model->save($data);
}
if ($this->request->getVar('c_token')) {
$tokendata = $this->Cart_token_model->where('md5(token)', $this->request->getVar('c_token') )->find();
$data['token'] = md5($tokendata[0]['token']);
@ -102,6 +127,18 @@ class Cart_controller extends BaseController
$deletedata = $this->Cart_token_model->where('md5(id)', $id )->delete();
return redirect()->to(base_url()."view_cart/".md5($tokendata[0]['token']));
}
public function change_count_onclick()
{
try {
$this->Cart_token_model->where('id', $this->request->getVar('id') )->set(array( 'count' => $this->request->getVar('count') ))->update();
echo true;
} catch (\Exception $e) {
echo $e->getMessage();
}
}

View File

@ -11,6 +11,7 @@ use App\Models\Email_template_model;
use App\Models\Variable_model;
use App\Models\Rule_model;
use App\Models\Cart_token_model;
use App\Models\Cart_model;
class Test_controller extends BaseController
{
public $session;
@ -27,6 +28,7 @@ class Test_controller extends BaseController
$this->VariableModel = new Variable_model();
$this->RuleModel = new Rule_model();
$this->Cart_token_model = new Cart_token_model();
$this->cartModel = new Cart_model();
helper(['form', 'url']);
}
public function index($token = null)
@ -43,7 +45,22 @@ class Test_controller extends BaseController
}
else
{
echo 'gop';
if ($token)
{
$tokendata = $this->Cart_token_model->where('md5(token)', $token )->findAll();
foreach ($tokendata as $value)
{
$data['member_id'] = $this->session->get('logged_user',);
$data['pack_id'] = $value['primary_id'];
$data['count'] = $value['count'];
$successdata = $this->cartModel->save($data);
if ($successdata)
{
$deletedata = $this->Cart_token_model->where('id', $value['id'] )->delete();
}
}
// return redirect()->to(base_url().'payment');
}
}

View File

@ -25,11 +25,16 @@
<div class="container">
<h1 class="heading-border">Cart</h1>
<form method="post" action="<?= base_url('/payment/').md5($token); ?>">
<?php foreach ($tokendata as $key => $value) { ?>
<?php
$cost_sum = 0;
foreach ($tokendata as $key => $value) { ?>
<input type ="hidden" name="pack_id[]" value="<?= $value['id'] ?>">
<input type ="hidden" name="cart_token_id[]" value="<?= $pack_id[$key]['id'] ?>">
<input type ="hidden" id="cart_token_id_<?php echo $key; ?>" name="cart_token_id[]" value="<?= $pack_id[$key]['id'] ?>">
<!-- List of Products -->
<div class="row border-bottom pt-4 pb-4">
@ -44,18 +49,23 @@
</div>
<div class="col-2">
<div class="quantity">
<input type="number" id="<?php echo $key; ?>" class="input-text qty text" name="count[]" value="1" title="Qty" size="4" min="1" max="" step="1" placeholder="" inputmode="numeric" autocomplete="off"/>
<input type="number" id="<?php echo $key; ?>" class="input-text qty text" name="count[]" value="<?php if ($pack_id[$key]['count'] == 0) {
echo 1;
} else {
echo $pack_id[$key]['count'];
}
?>" title="Qty" size="4" min="1" max="" step="1" placeholder="" inputmode="numeric" autocomplete="off"/>
<button type="button" class="plus"><i class="fa fa-angle-up"></i></button>
<button type="button" class="minus"><i class="fa fa-angle-down"></i></button>
</div>
</div>
<div class="col-2 text-right-price">
<div class="product-price <?php echo $key; ?>">$<?= $value['cost'] ?></div>
<div class="product-price <?php echo $key; ?>">$<?= $value['cost'] * $pack_id[$key]['count'] ?></div>
<input id="cost_<?php echo $key; ?>" value="<?= $value['cost'] ?>" type="hidden">
<div class="remove-product"><a href="<?= base_url('/remove_product/').md5($pack_id[$key]['id']); ?>">Remove</a></div>
</div>
</div>
<?php } ?>
<?php $cost_sum = $cost_sum +$value['cost'] * $pack_id[$key]['count']; } ?>
<!-- Product Sub total-->
<div class="row sub-total border-bottom pt-4">
@ -65,7 +75,7 @@
<div class="subtotal-label">Subtotal</div>
</div>
<div class="col-9">
<?php $cost_sum = array_sum(array_column($tokendata, 'cost'));?>
<div class="subtotal-price text-right-price subtotal"><span class="price-symbol">$</span><?= $cost_sum; ?></div>
</div>
</div>

View File

@ -87,7 +87,6 @@
$('.city').html('<option value="">Select City</option>');
}
});
});
</script>
</head>

View File

@ -1,19 +1,36 @@
<header class="header">
<div class="container">
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-8">
<div>
<ul>
<li><a href="https://golfevolutionkelowna.ca/">Home</a></li>
<li><a href="https://golfevolutionkelowna.ca/evo-membership/">Pre-Sales Offer</a></li>
<li class="custom-logo-link"><a href="#" rel="home"><img src="<?= base_url()."/public"; ?>/assets/member_images/GolfEvolution-Logo-Colour.png" alt="" width="120" height="89"></a></li>
<li><a href="https://golfevolutionkelowna.ca/about-us/">About Us</a></li>
<li><a href="#" class="nav-button"><img src="<?= base_url()."/public"; ?>/assets/member_images/button-logo.png" width="20" height="20">
<?php if(session()->has('logged_user')) { echo session()->get('logged_user_name'); }else{ ?>MEMBER ACCESS<?php } ?></a></li>
</ul>
</div>
</div>
<div class="col-lg-1"></div>
<div class="col-lg-10">
<div class="row d-flex align-items-baseline">
<div class="col-lg-5 header1">
<ul>
<li><a href="https://golfevolutionkelowna.ca/">Home</a></li>
<li><a href="https://golfevolutionkelowna.ca/evo-membership/">Pre-Sales Offer</a></li>
</ul>
</div>
<div class="col-lg-2 text-center">
<div>
<a href="https://golfevolutionkelowna.ca" class="custom-logo-link" rel="home"><img src="<?= base_url()."/public"; ?>/assets/member_images/GolfEvolution-Logo-Colour.png" alt="" width="120" height="89"></a>
</div>
</div>
<div class="col-lg-5 header2">
<ul>
<li><a href="https://golfevolutionkelowna.ca/about-us/">About Us</a></li>
<li><a href="#" class="nav-button"><img src="<?= base_url()."/public"; ?>/assets/member_images/button-logo.png" width="20" height="20">
<?php if(session()->has('logged_user')) { echo session()->get('logged_user_name'); }else{ ?>MEMBER ACCESS<?php } ?></a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-1"></div>
</div>
</header>
@ -22,9 +39,14 @@
<div class="container">
<div class="row">
<div class="col-lg-12">
<<<<<<< HEAD
<div class="nav-main">
<img src="<?= base_url()."/public"; ?>/assets/member_images/GolfEvolution-footer-Logo-White.png" alt="">
=======
<div class="nav-main">
<a href="https://golfevolutionkelowna.ca" rel="home"><img src="<?= base_url()."/public"; ?>/assets/member_images/GolfEvolution-Logo-Colour.png" alt="" width="100" height="74"></a>
>>>>>>> e2e465227c3030587f5034ea27459a04bd2c43c2
<button class="button-menu"><i class="fa fa-bars"></i></button>
</div>
</div>
@ -34,20 +56,18 @@
<div id="demo">
<section class="nav-hidden">
<div class="row">
<div class="col-lg-12">
<ul>
<li><a href="">ABOUT US</a></li>
<li><a href="">CONTACT US</a></li>
<li><a href="">EVO Membership</a> </li>
<li><a href="" class="nav-home" style="color: #0d6efd;">Home</a></li>
</ul>
<section class="nav-hidden">
<div class="row">
<div class="col-lg-12">
<ul>
<li><a href="https://golfevolutionkelowna.ca/">Home</a></li>
<li><a href="https://golfevolutionkelowna.ca/evo-membership/">Pre-Sales Offer</a></li>
<li><a href="https://golfevolutionkelowna.ca/about-us/">About Us</a></li>
<li><a href="https://golfevolutionkelowna.ca/contact-us/">Contact Us</a> </li>
</ul>
</div>
</div>
</div>
</section>
</div>

View File

@ -16,7 +16,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="<?= base_url()."/public"; ?>/assets/member_js/ajax.js"></script>
<input id="url" value="<?= base_url() ?>" type="hidden">
<input id="c_token" value="<?php if ($token) { echo md5($token); } ?>" type="hidden">
<input id="c_token" value="<?php if ($token) { echo md5($token); } ?>" type="hidden">
</head>
<body class="membership">
<?php include 'member_layout/header.php' ?>
@ -116,7 +116,6 @@
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.</p>
</div>
</div>
<a href="#" class="work-submit pink">Get Now</a>
</div>
<div class="col-lg-6">
</div>