Skip to content

Commit

Permalink
https://github.com/abantecart/abantecart-src/issues/122
Browse files Browse the repository at this point in the history
  • Loading branch information
abolabo committed May 13, 2015
1 parent a3ff5f3 commit af8c728
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public function main() {
$this->loadLanguage('default_weight/default_weight');
$this->document->setTitle( $this->language->get('default_weight_name') );
$this->load->model('setting/setting');

if ($this->request->is_POST() && ($this->_validate())) {
$this->model_setting_setting->editSetting('default_weight', $this->request->post);
$this->model_setting_setting->editSetting('default_weight', $this->request->post, $this->session->data['current_store_id'] );
$this->session->data['success'] = $this->language->get('text_success');
$this->redirect($this->html->getSecureURL('extension/default_weight'));
}
Expand Down Expand Up @@ -68,6 +68,8 @@ public function main() {
'separator' => ' :: ',
'current' => true
));

$this->data['form_store_switch'] = $this->html->getStoreSwitcher();

$this->load->model('localisation/tax_class');
$results = $this->model_localisation_tax_class->getTaxClasses();
Expand All @@ -83,25 +85,27 @@ public function main() {
$locations[ $v['location_id'] ] = $v['name'];
}

$settings = $this->model_setting_setting->getSetting('default_weight',$this->session->data['current_store_id']);

foreach ( $this->fields as $f ) {
if (isset ( $this->request->post [$f] )) {
$this->data [$f] = $this->request->post [$f];
} else {
$this->data [$f] = $this->config->get($f);
$this->data [$f] = $settings[$f];
}
}

foreach ($this->data['locations'] as $location) {
if (isset($this->request->post['default_weight_' . $location['location_id'] . '_rate'])) {
$this->data['default_weight_' . $location['location_id'] . '_rate'] = $this->request->post['default_weight_' . $location['location_id'] . '_rate'];
} else {
$this->data['default_weight_' . $location['location_id'] . '_rate'] = $this->config->get('default_weight_' . $location['location_id'] . '_rate');
$this->data['default_weight_' . $location['location_id'] . '_rate'] = $settings['default_weight_' . $location['location_id'] . '_rate'];
}

if (isset($this->request->post['default_weight_' . $location['location_id'] . '_status'])) {
$this->data['default_weight_' . $location['location_id'] . '_status'] = $this->request->post['default_weight_' . $location['location_id'] . '_status'];
} else {
$this->data['default_weight_' . $location['location_id'] . '_status'] = $this->config->get('default_weight_' . $location['location_id'] . '_status');
$this->data['default_weight_' . $location['location_id'] . '_status'] = $settings['default_weight_' . $location['location_id'] . '_status'];
}
}

Expand Down Expand Up @@ -140,8 +144,6 @@ public function main() {
$rate = 'default_weight_' . $location['location_id'] . '_rate';
$status = 'default_weight_' . $location['location_id'] . '_status';



$this->data['form']['fields']['rates'][$status] = $form->getFieldHtml(array(
'type' => 'checkbox',
'name' => $status,
Expand Down

0 comments on commit af8c728

Please sign in to comment.