Exemplo n.º 1
0
 public function getMethods()
 {
     $json = array('' => array('name' => Language::getVar('SUMO_NOUN_SELECT')));
     $app_id = 0;
     if (isset($this->request->get['store_id']) && !empty($this->request->get['method'])) {
         if (isset($this->request->get['order_id'])) {
             $this->load->model('sale/orders');
             $check = $this->model_sale_orders->getOrder($this->request->get['order_id']);
         }
         $apps = Apps::getAvailable($this->request->get['store_id'], $this->request->get['method']);
         $this->config->set('store_id', $this->request->get['store_id']);
         $this->config->set('is_admin', true);
         if ($this->request->get['method'] == 1) {
             $type = 'shipping';
         } else {
             $type = 'payment';
         }
         $app_id = $check[$type]['app']['id'];
         foreach ($apps as $list) {
             $file = DIR_HOME . 'apps/' . $list['list_name'] . '/catalog/controller/checkout.php';
             if (file_exists($file)) {
                 include $file;
                 $class = ucfirst($list['list_name']) . '\\Controller' . ucfirst($list['list_name']) . 'Checkout';
                 $class = new $class($this->registry);
                 $list['options'] = $class->{$type}();
             }
             if (empty($list['options'])) {
                 continue;
             }
             if ($list['id'] == $app_id) {
                 $list['selected'] = true;
             }
             $json[$list['list_name']] = $list;
         }
     }
     $this->response->setOutput(json_encode($json));
 }
Exemplo n.º 2
0
 public function method()
 {
     if ($this->request->server['REQUEST_METHOD'] == 'POST') {
         $type = $this->request->post['type'];
         if (!in_array($type, array('payment', 'shipping'))) {
             $type = 'shipping';
         }
         $this->data['info'] = Language::getVar('SUMO_CATALOG_' . strtoupper($type) . '_METHODS');
         $this->data['type'] = $type;
         $apps = Apps::getAvailable($this->config->get('store_id'), $type == 'shipping' ? 1 : 2);
         // Unset old methods
         unset($this->session->data[$type . '_methods']);
         foreach ($apps as $list) {
             $file = DIR_HOME . 'apps/' . $list['list_name'] . '/catalog/controller/checkout.php';
             if (file_exists($file)) {
                 include $file;
                 $class = ucfirst($list['list_name']) . '\\Controller' . ucfirst($list['list_name']) . 'Checkout';
                 $class = new $class($this->registry);
                 $list['options'] = $class->{$type}();
             }
             $this->session->data[$type . '_methods'][$list['list_name']] = $list;
         }
         $this->data['warning'] = '';
         if (empty($this->session->data[$type . '_methods'])) {
             $this->data['warning'] = Language::getVar('SUMO_NOUN_' . strtoupper($type) . '_ERROR_NONE_AVAILABLE', $this->url->link('information/contact', '', 'SSL'));
         }
         if (isset($this->session->data[$type . '_methods'])) {
             $this->data['methods'] = $this->session->data[$type . '_methods'];
         }
         if ($type == 'shipping') {
             $this->session->data['force_step'] = 5;
         } else {
             $this->session->data['force_step'] = 6;
         }
         $this->template = 'checkout/method.tpl';
         $this->response->setOutput($this->render());
     } else {
         $this->response->setOutput(json_encode(array()));
     }
 }
Exemplo n.º 3
0
 private function display($store_id)
 {
     $this->data['widgets'] = Apps::getAvailable($store_id, 3);
     $this->template = 'settings/themes/builder/display.tpl';
     return $this->render();
 }