-
Notifications
You must be signed in to change notification settings - Fork 0
/
isaveresolve.php
155 lines (125 loc) · 3.83 KB
/
isaveresolve.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
class iSaveResolve extends Module
{
public function __construct(){
$this->name = 'isaveresolve';
$this->tab = 'tab';
$this->version = '1.2';
$this->bootstrap = true;
$this->author = 'iPresta.ir';
parent::__construct();
$this->displayName = $this->l('Resolve save problems');
$this->description = $this->l('Resolve admin panel save problems');
$this->_prefix = ''; // short name (as short as possible)
$this->_pprefix = 'ipresta'; // keep it ipresta
}
public function install(){
if (!parent::install()
|| !$this->registerHook($this->getHooks())
|| !$this->installConfigs()
)
return false;
else
return true;
}
public function uninstall(){
if (!parent::uninstall()
|| !$this->uninstallHooks()
|| !$this->uninstallConfigs()
)
return false;
return true;
}
public function getHooks()
{
return array(
'displayBackOfficeHeader',
);
}
public function getConfigs()
{
return array(
);
}
public function renderForm()
{
$fields_form[] = array(
'form' => array(
'legend' => array(
'title' => 'setting',
'icon' => 'icon-cogs'
),
'description' => 'No config needed. Please go and save your products!<br/><b>Check our wesite: <a href="https://ipresta.ir/">iPresta.ir</a></b>',
),
);
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
$helper->default_form_language = $lang->id;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
$helper->identifier = $this->identifier;
$helper->submit_action = 'submit'.$this->name;
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = array(
'fields_value' => '',
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id
);
return $helper->generateForm($fields_form);
}
public function getContent()
{
return $this->renderForm();//displayConfirmation('Just this! Go and save your product');
}
public function hookDisplayBackofficeHeader()
{
if (Tools::getValue('controller') != 'AdminProducts')
return false;
$this->context->controller->addJS($this->_path.'js/admin2.js');
}
/* ######################### DON'T EDIT AFTER THIS LINE ######################### */
/* ######################### Default Functions ######################### */
// load a php file by name
public function load($class,$path = null)
{
if (is_null($path))
$path = $this->getLocalPath()."classes/";
$filename = $path . $class .".php";
if ( Tools::file_exists_cache($filename))
{
include_once $filename;
}
}
public function uninstallHooks()
{
$return = true;
$hooks = $this->getHooks();
if(is_array($hooks) && count($hooks) > 0)
foreach ($hooks as $hook)
$return &= $this->unregisterHook($hook);
elseif (!empty($hooks))
$return &= $this->unregisterHook($hooks);
return $return;
}
public function installConfigs()
{
$return = true;
$configs = $this->getConfigs();
if(is_array($configs) && count($configs) > 0)
foreach ($configs as $config => $value)
$return &= Configuration::updateValue($this->configName($config),$value);
return $return;
}
public function uninstallConfigs()
{
$return = true;
$configs = $this->getConfigs();
if(is_array($configs) && count($configs) > 0)
foreach ($configs as $config)
$return &= Configuration::deleteByName($this->configName($config));
return $return;
}
/* ######################### Default Functions End ######################### */
}