public function api() { $this->load->language('sale/order'); $this->document->setTitle($this->language->get('heading_title')); if ($this->validate() && isset($this->request->get['api'])) { // Change the client Client::setName('catalog'); // App $app = new Catalog(); // Initialise main classes $app->initialise(); // Include any URL perameters foreach ($this->request->get as $key => $value) { if ($key != 'route' && $key != 'token' && $key != 'store_id') { $app->request->get[$key] = $value; } } $app->request->get['route'] = $this->request->get['api']; if ($this->request->post) { $app->request->post = $this->request->post; } $app->session->data['api_id'] = $this->config->get('config_api_id'); // Load eCommerce classes $app->ecommerce(); // Route the app $app->route(); // Dispatch the app $app->dispatch(); // Get the output $json = $app->response->getOutput(); unset($app); // Return back to admin Client::setName('admin'); } else { $response = array(); $response['error'] = $this->error; unset($this->error); $json = json_encode($response); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput($json); }
<?php /** * @package Arastta eCommerce * @copyright Copyright (C) 2015 Arastta Association. All rights reserved. (arastta.org) * @credits See CREDITS.txt for credits and other copyright notices. * @license GNU General Public License version 3; see LICENSE.txt */ if (version_compare(PHP_VERSION, '5.3.10', '<')) { die('Your host needs to use PHP 5.3.10 or higher to run Arastta.'); } define('AREXE', 1); require_once 'define.php'; // Startup require_once DIR_SYSTEM . 'library/client.php'; Client::setName('catalog'); require_once DIR_SYSTEM . 'startup.php'; // App $app = new Catalog(); // Initialise main classes $app->initialise(); // Load eCommerce classes $app->ecommerce(); // Route the app $app->route(); // Dispatch the app $app->dispatch(); // Render the output $app->render();
public function pdf($dest = 'D') { $url = ''; if (isset($this->request->get['filter_invoice_number'])) { $url .= '&filter_invoice_number=' . urlencode(html_entity_decode($this->request->get['filter_invoice_number'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_order_id'])) { $url .= '&filter_order_id=' . $this->request->get['filter_order_id']; } if (isset($this->request->get['filter_customer'])) { $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_total'])) { $url .= '&filter_total=' . $this->request->get['filter_total']; } if (isset($this->request->get['filter_invoice_date'])) { $url .= '&filter_invoice_date=' . $this->request->get['filter_invoice_date']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (!$this->validate()) { $this->response->redirect($this->url->link('sale/invoice', 'token=' . $this->session->data['token'] . $url, 'SSL')); } $this->load->language('sale/order'); $this->load->language('sale/invoice'); $this->load->model('sale/order'); $this->load->model('sale/invoice'); if (isset($this->request->get['invoice_id'])) { $invoice_id = $this->request->get['invoice_id']; } else { $invoice_id = 0; } $invoice_info = $this->model_sale_invoice->getInvoice($invoice_id); if (!$invoice_info) { $this->session->data['error'] = $this->language->get('error_invoice_not_found'); $this->response->redirect($this->url->link('sale/invoice', 'token=' . $this->session->data['token'] . $url, 'SSL')); } Client::setName('catalog'); $app = new Catalog(); $app->initialise(); $app->request->get['route'] = 'account/order/invoice'; $app->request->get['order_id'] = $invoice_info['order_id']; $app->request->get['dest'] = $dest; $app->request->post = array(); $app->ecommerce(); $app->route(); $app->dispatch(); unset($app); // Return back to admin Client::setName('admin'); }