Projekt

Allgemein

Profil

GX-Bug #66607 » selfpickup2.php

src/includes/modules/shipping/selfpickup2.php - Till Tepelmann, 23.04.2020 14:39

 
1
<?PHP
2
/* -----------------------------------------------------------------------------------------
3
   $Id: selfpickup.php 1306 2005-10-14 10:32:31Z mz $
4

    
5
   XT-Commerce - community made shopping
6
   http://www.xt-commerce.com
7

    
8
   Copyright (c) 2003 XT-Commerce
9
   -----------------------------------------------------------------------------------------
10
   based on: 
11
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
12
   (c) 2002-2003 osCommerce(freeamount.php,v 1.01 2002/01/24); www.oscommerce.com 
13
   (c) 2003	 nextcommerce (freeamount.php,v 1.12 2003/08/24); www.nextcommerce.org
14

    
15
   Released under the GNU General Public License 
16
   -----------------------------------------------------------------------------------------
17
   Third Party contributions:
18
   selfpickup         	Autor:	sebthom
19

    
20
   Released under the GNU General Public License 
21
   ---------------------------------------------------------------------------------------*/
22

    
23
class selfpickup_ORIGIN
24
{
25
    var $code, $title, $description, $icon, $enabled;
26
    
27
    
28
    public function __construct()
29
    {
30
        $this->code        = 'selfpickup2';
31
        $this->title       = defined('MODULE_SHIPPING_SELFPICKUP2_TEXT_TITLE') ? MODULE_SHIPPING_SELFPICKUP2_TEXT_TITLE : '';
32
        $this->description = defined('MODULE_SHIPPING_SELFPICKUP2_TEXT_DESCRIPTION') ? MODULE_SHIPPING_SELFPICKUP2_TEXT_DESCRIPTION : '';
33
        $this->icon        = '';   // change $this->icon =  DIR_WS_ICONS . 'shipping_ups.gif'; to some freeshipping icon
34
        $this->sort_order  = defined('MODULE_SHIPPING_SELFPICKUP2_SORT_ORDER') ? MODULE_SHIPPING_SELFPICKUP2_SORT_ORDER : '0';
35
        $this->enabled     = filter_var(@constant('MODULE_SHIPPING_' . strtoupper($this->code) . '_STATUS'),
36
                                        FILTER_VALIDATE_BOOLEAN);
37
    }
38
    
39
    
40
    function quote($method = '')
41
    {
42
        $this->quotes = [
43
            'id'     => $this->code,
44
            'module' => MODULE_SHIPPING_SELFPICKUP2_TEXT_TITLE
45
        ];
46
        
47
        $this->quotes['methods'] = [
48
            [
49
                'id'    => $this->code,
50
                'title' => MODULE_SHIPPING_SELFPICKUP2_TEXT_WAY,
51
                'cost'  => 0
52
            ]
53
        ];
54
        
55
        if (xtc_not_null($this->icon)) {
56
            $this->quotes['icon'] = xtc_image($this->icon, $this->title);
57
        }
58
        
59
        return $this->quotes;
60
    }
61
    
62
    
63
    function check()
64
    {
65
        $check = xtc_db_query("SELECT `value` from `gx_configurations` where `key` = 'configuration/MODULE_SHIPPING_SELFPICKUP2_STATUS'");
66
        $check = xtc_db_num_rows($check);
67
        
68
        return $check;
69
    }
70
    
71
    
72
    function install()
73
    {
74
        xtc_db_query("insert into `gx_configurations` (`key`, `value`, `legacy_group_id`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_SHIPPING_SELFPICKUP2_STATUS', 'True', '6', '7', 'switcher', now())");
75
        xtc_db_query("insert into `gx_configurations` (`key`, `value`, `legacy_group_id`, `sort_order`, `last_modified`) values ('configuration/MODULE_SHIPPING_SELFPICKUP2_ALLOWED', '', '6', '0', now())");
76
        xtc_db_query("insert into `gx_configurations` (`key`, `value`, `legacy_group_id`, `sort_order`, `last_modified`) values ('configuration/MODULE_SHIPPING_SELFPICKUP2_SORT_ORDER', '0', '6', '4', now())");
77
    }
78
    
79
    
80
    function remove()
81
    {
82
        xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
83
    }
84
    
85
    
86
    function keys()
87
    {
88
        return [
89
            'configuration/MODULE_SHIPPING_SELFPICKUP2_STATUS',
90
            'configuration/MODULE_SHIPPING_SELFPICKUP2_SORT_ORDER',
91
            'configuration/MODULE_SHIPPING_SELFPICKUP2_ALLOWED'
92
        ];
93
    }
94
}
95

    
96
MainFactory::load_origin_class('selfpickup2');
(1-1/2)