Checkedout   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 7
dl 0
loc 31
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A preparePage() 0 25 4
1
<?php
2
3
/*
4
    HCSF - A multilingual CMS and Shopsystem
5
    Copyright (C) 2014  Marcus Haase - [email protected]
6
7
    This program is free software: you can redistribute it and/or modify
8
    it under the terms of the GNU General Public License as published by
9
    the Free Software Foundation, either version 3 of the License, or
10
    (at your option) any later version.
11
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16
17
    You should have received a copy of the GNU General Public License
18
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
namespace HaaseIT\HCSF\Controller\Shop;
22
23
24
25
/**
26
 * Class Checkedout
27
 * @package HaaseIT\HCSF\Controller\Shop
28
 */
29
class Checkedout extends Base
30
{
31
    /**
32
     *
33
     */
34
    public function preparePage()
35
    {
36
        $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
37
        $this->P->cb_pagetype = 'content';
38
39
        if ($this->config->getShop('show_pricesonlytologgedin') && !$this->helperCustomer->getUserData()) {
40
            $this->P->oPayload->cl_html = $this->serviceManager->get('textcats')->T('denied_notloggedin');
41
        } else {
42
            $this->P->cb_customcontenttemplate = 'shop/checkedout';
43
44
            $iId = \filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
45
            $sql = 'SELECT * FROM orders WHERE o_id = :id AND o_paymentcompleted = \'n\'';
46
47
            /** @var \PDOStatement $hResult */
48
            $hResult = $this->serviceManager->get('db')->prepare($sql);
49
            $hResult->bindValue(':id', $iId, \PDO::PARAM_INT);
50
51
            $hResult->execute();
52
53
            if ($hResult->rowCount() === 1) {
54
                $this->P->cb_customdata['order'] = $hResult->fetch();
55
                $this->P->cb_customdata['gesamtbrutto'] = $this->helperShop->calculateTotalFromDB($this->P->cb_customdata['order']);
56
            }
57
        }
58
    }
59
}
60