KEMENTERIAN PENDIDIKAN DAN KEBUDAYAAN
SURAT KETERANGAN
Hasil Uji Program Tugas Akhir
Yang bertanda tangan di bawah ini, menerangkan bahwa Mahasiswa Tugas Akhir Program Diploma 3 Teknik Informatika : Nama : NURFIKA RANI SIREGAR NIM : 102406162 Prog.Studi : D-3 Teknik Informatika Judul TA : PERACANGAN APLIKASI INTERNET E- COMMERCE
ORYZA FASHOP
Telah melaksanakan test program Tugas Akhir Mahasiswa tersebut di atas pada tanggal………
Dengan Hasil : Sukses / Gagal Demikian diterangkan untuk digunakan melengkapi syarat pendaftaran Ujian Meja Hijau Tugas Akhir Mahasiswa bersangkutan di Departemen Matematika FMIPA USU Medan
Medan, Juni 2013 Dosen Pembingbing Drs.Henry Rani Sitepu, M.S.
NIP. 195303031983031002
KEMENTERIAN PENDIDIKAN DAN KEBUDAYAAN UNIVERSITAS SUMATERA UTARA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM Jln. Bioteknologi No.1 Kampus USU Padang Bulan Medan-
2
NIP. 196209011988031002 NIP. 195303031983031002
Penanggung Jawab Prof.Drs.Tulus, Vordipl.Math.,M.Si.,Ph.D Drs.Henry Rani Sitepu, M.S.
8
7
6
5
4
3
1
20155
Telp. (061) 8211050, 8214290, Fax. (061) 8214290
Keterangan
Paraf Dosen Pembimbing
Pembahasan pada Asisten Mengenai, pada Bab:
No Tanggal Asisten Bimbingan
Tanggal Mulai Bimbingan : Tanggal Selesai Bimbingan :
E- COMMERCE ORYZA FASHOP Dosen Pembimbing : Drs.Henry Rani Sitepu, M.S.
INTERNET
Nama Mahasiswa : NURFIKA RANI SIREGAR Nomor Induk Mahasiswa : 102406162 Judul Tugas Akhir :PERANCANGAN APLIKASI
- Kartu ini harap dikembalikan ke Departemen Matematika bila bimbingan telah selesai. Diketahui Disetujui Ketua Departemen Matematika Pembimbing Utama/
A.Config
<?php // HTTP define('HTTP_SERVER', 'http://localhost/online/admin/'); define('HTTP_CATALOG', 'http://localhost/online/'); define('HTTP_IMAGE', 'http://localhost/online/image/'); // HTTPS define('HTTPS_SERVER', 'http://localhost/online/admin/'); define('HTTPS_IMAGE', 'http://localhost/online/image/'); // DIR define('DIR_APPLICATION', 'C:\xampp\htdocs\online/admin/'); define('DIR_SYSTEM', 'C:\xampp\htdocs\online/system/'); define('DIR_DATABASE', 'C:\xampp\htdocs\online/system/database/'); define('DIR_LANGUAGE', 'C:\xampp\htdocs\online/admin/language/'); define('DIR_TEMPLATE', 'C:\xampp\htdocs\online/admin/view/template/'); define('DIR_CONFIG', 'C:\xampp\htdocs\online/system/config/'); define('DIR_IMAGE', 'C:\xampp\htdocs\online/image/'); define('DIR_CACHE', 'C:\xampp\htdocs\online/system/cache/'); define('DIR_DOWNLOAD', 'C:\xampp\htdocs\online/download/'); define('DIR_LOGS', 'C:\xampp\htdocs\online/system/logs/'); define('DIR_CATALOG', 'C:\xampp\htdocs\online/catalog/'); // DB define('DB_DRIVER', 'mysql'); define('DB_HOSTNAME', 'localhost'); define('DB_USERNAME', 'root'); define('DB_PASSWORD', ''); define('DB_DATABASE', 'toko'); define('DB_PREFIX', ''); ?>
<?php // Version define('VERSION', '1.5.0'); // Configuration require_once('config.php'); // Install if (!defined('DIR_APPLICATION')) { header('Location: ../install/index.php'); exit;
} // Startup require_once(DIR_SYSTEM . 'startup.php'); // Application Classes require_once(DIR_SYSTEM . 'library/currency.php'); require_once(DIR_SYSTEM . 'library/user.php'); require_once(DIR_SYSTEM . 'library/weight.php'); require_once(DIR_SYSTEM . 'library/length.php'); // Registry $registry = new Registry(); // Loader $loader = new Loader($registry); $registry->set('load', $loader); // Config $config = new Config(); $registry->set('config', $config); // Database $db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE); $registry->set('db', $db); // Settings
$query = $db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '0'"); foreach ($query->rows as $setting) {
$config->set($setting['key'], $setting['value']); } // Url $url = new Url(HTTP_SERVER, HTTPS_SERVER); $registry->set('url', $url); // Log $log = new Log($config->get('config_error_filename')); $registry->set('log', $log); function error_handler($errno, $errstr, $errfile, $errline) { global $log, $config; switch ($errno) { case E_NOTICE: case E_USER_NOTICE:
$error = 'Notice'; break; case E_WARNING: case E_USER_WARNING:
$error = 'Warning'; break; case E_ERROR: case E_USER_ERROR:
$error = 'Fatal Error'; break; default:
$error = 'Unknown'; break; } if ($config->get('config_error_display')) { echo '<b>' . $error . '</b>: ' . $errstr . ' in
<b>' . $errfile . '</b> on line <b>' . $errline . '</b>'; } if ($config->get('config_error_log')) {
$log->write('PHP ' . $error . ': ' . $errstr .
} return true; } // Error Handler set_error_handler('error_handler'); // Request $request = new Request(); $registry->set('request', $request); // Response $response = new Response(); $response->addHeader('Content-Type: text/html; charset=utf-8'); $registry->set('response', $response); // Cache $cache = new Cache(); $registry->set('cache', $cache); // Session $session = new Session(); $registry->set('session', $session); // Language $languages = array(); $query = $db->query("SELECT * FROM " . DB_PREFIX . "language"); foreach ($query->rows as $result) {
$languages[$result['code']] = $result; } $config->set('config_language_id', $languages[$config- >get('config_admin_language')]['language_id']); // Language $language = new Language($languages[$config- >get('config_admin_language')]['directory']); $language->load($languages[$config-
$registry->set('language', $language); // Document $document = new Document(); $registry->set('document', $document); // Currency $registry->set('currency', new Currency($registry)); // Weight $registry->set('weight', new Weight($registry)); // Length $registry->set('length', new Length($registry)); // User $registry->set('user', new User($registry)); // Front Controller $controller = new Front($registry); // Login $controller->addPreAction(new Action('common/home/login')); // Permission $controller->addPreAction(new Action('common/home/permission')); // Router if (isset($request->get['route'])) {
$action = new Action($request->get['route']); } else {
$action = new Action('common/home'); } // Dispatch $controller->dispatch($action, new Action('error/not_found')); // Output $response->output();
<?php class ControllerCatalogCategory extends Controller { private $error = array(); public function index() {
$this->load->language('catalog/category'); $this->document->setTitle($this->language-
>get('heading_title')); $this->load->model('catalog/category'); $this->getList();
} public function insert() { $this->load->language('catalog/category'); $this->document->setTitle($this->language-
>get('heading_title')); $this->load->model('catalog/category'); if (($this->request->server['REQUEST_METHOD']
== 'POST') && $this->validateForm()) { $this->model_catalog_category-
>addCategory($this->request->post); $this->session->data['success'] = $this-
>language->get('text_success'); $this->redirect($this->url-
>link('catalog/category', 'token=' . $this->session- >data['token'], 'SSL'));
} $this->getForm();
} public function update() {
$this->load->language('catalog/category'); $this->document->setTitle($this->language-
>get('heading_title')); $this->load->model('catalog/category'); if (($this->request->server['REQUEST_METHOD']
== 'POST') && $this->validateForm()) { $this->model_catalog_category-
>editCategory($this->request->get['category_id'], $this- >request->post);
$this->session->data['success'] = $this- >language->get('text_success');
$this->redirect($this->url- >link('catalog/category', 'token=' . $this->session- >data['token'], 'SSL'));
} $this->getForm();
} public function delete() { $this->load->language('catalog/category'); $this->document->setTitle($this->language-
>get('heading_title')); $this->load->model('catalog/category'); if (isset($this->request->post['selected']) &&
$this->validateDelete()) { foreach ($this->request->post['selected'] as $category_id) {
$this->model_catalog_category- >deleteCategory($category_id);
} $this->session->data['success'] = $this-
>language->get('text_success');
>link('catalog/category', 'token=' . $this->session- >data['token'], 'SSL'));
} $this->getList();
} private function getList() { $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array(
'text' => $this->language- >get('text_home'),
'href' => $this->url- >link('common/home', 'token=' . $this->session- >data['token'], 'SSL'),
'separator' => false ); $this->data['breadcrumbs'][] = array(
'text' => $this->language- >get('heading_title'),
'href' => $this->url- >link('catalog/category', 'token=' . $this->session- >data['token'], 'SSL'),
'separator' => ' :: ' ); $this->data['insert'] = $this->url-
>link('catalog/category/insert', 'token=' . $this- >session->data['token'], 'SSL');
$this->data['delete'] = $this->url- >link('catalog/category/delete', 'token=' . $this- >session->data['token'], 'SSL');
$this->data['categories'] = array(); $results = $this->model_catalog_category-
>getCategories(0); foreach ($results as $result) { $action = array();
'text' => $this->language- >get('text_edit'),
'href' => $this->url- >link('catalog/category/update', 'token=' . $this- >session->data['token'] . '&category_id=' .
$result['category_id']) ); $this->data['categories'][] = array(
'category_id' => $result['category_id'],
'name' => $result['name'], 'sort_order' =>
$result['sort_order'], 'selected' => isset($this-
>request->post['selected']) && in_array($result['category_id'], $this->request- >post['selected']),
'action' => $action );
} $this->data['heading_title'] = $this->language-
>get('heading_title'); $this->data['text_no_results'] = $this-
>language->get('text_no_results'); $this->data['column_name'] = $this->language-
>get('column_name'); $this->data['column_sort_order'] = $this-
>language->get('column_sort_order'); $this->data['column_action'] = $this->language-
>get('column_action'); $this->data['button_insert'] = $this->language-
>get('button_insert'); $this->data['button_delete'] = $this->language-
>get('button_delete'); if (isset($this->error['warning'])) { $this->data['error_warning'] = $this-
>error['warning'];
$this->data['error_warning'] = ''; } if (isset($this->session->data['success'])) {
$this->data['success'] = $this->session- >data['success']; unset($this->session->data['success']);
} else { $this->data['success'] = '';
} $this->template = 'catalog/category_list.tpl'; $this->children = array(
'common/header', 'common/footer',
); $this->response->setOutput($this->render());
} private function getForm() { $this->data['heading_title'] = $this->language-
>get('heading_title'); $this->data['text_none'] = $this->language-
>get('text_none'); $this->data['text_default'] = $this->language-
>get('text_default'); $this->data['text_image_manager'] = $this-
>language->get('text_image_manager'); $this->data['text_enabled'] = $this->language-
>get('text_enabled'); $this->data['text_disabled'] = $this->language- >get('text_disabled');
$this->data['text_percent'] = $this->language- >get('text_percent');
$this->data['text_amount'] = $this->language- >get('text_amount');
$this->data['entry_name'] = $this->language- >get('entry_name');
$this->data['entry_meta_keyword'] = $this-
$this->data['entry_meta_description'] = $this- >language->get('entry_meta_description');
$this->data['entry_status'] = $this->language- >get('entry_status');
} else { $this->data['error_warning'] = '';
$this->data['error_warning'] = $this- >error['warning'];
$this->data['tab_design'] = $this->language- >get('tab_design'); if (isset($this->error['warning'])) {
$this->data['button_cancel'] = $this->language- >get('button_cancel'); $this->data['tab_general'] = $this->language- >get('tab_general'); $this->data['tab_data'] = $this->language- >get('tab_data');
$this->data['button_save'] = $this->language- >get('button_save');
$this->data['entry_layout'] = $this->language- >get('entry_layout');
$this->data['entry_sort_order'] = $this- >language->get('entry_sort_order');
$this->data['entry_description'] = $this- >language->get('entry_description');
$this->data['entry_column'] = $this->language- >get('entry_column');
$this->data['entry_top'] = $this->language- >get('entry_top');
$this->data['entry_image'] = $this->language- >get('entry_image');
$this->data['entry_parent'] = $this->language- >get('entry_parent');
$this->data['entry_keyword'] = $this->language- >get('entry_keyword');
$this->data['entry_store'] = $this->language- >get('entry_store');
} if (isset($this->error['name'])) {
>error['name']; } else {
$this->data['error_name'] = array(); } $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array(
'text' => $this->language- >get('text_home'),
'href' => $this->url- >link('common/home', 'token=' . $this->session- >data['token'], 'SSL'),
'separator' => false ); $this->data['breadcrumbs'][] = array(
'text' => $this->language- >get('heading_title'),
'href' => $this->url- >link('catalog/category', 'token=' . $this->session- >data['token'], 'SSL'),
'separator' => ' :: ' ); if (!isset($this->request->get['category_id']))
{ $this->data['action'] = $this->url-
>link('catalog/category/insert', 'token=' . $this- >session->data['token'], 'SSL');
} else { $this->data['action'] = $this->url-
>link('catalog/category/update', 'token=' . $this- >session->data['token'] . '&category_id=' . $this- >request->get['category_id']);
} $this->data['cancel'] = $this->url-
>link('catalog/category', 'token=' . $this->session- >data['token'], 'SSL');
$this->data['token'] = $this->session- >data['token']; if (isset($this->request->get['category_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
$category_info = $this- >model_catalog_category->getCategory($this->request- >get['category_id']); }
$this->load->model('localisation/language'); $this->data['languages'] = $this-
>model_localisation_language->getLanguages(); if (isset($this->request- >post['category_description'])) {
$this->data['category_description'] = $this->request->post['category_description'];
} elseif (isset($category_info)) { $this->data['category_description'] =
$this->model_catalog_category- >getCategoryDescriptions($this->request- >get['category_id']);
} else { $this->data['category_description'] = array();
} $categories = $this->model_catalog_category-
>getCategories(0); // Remove own id from list if (isset($category_info)) { foreach ($categories as $key => $category)
{ if ($category['category_id'] == $category_info['category_id']) { unset($categories[$key]);
} }
} $this->data['categories'] = $categories;
$this->data['parent_id'] = $this->request- >post['parent_id'];
} elseif (isset($category_info)) { $this->data['parent_id'] =
$category_info['parent_id']; } else {
$this->data['parent_id'] = 0; } $this->load->model('setting/store'); $this->data['stores'] = $this-
>model_setting_store->getStores(); if (isset($this->request- >post['category_store'])) {
$this->data['category_store'] = $this- >request->post['category_store'];
} elseif (isset($category_info)) { $this->data['category_store'] = $this-
>model_catalog_category->getCategoryStores($this- >request->get['category_id']);
} else { $this->data['category_store'] = array(0);
} if (isset($this->request->post['keyword'])) { $this->data['keyword'] = $this->request-
>post['keyword']; } elseif (isset($category_info)) {
$this->data['keyword'] = $category_info['keyword'];
} else { $this->data['keyword'] = '';
} if (isset($this->request->post['image'])) { $this->data['image'] = $this->request-
>post['image']; } elseif (isset($category_info)) {
$this->data['image'] = $category_info['image'];
} else {
} $this->load->model('tool/image'); if (isset($category_info) &&
$category_info['image'] && file_exists(DIR_IMAGE . $category_info['image'])) {
$this->data['preview'] = $this- >model_tool_image->resize($category_info['image'], 100, 100);
} else { $this->data['preview'] = $this-
>model_tool_image->resize('no_image.jpg', 100, 100); } if (isset($this->request->post['top'])) {
$this->data['top'] = $this->request- >post['top'];
} elseif (isset($category_info)) { $this->data['top'] =
$category_info['top']; } else {
$this->data['top'] = 0; } if (isset($this->request->post['column'])) {
$this->data['column'] = $this->request- >post['column'];
} elseif (isset($category_info)) { $this->data['column'] =
$category_info['column']; } else {
$this->data['column'] = 1; } if (isset($this->request->post['sort_order']))
{ $this->data['sort_order'] = $this-
>request->post['sort_order']; } elseif (isset($category_info)) {
$this->data['sort_order'] = $category_info['sort_order'];
} else {
} if (isset($this->request->post['status'])) { $this->data['status'] = $this->request-
>post['status']; } elseif (isset($category_info)) {
$this->data['status'] = $category_info['status'];
} else { $this->data['status'] = 1;
} if (isset($this->request- >post['category_layout'])) {
$this->data['category_layout'] = $this- >request->post['category_layout'];
} elseif (isset($category_info)) { $this->data['category_layout'] = $this-
>model_catalog_category->getCategoryLayouts($this- >request->get['category_id']);
} else { $this->data['category_layout'] = array();
} $this->load->model('design/layout'); $this->data['layouts'] = $this-
>model_design_layout->getLayouts(); $this->template = 'catalog/category_form.tpl'; $this->children = array(
'common/header', 'common/footer',
); $this->response->setOutput($this->render());
} private function validateForm() { if (!$this->user->hasPermission('modify',
'catalog/category')) { $this->error['warning'] = $this->language-
>get('error_permission'); foreach ($this->request- >post['category_description'] as $language_id => $value) { if ((strlen(utf8_decode($value['name'])) < 2) || (strlen(utf8_decode($value['name'])) > 255)) {
$this->error['name'][$language_id] = $this->language->get('error_name');
} } if ($this->error && !isset($this-
>error['warning'])) { $this->error['warning'] = $this->language-
>get('error_warning'); } if (!$this->error) { return true;
} else { return false; }
} private function validateDelete() { if (!$this->user->hasPermission('modify',
'catalog/category')) { $this->error['warning'] = $this->language-
>get('error_permission'); } if (!$this->error) { return true;
} else { return false; }
} } ?>
<?php class ControllerCatalogProduct extends Controller { private $error = array(); public function index() {
$this->load->language('catalog/product'); $this->document->setTitle($this->language-
>get('heading_title')); $this->load->model('catalog/product'); $this->getList();
} public function insert() { $this->load->language('catalog/product'); $this->document->setTitle($this->language- >get('heading_title'));
$this->load->model('catalog/product'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
$this->model_catalog_product- >addProduct($this->request->post);
$this->session->data['success'] = $this- >language->get('text_success');
$url = ''; if (isset($this->request- >get['filter_name'])) {
$url .= '&filter_name=' . $this- >request->get['filter_name'];
} if (isset($this->request- >get['filter_model'])) {
$url .= '&filter_model=' . $this- >request->get['filter_model'];
} if (isset($this->request- >get['filter_price'])) {
$url .= '&filter_price=' . $this- >request->get['filter_price'];
} if (isset($this->request- >get['filter_quantity'])) {
$url .= '&filter_quantity=' . $this- >request->get['filter_quantity'];
} if (isset($this->request- >get['filter_status'])) {
$url .= '&filter_status=' . $this- >request->get['filter_status'];
} 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']; } $this->redirect($this->url-
>link('catalog/product', 'token=' . $this->session- >data['token'] . $url, 'SSL')); } $this->getForm(); public function update() { $this->load->language('catalog/product'); $this->document->setTitle($this->language- >get('heading_title'));
$this->load->model('catalog/product'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
$this->model_catalog_product- >editProduct($this->request->get['product_id'], $this- >request->post);
$this->session->data['success'] = $this- >language->get('text_success');
$url = ''; if (isset($this->request- >get['filter_name'])) {
$url .= '&filter_name=' . $this- >request->get['filter_name'];
} if (isset($this->request- >get['filter_model'])) {
$url .= '&filter_model=' . $this- >request->get['filter_model'];
} if (isset($this->request- >get['filter_price'])) {
$url .= '&filter_price=' . $this- >request->get['filter_price'];
} if (isset($this->request- >get['filter_quantity'])) {
$url .= '&filter_quantity=' . $this- >request->get['filter_quantity'];
} if (isset($this->request- >get['filter_status'])) {
$url .= '&filter_status=' . $this- >request->get['filter_status'];
} 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']; } $this->redirect($this->url-
>link('catalog/product', 'token=' . $this->session- >data['token'] . $url, 'SSL'));
} $this->getForm();
} public function delete() { $this->load->language('catalog/product'); $this->document->setTitle($this->language- >get('heading_title'));
$this->load->model('catalog/product'); if (isset($this->request->post['selected']) && $this->validateDelete()) { foreach ($this->request->post['selected'] as $product_id) {
$this->model_catalog_product- >deleteProduct($product_id);
$this->session->data['success'] = $this- >language->get('text_success');
$url = ''; if (isset($this->request- >get['filter_name'])) {
$url .= '&filter_name=' . $this- >request->get['filter_name'];
} if (isset($this->request- >get['filter_model'])) {
$url .= '&filter_model=' . $this- >request->get['filter_model'];
} if (isset($this->request- >get['filter_price'])) {
$url .= '&filter_price=' . $this- >request->get['filter_price'];
} if (isset($this->request- >get['filter_quantity'])) {
$url .= '&filter_quantity=' . $this- >request->get['filter_quantity'];
} if (isset($this->request- >get['filter_status'])) {
$url .= '&filter_status=' . $this- >request->get['filter_status'];
} if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request-
>get['sort']; } if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request-
} if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request-
>get['page']; } $this->redirect($this->url-
>link('catalog/product', 'token=' . $this->session- >data['token'] . $url, 'SSL'));
} $this->getList();
} public function copy() { $this->load->language('catalog/product'); $this->document->setTitle($this->language- >get('heading_title'));
$this->load->model('catalog/product'); if (isset($this->request->post['selected']) && $this->validateCopy()) { foreach ($this->request->post['selected'] as $product_id) {
$this->model_catalog_product- >copyProduct($product_id);
} $this->session->data['success'] = $this-
>language->get('text_success'); $url = ''; if (isset($this->request-
>get['filter_name'])) { $url .= '&filter_name=' . $this-
>request->get['filter_name']; } if (isset($this->request-
$url .= '&filter_model=' . $this- >request->get['filter_model'];
} if (isset($this->request- >get['filter_price'])) {
$url .= '&filter_price=' . $this- >request->get['filter_price'];
} if (isset($this->request- >get['filter_quantity'])) {
$url .= '&filter_quantity=' . $this- >request->get['filter_quantity'];
} if (isset($this->request- >get['filter_status'])) {
$url .= '&filter_status=' . $this- >request->get['filter_status'];
} 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']; } $this->redirect($this->url-
>link('catalog/product', 'token=' . $this->session- >data['token'] . $url, 'SSL'));
} $this->getList(); private function getList() { if (isset($this->request->get['filter_name'])) {
$filter_name = $this->request- >get['filter_name'];
} else { $filter_name = null;
} if (isset($this->request->get['filter_model'])) {
$filter_model = $this->request- >get['filter_model'];
} else { $filter_model = null;
} if (isset($this->request->get['filter_price'])) {
$filter_price = $this->request- >get['filter_price'];
} else { $filter_price = null;
} if (isset($this->request- >get['filter_quantity'])) {
$filter_quantity = $this->request- >get['filter_quantity'];
} else { $filter_quantity = null;
} if (isset($this->request- >get['filter_status'])) {
$filter_status = $this->request- >get['filter_status'];
} else { $filter_status = null;
} if (isset($this->request->get['sort'])) {
} else { $sort = 'pd.name';
} if (isset($this->request->get['order'])) { $order = $this->request->get['order'];
} else { $order = 'ASC';
} if (isset($this->request->get['page'])) { $page = $this->request->get['page'];
} else { $page = 1;
} $url = ''; if (isset($this->request->get['filter_name']))
{ $url .= '&filter_name=' . $this->request-
>get['filter_name']; } if (isset($this->request->get['filter_model']))
{ $url .= '&filter_model=' . $this->request-
>get['filter_model']; } if (isset($this->request->get['filter_price']))
{ $url .= '&filter_price=' . $this->request-
>get['filter_price']; } if (isset($this->request-
>get['filter_quantity'])) { $url .= '&filter_quantity=' . $this-
>request->get['filter_quantity']; } if (isset($this->request-
$url .= '&filter_status=' . $this- >request->get['filter_status'];
} 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']; } $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array(
'text' => $this->language- >get('text_home'),
'href' => $this->url- >link('common/home', 'token=' . $this->session- >data['token'], 'SSL'),
'separator' => false ); $this->data['breadcrumbs'][] = array(
'text' => $this->language- >get('heading_title'),
'href' => $this->url- >link('catalog/product', 'token=' . $this->session- >data['token'] . $url, 'SSL'),
'separator' => ' :: ' ); $this->data['insert'] = $this->url-
>link('catalog/product/insert', 'token=' . $this- >session->data['token'] . $url, 'SSL');
$this->data['copy'] = $this->url-
>data['token'] . $url, 'SSL'); $this->data['delete'] = $this->url-
>link('catalog/product/delete', 'token=' . $this- >session->data['token'] . $url, 'SSL');
$this->data['products'] = array(); $data = array(
'filter_name' => $filter_name, 'filter_model' => $filter_model, 'filter_price' => $filter_price, 'filter_quantity' => $filter_quantity, 'filter_status' => $filter_status, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $this-
>config->get('config_admin_limit'), 'limit' => $this->config-
>get('config_admin_limit') ); $this->load->model('tool/image'); $product_total = $this->model_catalog_product-
>getTotalProducts($data); $results = $this->model_catalog_product-
>getProducts($data); foreach ($results as $result) { $action = array(); $action[] = array(
'text' => $this->language- >get('text_edit'),
'href' => $this->url- >link('catalog/product/update', 'token=' . $this- >session->data['token'] . '&product_id=' .
$result['product_id'] . $url, 'SSL') ); if ($result['image'] && file_exists(DIR_IMAGE . $result['image'])) {
>resize($result['image'], 40, 40); } else {
$image = $this->model_tool_image- >resize('no_image.jpg', 40, 40);
} $product_specials = $this-
>model_catalog_product- >getProductSpecials($result['product_id']); if ($product_specials) { $special = reset($product_specials); if(($special['date_start'] != '0000-00- 00' && $special['date_start'] > date('Y-m-d')) || ($special['date_end'] != '0000-00-00' && $special['date_end'] < date('Y-m-d'))) { $special = FALSE; } } else { $special = FALSE; }
$this->data['products'][] = array( 'product_id' =>
$result['product_id'], 'name' => $result['name'], 'model' => $result['model'], 'price' => $result['price'], 'special' => $special['price'], 'image' => $image, 'quantity' => $result['quantity'], 'status' => ($result['status'] ?
$this->language->get('text_enabled') : $this->language- >get('text_disabled')),
'selected' => isset($this->request- >post['selected']) && in_array($result['product_id'], $this->request->post['selected']),
'action' => $action );
} $this->data['heading_title'] = $this->language-
>get('heading_title');
$this->data['text_enabled'] = $this->language- >get('text_enabled');
$this->data['column_action'] = $this->language- >get('column_action');
} else { $this->data['error_warning'] = '';
$this->data['error_warning'] = $this- >error['warning'];
$this->data['token'] = $this->session- >data['token']; if (isset($this->error['warning'])) {
$this->data['button_filter'] = $this->language- >get('button_filter');
$this->data['button_delete'] = $this->language- >get('button_delete');
$this->data['button_insert'] = $this->language- >get('button_insert');
$this->data['button_copy'] = $this->language- >get('button_copy');
$this->data['column_status'] = $this->language- >get('column_status');
$this->data['text_disabled'] = $this->language- >get('text_disabled');
$this->data['column_quantity'] = $this- >language->get('column_quantity');
$this->data['column_price'] = $this->language- >get('column_price');
$this->data['column_model'] = $this->language- >get('column_model');
$this->data['column_name'] = $this->language- >get('column_name');
$this->data['column_image'] = $this->language- >get('column_image');
$this->data['text_image_manager'] = $this- >language->get('text_image_manager');
$this->data['text_no_results'] = $this- >language->get('text_no_results');
}
$this->data['success'] = $this->session- >data['success']; unset($this->session->data['success']);
} else { $this->data['success'] = '';
} $url = ''; if (isset($this->request->get['filter_name']))
{ $url .= '&filter_name=' . $this->request-
>get['filter_name']; } if (isset($this->request->get['filter_model']))
{ $url .= '&filter_model=' . $this->request-
>get['filter_model']; } if (isset($this->request->get['filter_price']))
{ $url .= '&filter_price=' . $this->request-
>get['filter_price']; } if (isset($this->request-
>get['filter_quantity'])) { $url .= '&filter_quantity=' . $this-
>request->get['filter_quantity']; } if (isset($this->request-
>get['filter_status'])) { $url .= '&filter_status=' . $this-
>request->get['filter_status']; } if ($order == 'ASC') {
$url .= '&order=DESC'; } else {
} if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request-
>get['page']; } $this->data['sort_name'] = $this->url-
>link('catalog/product', 'token=' . $this->session- >data['token'] . '&sort=pd.name' . $url, 'SSL');
$this->data['sort_model'] = $this->url- >link('catalog/product', 'token=' . $this->session- >data['token'] . '&sort=p.model' . $url, 'SSL');
$this->data['sort_price'] = $this->url- >link('catalog/product', 'token=' . $this->session- >data['token'] . '&sort=p.price' . $url, 'SSL');
$this->data['sort_quantity'] = $this->url- >link('catalog/product', 'token=' . $this->session- >data['token'] . '&sort=p.quantity' . $url, 'SSL');
$this->data['sort_status'] = $this->url- >link('catalog/product', 'token=' . $this->session- >data['token'] . '&sort=p.status' . $url, 'SSL');
$this->data['sort_order'] = $this->url- >link('catalog/product', 'token=' . $this->session- >data['token'] . '&sort=p.sort_order' . $url, 'SSL');
$url = ''; if (isset($this->request->get['filter_name'])) {
$url .= '&filter_name=' . $this->request- >get['filter_name'];
} if (isset($this->request->get['filter_model'])) {
$url .= '&filter_model=' . $this->request- >get['filter_model'];
} if (isset($this->request->get['filter_price'])) {
$url .= '&filter_price=' . $this->request-
} if (isset($this->request- >get['filter_quantity'])) {
$url .= '&filter_quantity=' . $this- >request->get['filter_quantity'];
} if (isset($this->request- >get['filter_status'])) {
$url .= '&filter_status=' . $this- >request->get['filter_status'];
} if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request-
>get['sort']; } if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request- >get['order'];
} $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $this->config-
>get('config_admin_limit'); $pagination->text = $this->language-
>get('text_pagination'); $pagination->url = $this->url-
>link('catalog/product', 'token=' . $this->session- >data['token'] . $url . '&page={page}', 'SSL');
$this->data['pagination'] = $pagination- >render();
$this->data['filter_name'] = $filter_name; $this->data['filter_model'] = $filter_model; $this->data['filter_price'] = $filter_price; $this->data['filter_quantity'] =
$this->data['filter_status'] = $filter_status; $this->data['sort'] = $sort; $this->data['order'] = $order; $this->layout = 'common/layout'; $this->template = 'catalog/product_list.tpl'; $this->children = array(
'common/header', 'common/footer',
); $this->response->setOutput($this->render());