Skip to content

Commit

Permalink
cart summary change to price type
Browse files Browse the repository at this point in the history
  • Loading branch information
TMuthulakshmi committed Dec 28, 2022
1 parent 27ae98a commit bcae0db
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
24 changes: 17 additions & 7 deletions app/Controllers/Api/Cart/Index.php
Expand Up @@ -47,12 +47,11 @@ function index(){

if($post['type']) $condition['type'] = $post['type'];

$cart = new \App\Models\Cart;
$result = $this->cart->getCart('all', ['cart', 'event', 'barn', 'stall', 'product', 'tax'], $condition);

if($result){
$setting = getSettings();
$cartreservedtime = $cart->getReserved($setting['cartreservedtime']);
$cartreservedtime = $this->cart->getReserved($setting['cartreservedtime']);
$timer = $cartreservedtime ? strtotime($cartreservedtime) : '';
$count = count($result);

Expand Down Expand Up @@ -168,7 +167,7 @@ function index(){
}
}

$transactionfee = number_format((($setting['transactionfee'] / 100) * $price), 2);
$transactionfee = number_format((($setting['transactionfee'] / 100) * $price), 2);
$barnstallcolumn = array_column($barnstall, 'barn_id');
array_multisort($barnstallcolumn, SORT_ASC, $barnstall);
$rvbarnstallcolumn = array_column($rvbarnstall, 'barn_id');
Expand All @@ -178,14 +177,18 @@ function index(){
$shavingcolumn = array_column($shaving, 'product_id');
array_multisort($shavingcolumn, SORT_ASC, $shaving);

$total ='';
$totaldue = (number_format($price,2)+ number_format($transactionfee,2)+ number_format($cleaning_fee,2));

$resultdata = [
'event_id' => $event_id,
'event_name' => $event_name,
'event_tax' => $tax,
'event_location' => $event_location,
'event_description' => $event_description,
'cleaning_fee' => $cleaning_fee,
'transactionfee' => $transactionfee,
'cleaning_fee' => number_format($cleaning_fee,2),
'totaldue' => number_format($totaldue,2),
'transactionfee' => number_format($transactionfee,2),
'barnstall' => $barnstall,
'rvbarnstall' => $rvbarnstall,
'feed' => $feed,
Expand All @@ -200,7 +203,7 @@ function index(){
];

if(count($result)>0){
$json = ['1', count($resultdata) . ' Record(s) Found', $resultdata];
$json = ['1', count($result) . ' Record(s) Found', $resultdata];
} else {
$json = ['0', 'No Record(s) Found', []];
}
Expand Down Expand Up @@ -236,6 +239,7 @@ public function stallcartinsert(){
'type' => 'required',
'checked' => 'required',
'flag' => 'required',
//'mwn_price' => 'required',
],

[
Expand Down Expand Up @@ -271,10 +275,16 @@ public function stallcartinsert(){
],
'type' => [
'required' => 'Type is required.',
],
],
'flag' => [
'required' => 'Flag is required.',
],
'flag' => [
'required' => 'Flag is required.',
],
/*'mwn_price' => [
'required' => 'mwn_price is required.',
],*/
]
);

Expand Down
17 changes: 10 additions & 7 deletions app/Controllers/Api/Checkout/Index.php
Expand Up @@ -45,7 +45,7 @@ public function index()

if($result){
$setting = getSettings();
$cartreservedtime = $cart->getReserved($setting['cartreservedtime']);
$cartreservedtime = $this->cart->getReserved($setting['cartreservedtime']);
$timer = $cartreservedtime ? strtotime($cartreservedtime) : '';
$count = count($result);

Expand Down Expand Up @@ -160,8 +160,9 @@ public function index()
$price += $singletotal;
}
}

$transactionfee => number_format((($setting['transactionfee'] / 100) * $price), 2);


$transactionfee = number_format((($setting['transactionfee'] / 100) * $price), 2);
$barnstallcolumn = array_column($barnstall, 'barn_id');
array_multisort($barnstallcolumn, SORT_ASC, $barnstall);
$rvbarnstallcolumn = array_column($rvbarnstall, 'barn_id');
Expand All @@ -171,13 +172,16 @@ public function index()
$shavingcolumn = array_column($shaving, 'product_id');
array_multisort($shavingcolumn, SORT_ASC, $shaving);

$total ='';
$totaldue = (number_format($price,2)+ number_format($transactionfee,2)+ number_format($cleaning_fee,2)+ number_format(($tax*100),2));
$resultdata = [
'event_id' => $event_id,
'event_name' => $event_name,
'event_tax' => $tax,
'event_tax' => number_format(($tax*100),2),
'event_location' => $event_location,
'event_description' => $event_description,
'cleaning_fee' => $cleaning_fee,
'cleaning_fee' => number_format($cleaning_fee,2),
'totaldue' => number_format($totaldue,2),
'transactionfee' => $transactionfee,
'barnstall' => $barnstall,
'rvbarnstall' => $rvbarnstall,
Expand All @@ -189,7 +193,7 @@ public function index()
'price' => $price,
'type' => $type,
'timer' => $timer,
'count' => $count
'count' => $count,
'paymentmethod' => $paymentmethod,
'stripepublickey' => $setting['stripepublickey'],
];
Expand Down Expand Up @@ -245,7 +249,6 @@ public function action(){
'shaving' => 'required',
'page' => 'required',
],

[
'firstname' => [
'required' => 'First Name is required.',
Expand Down

0 comments on commit bcae0db

Please sign in to comment.