  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: shipping.php 443 2006-02-19 23:01:01Z hpdl $ |
| |
| 3 | + | $Id: shipping.php 637 2006-07-18 16:30:55Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
14 | 14 | | var $_modules = array(), |
| |
15 | 15 | | $_selected_module, |
| |
16 | 16 | | $_quotes = array(), |
  |
17 | | - | $_keys, |
|
18 | 17 | | $_group = 'shipping'; |
| |
19 | 18 | | |
| |
20 | 19 | | // class constructor |
| |
|
|
 |
… |
|
78 | 77 | | return $this->_description; |
| |
79 | 78 | | } |
| |
80 | 79 | | |
  |
81 | | - | function getStatus() { |
| |
| 80 | + | function isEnabled() { |
|
82 | 81 | | return $this->_status; |
| |
83 | 82 | | } |
| |
84 | 83 | | |
| |
|
|
 |
… |
|
156 | 155 | | $has_active = false; |
| |
157 | 156 | | |
| |
158 | 157 | | foreach ($this->_modules as $module) { |
  |
159 | | - | if ($GLOBALS['osC_Shipping_' . $module]->getStatus() === true) { |
| |
| 158 | + | if ($GLOBALS['osC_Shipping_' . $module]->isEnabled()) { |
|
160 | 159 | | $has_active = true; |
| |
161 | 160 | | break; |
| |
162 | 161 | | } |
| |
|
|
 |
… |
|
166 | 165 | | return $has_active; |
| |
167 | 166 | | } |
| |
168 | 167 | | |
  |
169 | | - | function hasKeys() { |
| |
170 | | - | static $has_keys; |
| |
171 | | - | |
| |
172 | | - | if (isset($has_keys) === false) { |
| |
173 | | - | $has_keys = (sizeof($this->getKeys()) > 0) ? true : false; |
| |
174 | | - | } |
| |
175 | | - | |
| |
176 | | - | return $has_keys; |
| |
177 | | - | } |
| |
178 | | - | |
| |
179 | | - | function install() { |
| |
180 | | - | global $osC_Database, $osC_Language; |
| |
181 | | - | |
| |
182 | | - | $Qinstall = $osC_Database->query('insert into :table_templates_boxes (title, code, author_name, author_www, modules_group) values (:title, :code, :author_name, :author_www, :modules_group)'); |
| |
183 | | - | $Qinstall->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); |
| |
184 | | - | $Qinstall->bindValue(':title', $this->_title); |
| |
185 | | - | $Qinstall->bindValue(':code', $this->_code); |
| |
186 | | - | $Qinstall->bindValue(':author_name', $this->_author_name); |
| |
187 | | - | $Qinstall->bindValue(':author_www', $this->_author_www); |
| |
188 | | - | $Qinstall->bindValue(':modules_group', $this->_group); |
| |
189 | | - | $Qinstall->execute(); |
| |
190 | | - | |
| |
191 | | - | foreach ($osC_Language->getAll() as $key => $value) { |
| |
192 | | - | if (file_exists(dirname(__FILE__) . '/../languages/' . $key . '/modules/' . $this->_group . '/' . $this->_code . '.xml')) { |
| |
193 | | - | foreach ($osC_Language->extractDefinitions($key . '/modules/' . $this->_group . '/' . $this->_code . '.xml') as $def) { |
| |
194 | | - | $Qcheck = $osC_Database->query('select id from :table_languages_definitions where definition_key = :definition_key and content_group = :content_group and languages_id = :languages_id limit 1'); |
| |
195 | | - | $Qcheck->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS); |
| |
196 | | - | $Qcheck->bindValue(':definition_key', $def['key']); |
| |
197 | | - | $Qcheck->bindValue(':content_group', $def['group']); |
| |
198 | | - | $Qcheck->bindInt(':languages_id', $value['id']); |
| |
199 | | - | $Qcheck->execute(); |
| |
200 | | - | |
| |
201 | | - | if ($Qcheck->numberOfRows() === 1) { |
| |
202 | | - | $Qdef = $osC_Database->query('update :table_languages_definitions set definition_value = :definition_value where definition_key = :definition_key and content_group = :content_group and languages_id = :languages_id'); |
| |
203 | | - | } else { |
| |
204 | | - | $Qdef = $osC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)'); |
| |
205 | | - | } |
| |
206 | | - | $Qdef->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS); |
| |
207 | | - | $Qdef->bindInt(':languages_id', $value['id']); |
| |
208 | | - | $Qdef->bindValue(':content_group', $def['group']); |
| |
209 | | - | $Qdef->bindValue(':definition_key', $def['key']); |
| |
210 | | - | $Qdef->bindValue(':definition_value', $def['value']); |
| |
211 | | - | $Qdef->execute(); |
| |
212 | | - | } |
| |
213 | | - | } |
| |
214 | | - | } |
| |
215 | | - | |
| |
216 | | - | osC_Cache::clear('languages'); |
| |
217 | | - | } |
| |
218 | | - | |
| |
219 | | - | function remove() { |
| |
220 | | - | global $osC_Database, $osC_Language; |
| |
221 | | - | |
| |
222 | | - | $Qdel = $osC_Database->query('delete from :table_templates_boxes where code = :code and modules_group = :modules_group'); |
| |
223 | | - | $Qdel->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); |
| |
224 | | - | $Qdel->bindValue(':code', $this->_code); |
| |
225 | | - | $Qdel->bindValue(':modules_group', $this->_group); |
| |
226 | | - | $Qdel->execute(); |
| |
227 | | - | |
| |
228 | | - | if ($this->hasKeys()) { |
| |
229 | | - | $Qdel = $osC_Database->query('delete from :table_configuration where configuration_key in (":configuration_key")'); |
| |
230 | | - | $Qdel->bindTable(':table_configuration', TABLE_CONFIGURATION); |
| |
231 | | - | $Qdel->bindRaw(':configuration_key', implode('", "', $this->getKeys())); |
| |
232 | | - | $Qdel->execute(); |
| |
233 | | - | } |
| |
234 | | - | |
| |
235 | | - | if (file_exists(dirname(__FILE__) . '/../languages/' . $osC_Language->getCode() . '/modules/' . $this->_group . '/' . $this->_code . '.xml')) { |
| |
236 | | - | foreach ($osC_Language->extractDefinitions($osC_Language->getCode() . '/modules/' . $this->_group . '/' . $this->_code . '.xml') as $def) { |
| |
237 | | - | $Qdel = $osC_Database->query('delete from :table_languages_definitions where definition_key = :definition_key and content_group = :content_group'); |
| |
238 | | - | $Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS); |
| |
239 | | - | $Qdel->bindValue(':definition_key', $def['key']); |
| |
240 | | - | $Qdel->bindValue(':content_group', $def['group']); |
| |
241 | | - | $Qdel->execute(); |
| |
242 | | - | } |
| |
243 | | - | |
| |
244 | | - | osC_Cache::clear('languages'); |
| |
245 | | - | } |
| |
246 | | - | } |
| |
247 | | - | |
|
248 | 168 | | function _calculate() { |
| |
249 | 169 | | global $osC_ShoppingCart; |
| |
250 | 170 | | |
| |
|
|
 |
… |
|
256 | 176 | | if (is_array($this->_modules)) { |
| |
257 | 177 | | $include_quotes = array(); |
| |
258 | 178 | | |
  |
259 | | - | if (defined('MODULE_SHIPPING_FREE_STATUS') && (MODULE_SHIPPING_FREE_STATUS == 'True') && ($GLOBALS['osC_Shipping_free']->getStatus() === true)) { |
| |
| 179 | + | if (defined('MODULE_SHIPPING_FREE_STATUS') && (MODULE_SHIPPING_FREE_STATUS == 'True') && $GLOBALS['osC_Shipping_free']->isEnabled()) { |
|
260 | 180 | | $include_quotes[] = 'osC_Shipping_free'; |
| |
261 | 181 | | } else { |
| |
262 | 182 | | foreach ($this->_modules as $module) { |
  |
263 | | - | if ($GLOBALS['osC_Shipping_' . $module]->getStatus() === true) { |
| |
| 183 | + | if ($GLOBALS['osC_Shipping_' . $module]->isEnabled()) { |
  |
264 | 184 | | $include_quotes[] = 'osC_Shipping_' . $module; |
| |
265 | 185 | | } |
| |
266 | 186 | | } |