Code: Select all
if (isset($this->request->post['company'])) {
$this->data['company'] = $this->request->post['company'];
} elseif (isset($this->session->data['guest']['company'])) {
$this->data['company'] = $this->session->data['guest']['company'];
} else {
$this->data['company'] = '';
}
Code: Select all
private function loadDefaultValue($key, $default)
{
if (isset($this->request->post[$key])) {
$this->data[$key] = $this->request->post[$key];
} elseif (isset($this->session->data['guest'][$key])) {
$this->data[$key] = $this->session->data['guest'][$key];
} else {
$this->data[$key] = $default;
}
}
Would potentially allow hundreds of lines of code to be removed from the software, improve overall code readability, and reduce the amount of time needed to test. Of course, there might be URL "route" issues (make sure no one can do route=checkout/guest_step_1/loadDefaultValue).