public function index() { $this->load->model('catalog/information'); $this->data['type'] = 'information'; $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false); if (isset($this->request->get['information_id'])) { $information_id = (int) $this->request->get['information_id']; } else { $information_id = 0; } $information_info = $this->model_catalog_information->getInformation($information_id); if ($information_info) { $this->document->setTitle($information_info['title']); if (!empty($information_info['parent_id'])) { $parent = $this->model_catalog_information->getInformation($information_info['parent_id']); $this->data['breadcrumbs'][] = array('text' => $parent['title'], 'href' => $this->url->link('information/information', 'information_id=' . $parent['information_id'])); } $this->data['breadcrumbs'][] = array('text' => $information_info['title'], 'href' => $this->url->link('information/information', 'information_id=' . $information_id)); $this->data['heading_title'] = $information_info['title']; $this->data['description'] = html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8'); $this->data['settings'] = $this->config->get('details_information_information_' . $this->config->get('template')); if (!is_array($this->data['settings']) || !count($this->data['settings'])) { $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'informationTree', 'data' => $information_info)); $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'usp', 'location' => 'information')); $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'banner', 'location' => 'information', 'data' => $information_info)); $this->data['settings']['bottom'][] = $this->getChild('app/widgetsimpleproduct/', array('type' => 'latest', 'limit' => 6)); } $this->template = 'information/content.tpl'; $this->children = array('common/footer', 'common/header'); $this->response->setOutput($this->render()); } else { $this->redirect($this->url->link('error/not_found')); } }
function getQuote($address) { $this->language->load('shipping/item'); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int) $this->config->get('item_geo_zone_id') . "' AND country_id = '" . (int) $address['country_id'] . "' AND (zone_id = '" . (int) $address['zone_id'] . "' OR zone_id = '0')"); if (!$this->config->get('item_geo_zone_id')) { $status = true; } elseif ($query->num_rows) { $status = true; } else { $status = false; } $method_data = array(); if ($status) { $items = 0; foreach ($this->cart->getProducts() as $product) { if ($product['shipping']) { $items += $product['quantity']; } } $quote_data = array(); $quote_data['item'] = array('code' => 'item.item', 'title' => Language::getVar('SUMO_SIHPPING_ITEM_DESCRIPTION'), 'cost' => $this->config->get('item_cost') * $items, 'tax_class_id' => $this->config->get('item_tax_class_id'), 'text' => $this->currency->format($this->tax->calculate($this->config->get('item_cost') * $items, $this->config->get('item_tax_class_id'), $this->config->get('config_tax')))); $method_data = array('code' => 'item', 'title' => Language::getVar('SUMO_SHIPPING_ITEM_TITLE'), 'quote' => $quote_data, 'sort_order' => $this->config->get('item_sort_order'), 'error' => false); } return $method_data; }
public function builder() { if (empty($this->request->get['theme'])) { $this->redirect($this->url->link('settings/themes', '', 'SSL')); exit; } if (empty($this->request->get['store_id'])) { $this->request->get['store_id'] = 0; } $theme = $this->request->get['theme']; $this->document->setTitle(Language::getVar('SUMO_ADMIN_THEMES_BUILDER')); $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SETTINGS_DASHBOARD'), 'href' => $this->url->link('settings/dashboard', '', 'SSL'))); $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_THEMES_SETTINGS'), 'href' => $this->url->link('settings/themes/', '', 'SSL'))); $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_THEMES_BUILDER'))); $this->document->addScript('view/js/jquery/jquery.ajaxupload.js'); $this->data['stores'] = $this->model_settings_stores->getStores(); $this->data['current_store'] = isset($this->request->get['store_id']) ? $this->request->get['store_id'] : 0; if (empty($this->request->get['action'])) { $this->request->get['action'] = 'colors'; } $action = $this->request->get['action']; if (!method_exists($this, $action)) { Logger::warning('It seems ' . $action . ' is not callable?'); $action = 'colors'; } $this->data['action'] = $action; $this->data['theme'] = $theme; $this->data['content'] = $this->{$action}($this->data['current_store'], $this->data['theme']); $this->template = 'settings/themes/builder.tpl'; $this->children = array('common/header', 'common/footer'); //$this->data['content'] = $this->data[$action]; $this->response->setOutput($this->render()); }
public function ajaxGetList() { usleep(5000); $type = !empty($this->request->post['type']) ? $this->request->post['type'] : ''; if (!empty($type) && in_array($type, $this->types)) { $data = array(); $tmp = Database::fetchAll("SELECT name, " . $type . "_id AS id, language_id FROM PREFIX_" . $type); if (!count($tmp)) { $data['isEmpty'] = Language::getVar('SUMO_ADMIN_STATUS_SETTINGS_EMPTY'); } else { // Default language first foreach ($tmp as $list) { if ($list['language_id'] == $this->config->get('language_id')) { $data['return'][$list['id']] = $list; } } // Secondary language? foreach ($tmp as $list) { if (!isset($data['return'][$list['id']])) { if (!empty($list['name'])) { $data['return'][$list['id']] = $list; } } } // Yeah well, we tried everything.... foreach ($tmp as $list) { if (!isset($data['return'][$list['id']])) { $list['name'] = Language::getVar('SUMO_NOUN_EMPTY'); $data['return'][$list['id']] = $list; } } } $this->response->setOutput(json_encode($data)); } }
protected function index() { $this->language->load('module/affiliate'); $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['text_register'] = Language::getVar('SUMO_ACCOUNT_REGISTER_TITLE'); $this->data['text_login'] = Language::getVar('SUMO_ACCOUNT_LOGIN_TITLE'); $this->data['text_logout'] = Language::getVar('SUMO_ACCOUNT_LOGOUT_TITLE'); $this->data['text_forgotten'] = Language::getVar('SUMO_ACCOUNT_FORGOTTEN_TITLE'); $this->data['text_account'] = Language::getVar('SUMO_ACCOUNT_TITLE'); $this->data['text_edit'] = $this->language->get('text_edit'); $this->data['text_password'] = $this->language->get('text_password'); $this->data['text_payment'] = $this->language->get('text_payment'); $this->data['text_tracking'] = $this->language->get('text_tracking'); $this->data['text_transaction'] = $this->language->get('text_transaction'); $this->data['logged'] = $this->affiliate->isLogged(); $this->data['register'] = $this->url->link('affiliate/register', '', 'SSL'); $this->data['login'] = $this->url->link('affiliate/login', '', 'SSL'); $this->data['logout'] = $this->url->link('affiliate/logout', '', 'SSL'); $this->data['forgotten'] = $this->url->link('affiliate/forgotten', '', 'SSL'); $this->data['account'] = $this->url->link('affiliate/account', '', 'SSL'); $this->data['edit'] = $this->url->link('affiliate/edit', '', 'SSL'); $this->data['password'] = $this->url->link('affiliate/password', '', 'SSL'); $this->data['payment'] = $this->url->link('affiliate/payment', '', 'SSL'); $this->data['tracking'] = $this->url->link('affiliate/tracking', '', 'SSL'); $this->data['transaction'] = $this->url->link('affiliate/transaction', '', 'SSL'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/affiliate.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/affiliate.tpl'; } else { $this->template = 'default/template/module/affiliate.tpl'; } $this->render(); }
public function getCustomerGroups($data = array()) { $sql = 'SELECT * FROM PREFIX_customer_group'; $sortData = array('sort_order'); if (isset($data['sort']) && in_array($data['sort'], $sortData)) { $sql .= " ORDER BY " . $data['sort']; } else { $sql .= " ORDER BY sort_order"; } if (isset($data['order']) && $data['order'] == 'DESC') { $sql .= " DESC"; } else { $sql .= " ASC"; } if (isset($data['start']) || isset($data['limit'])) { if ($data['start'] < 0) { $data['start'] = 0; } if ($data['limit'] < 1) { $data['limit'] = 20; } $sql .= " LIMIT " . (int) $data['start'] . "," . (int) $data['limit']; } $return = array(); foreach ($this->fetchAll($sql) as $list) { $description = $this->query("SELECT *\n FROM PREFIX_customer_group_description\n WHERE language_id = :lang\n AND customer_group_id = :group", array('lang' => $this->config->get('language_id'), 'group' => $list['customer_group_id']))->fetch(); if (is_array($description)) { $list = array_merge($description, $list); } else { $list['name'] = Language::getVar('SUMO_NOUN_UNKNOWN'); } $return[$list['customer_group_id']] = $list; } return $return; }
public function index() { $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_CMS_DASHBOARD'))); $this->template = 'dashboard/index.tpl'; $this->children = array('common/header', 'common/footer'); $this->response->setOutput($this->render()); }
public function addCustomer($data) { $this->load->model('account/customer_group'); if (empty($data['customer_group_id'])) { $data['customer_group_id'] = $this->config->get('customer_group_id'); } $group_info = $this->model_account_customer_group->getCustomerGroup($data['customer_group_id']); $salt = substr(md5(uniqid(rand(), true) . $this->request->server['REMOTE_ADDR']), 0, 9); $data['birthdate'] = date('Y-m-d', strtotime($data['birthdate'])); $this->query("INSERT INTO PREFIX_customer\n SET store_id = :store_id,\n firstname = :firstname,\n middlename = :middlename,\n lastname = :lastname,\n birthdate = :birthdate,\n email = :email,\n telephone = :telephone,\n mobile = :mobile,\n gender = :gender,\n fax = :fax,\n salt = :salt,\n password = :password,\n newsletter = :newsletter,\n customer_group_id = :group_id,\n language_id = :language_id,\n ip = :ip,\n status = 1,\n approved = :approval,\n date_added = :date", array('store_id' => $this->config->get('store_id'), 'firstname' => $data['firstname'], 'middlename' => $data['middlename'], 'lastname' => $data['lastname'], 'birthdate' => $data['birthdate'], 'email' => $data['email'], 'telephone' => $data['telephone'], 'mobile' => $data['mobile'], 'gender' => $data['gender'], 'fax' => $data['fax'], 'salt' => $salt, 'password' => sha1($salt . sha1($salt . sha1($data['password']))), 'newsletter' => $data['newsletter'], 'ip' => $this->request->server['REMOTE_ADDR'], 'group_id' => $data['customer_group_id'], 'language_id' => $this->config->get('language_id'), 'approval' => !$group_info['approval'], 'date' => date('Y-m-d H:i:s'))); $customer_id = $this->lastInsertId(); if (!$customer_id) { Logger::error('[ACCOUNT/CUSTOMER] The customer could not be created'); Logger::error(print_r(self::$connection->errorInfo(), true)); return false; } $this->query("INSERT INTO PREFIX_address\n SET customer_id = :id,\n firstname = :firstname,\n middlename = :middlename,\n lastname = :lastname,\n company = :company,\n company_id = :cid,\n tax_id = :tax,\n address_1 = :address_1,\n number = :number,\n addon = :addon,\n address_2 = :address_2,\n postcode = :postcode,\n city = :city,\n country_id = :country_id,\n zone_id = :zone_id", array('id' => $customer_id, 'firstname' => $data['firstname'], 'middlename' => $data['middlename'], 'lastname' => $data['lastname'], 'company' => $data['company'], 'cid' => $data['company_id'], 'tax' => $data['tax_id'], 'address_1' => $data['address_1'], 'number' => $data['number'], 'addon' => $data['addon'], 'address_2' => $data['address_2'], 'postcode' => $data['postcode'], 'city' => $data['city'], 'country_id' => $data['country_id'], 'zone_id' => $data['zone_id'])); $address_id = $this->lastInsertId(); $this->query("UPDATE PREFIX_customer SET address_id = :aid WHERE customer_id = :cid", array('aid' => $address_id, 'cid' => $customer_id)); if ($group_info['approval']) { $message = Language::getVar('SUMO_ACCOUNT_WAIT_FOR_APPROVAL'); } else { $message = Language::getVar('SUMO_ACCOUNT_GO_TO_LOGIN', $this->url->link('account/login', '', 'SSL')); } Mailer::setCustomer($data); $template = Mailer::getTemplate('account_register'); $template['content'] = str_replace('{approvalOrLogin}', $message, $template['content']); Mail::setTo($data['email']); Mail::setSubject($template['title']); Mail::setHtml($template['content']); Mail::send(); if ($this->config->get('admin_notify_email')) { $sendTo = array($this->config->get('email')); $extra = $this->config->get('extra_notify_email'); if (!empty($extra)) { $extra = explode(',', $extra); foreach ($extra as $mail) { if (!empty($mail) && filter_var($mail, \FILTER_VALIDATE_EMAIL)) { $sendTo[] = $mail; } } } $template = Mailer::getTemplate('account_register_admin_notify'); if ($group_info['approval']) { $template['content'] = str_replace('{action}', Language::getVar('SUMO_ADMIN_ACTIVATE_ACCOUNT', $this->url->link('account/login')), $template['content']); } else { $template['content'] = str_replace('{action}', '', $template['content']); } foreach ($sendTo as $to) { Mail::setTo($to); Mail::setSubject($template['title']); Mail::setHtml($template['content']); Mail::send(); } } Cache::removeAll(); return $customer_id; }
protected function index($setting) { $this->data['heading_title'] = Language::getVar('SUMO_PRODUCT_BESTSELLER'); $this->load->model('catalog/product'); $this->load->model('tool/image'); if ($this->registry->get('builder')) { $this->data['settings'] = Cache::find('builder'); } $this->data['products'] = array(); $results = $this->model_catalog_product->getBestSellerProducts($setting['limit']); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']); } else { $image = false; } $swapimages = $this->model_catalog_product->getProductImages($result['product_id']); if ($swapimages) { $swapimage = $this->model_tool_image->resize($swapimages[0]['image'], $this->config->get('config_image_related_width'), $this->config->get('config_image_related_height'), 'h'); } else { $swapimage = false; } if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))); } else { $price = false; } if ((double) $result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'))); } else { $special = false; } if ($this->config->get('config_review_status')) { $rating = $result['rating']; } else { $rating = false; } if ($result['reviews']) { if ($result['reviews'] > 1) { $reviews = Language::getVar('SUMO_PRODUCT_REVIEWS_PLURAL', $result['reviews']); } else { $reviews = Language::getVar('SUMO_PRODUCT_REVIEWS_SINGULAR'); } } else { $reviews = Language::getVar('SUMO_PRODUCT_REVIEWS_NONE'); } $this->data['products'][] = array('product_id' => $result['product_id'], 'thumb' => $image, 'thumb_swap' => $swapimage, 'name' => $result['name'], 'price' => $price, 'special' => $special, 'rating' => $rating, 'reviews' => $reviews, 'href' => $this->url->link('product/product', 'path=' . $result['category_id'] . '&product_id=' . $result['product_id'])); } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/bestseller.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/bestseller.tpl'; } else { $this->template = 'default/template/module/bestseller.tpl'; } if (count($this->data['products'])) { $this->render(); } }
protected function index($setting) { $this->data['heading_title'] = Language::getVar('SUMO_PRODUCT_FEATURED'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $this->data['products'] = array(); $products = explode(',', $this->config->get('featured_product')); if (empty($setting['limit'])) { $setting['limit'] = 5; } $this->data['products'] = array(); //$products = array_slice($products, 0, (int)$setting['limit']); $i = 0; foreach ($products as $nr => $product_id) { $product_info = $this->model_catalog_product->getProduct($product_id); if ($product_info && $i++ <= (int) $setting['limit']) { if ($product_info['image']) { $image = $this->model_tool_image->resize($product_info['image'], $setting['image_width'], $setting['image_height']); } else { $image = false; } if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))); } else { $price = false; } if ((double) $product_info['special']) { $special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax'))); } else { $special = false; } if ($this->config->get('config_review_status')) { $rating = $product_info['rating']; } else { $rating = false; } if ($result['reviews']) { if ($result['reviews'] > 1) { $reviews = Language::getVar('SUMO_PRODUCT_REVIEWS_PLURAL', $result['reviews']); } else { $reviews = Language::getVar('SUMO_PRODUCT_REVIEWS_SINGULAR'); } } else { $reviews = Language::getVar('SUMO_PRODUCT_REVIEWS_NONE'); } $this->data['products'][] = array('product_id' => $product_info['product_id'], 'thumb' => $image, 'name' => $product_info['name'], 'price' => $price, 'special' => $special, 'rating' => $rating, 'reviews' => $reviews, 'href' => $this->url->link('product/product', 'path=' . $result['category_id'] . '&product_id=' . $result['product_id'])); } } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/featured.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/featured.tpl'; } else { $this->template = 'default/template/module/featured.tpl'; } if (count($this->data['products'])) { $this->render(); } }
public function index() { $this->document->setTitle(Language::getVar('SUMO_ERROR_NOT_FOUND_TITLE')); $this->data['heading_title'] = Language::getVar('SUMO_ERROR_NOT_FOUND_TITLE'); $this->data['text_not_found'] = Language::getVar('SUMO_ERROR_NOT_FOUND_CONTENT'); $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ERROR_NOT_FOUND_TITLE'))); $this->template = 'error/not_found.tpl'; $this->children = array('common/header', 'common/footer'); $this->response->setOutput($this->render()); }
public function index() { $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . '/1.1 404 Not Found'); $this->document->setTitle(Language::getVar('SUMO_ERROR_NOT_FOUND_TITLE')); $this->data['title'] = Language::getVar('SUMO_ERROR_NOT_FOUND_TITLE'); $this->data['content'] = Language::getVar('SUMO_ERROR_NOT_FOUND_CONTENT'); $this->data['continue'] = $this->url->link('common/home'); $this->template = 'error/not_found.tpl'; $this->children = array('common/footer', 'common/header'); $this->response->setOutput($this->render()); }
protected function validate() { $cookie = isset($_POST['remember']) && $_POST['remember'] == 'on' ? 1 : 0; if (isset($this->request->post['username']) && isset($this->request->post['password']) && !$this->user->login($this->request->post['username'], $this->request->post['password'], $cookie)) { $this->error['warning'] = Language::getVar('SUMO_ADMIN_LOGIN_ERROR'); } if (!$this->error) { return true; } return false; }
public function info() { $this->document->setTitle(Language::getVar('SUMO_MAINTENANCE_TITLE')); $this->data['title'] = Language::getVar('SUMO_MAINTENANCE_TITLE'); $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_MAINTENANCE_TITLE'), 'href' => $this->url->link('common/maintenance')); $this->data['debug'] = false; $this->template = 'error/not_found.tpl'; $this->children = array('common/footer', 'common/header'); $this->response->setOutput($this->render()); }
protected function validate() { if (!isset($this->request->post['email']) || empty($this->request->post['email']) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) { $this->error['warning'] = Language::getVar('SUMO_ERROR_MAIL_NOT_KNOWN'); } elseif (!$this->model_user_user->getTotalUsersByEmail($this->request->post['email'])) { $this->error['warning'] = Language::getVar('SUMO_ERROR_MAIL_NOT_KNOWN'); } if (!$this->error) { return true; } return false; }
public function getTotal(&$total_data, &$total, &$taxes) { $this->language->load('total/sub_total'); $sub_total = $this->cart->getSubTotal(); if (isset($this->session->data['vouchers']) && $this->session->data['vouchers']) { foreach ($this->session->data['vouchers'] as $voucher) { $sub_total += $voucher['amount']; } } $total_data[] = array('code' => 'sub_total', 'title' => Language::getVar('SUMO_CHECKOUT_SUB_TOTAL'), 'text' => $this->currency->format($sub_total), 'value' => $sub_total, 'sort_order' => $this->config->get('sub_total_sort_order')); $total += $sub_total; }
protected function validate() { if (!isset($this->request->post['email']) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) { $this->error['warning'] = Language::getVar('SUMO_NOUN_ERROR_FORGOTTEN'); } elseif (!$this->model_account_customer->getTotalCustomersByEmail($this->request->post['email'])) { $this->error['warning'] = Language::getVar('SUMO_NOUN_ERROR_FORGOTTEN'); } if (!$this->error) { return true; } return false; }
protected function validate() { if (utf8_strlen($this->request->post['password']) < 4 || utf8_strlen($this->request->post['password']) > 20) { $this->error = Language::getVar('SUMO_ERROR_PASSWORD'); } elseif ($this->request->post['confirm'] != $this->request->post['password']) { $this->error = Language::getVar('SUMO_ERROR_PASSWORD_CONFIRM'); } if (!$this->error) { return true; } return false; }
public function info() { $this->load->model('catalog/manufacturer'); $this->load->model('tool/image'); $manufacturer_id = 0; if (!empty($this->request->get['manufacturer_id'])) { $manufacturer_id = $this->request->get['manufacturer_id']; } $data = $this->model_catalog_manufacturer->getManufacturer($manufacturer_id); if (!count($data)) { return $this->forward('product/manufucturer'); } $filter = ''; if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; } $sort = 'p.sort_order'; if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; } $order = 'ASC'; if (isset($this->request->get['order'])) { $order = $this->request->get['order']; } $page = 1; if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } $limit = 25; if (isset($this->request->get['limit'])) { $limit = $this->request->get['limit']; } $title = Language::getVar('SUMO_NOUN_MANUFACTURER_SINGULAR') . ': ' . $data['name']; $this->document->setTitle($title); $this->data['heading_title'] = $title; $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home')); $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_MANUFACTURER_PLURAL'), 'href' => $this->url->link('product/manufacturer')); $this->data['breadcrumbs'][] = array('text' => $title, 'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer_id)); $this->data['type'] = 'manufacturer'; $this->data['products_data'] = array('filter_manufacturer_id' => $manufacturer_id, 'type' => 'manufacturer', 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit); $this->data['settings'] = $this->config->get('details_product_category_' . $this->config->get('template')); if (!is_array($this->data['settings']) || !count($this->data['settings'])) { $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'manufacturerTree', 'data' => $this->data['products_data'])); $this->data['settings']['left'][] = $this->getChild('app/widgetsimpleproduct/', array('type' => 'filter', 'data' => $this->data['products_data'])); $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'banner', 'location' => 'category', 'data' => $this->data['products_data'])); //$this->data['settings']['bottom'][] = $this->getChild('app/widgetsimpleproduct', array('type' => 'latest', 'limit' => 6, 'manufacturer_id' => $manufacturer_id)); } $this->data['continue'] = $this->url->link(''); $this->template = 'product/category.tpl'; $this->children = array('common/footer', 'common/header'); $this->response->setOutput($this->render()); }
public function index() { if (!$this->customer->isLogged()) { $this->session->data['redirect'] = $this->url->link('account/download', '', 'SSL'); $this->redirect($this->url->link('account/login', '', 'SSL')); } $this->document->setTitle(Language::getVar('SUMO_DOWNLOAD_TITLE')); $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false); $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL')); $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_DOWNLOAD_TITLE'), 'href' => $this->url->link('account/download', '', 'SSL')); $this->load->model('account/download'); $totalDownloads = $this->model_account_download->getTotalDownloads(); if ($totalDownloads) { if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } $this->data['downloads'] = array(); $results = $this->model_account_download->getDownloads(($page - 1) * $this->config->get('catalog_limit'), $this->config->get('catalog_limit')); foreach ($results as $result) { if (file_exists(DIR_DOWNLOAD . $result['filename'])) { $size = filesize(DIR_DOWNLOAD . $result['filename']); $i = 0; $suffix = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); while ($size / 1024 > 1) { $size = $size / 1024; $i++; } $this->data['downloads'][] = array('order_id' => str_pad($result['order_id'], 6, 0, STR_PAD_LEFT), 'date' => Formatter::date($result['order_date']), 'name' => $result['name'], 'remaining' => $result['remaining'], 'size' => round(substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i], 'download' => $this->url->link('account/download/download', 'order_download_id=' . $result['order_download_id'], 'SSL')); } } $pagination = new Pagination(); $pagination->total = $totalDownloads; $pagination->page = $page; $pagination->limit = $this->config->get('config_catalog_limit'); $pagination->url = $this->url->link('account/download', 'page={page}', 'SSL'); $this->data['pagination'] = $pagination->render(); $this->data['continue'] = $this->url->link('account/account', '', 'SSL'); } else { $this->data['downloads'] = $this->data['pagination'] = false; } $this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template')); if (!is_array($this->data['settings']) || !count($this->data['settings'])) { $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array())); } $this->template = 'account/download.tpl'; $this->children = array('common/footer', 'common/header'); $this->response->setOutput($this->render()); }
public function index() { $this->load->model('catalog/information'); $this->data['type'] = 'blog'; $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home')); $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_BLOG_TITLE'), 'href' => $this->url->link('information/blog')); $this->data['settings'] = $this->config->get('details_information_information_' . $this->config->get('template')); if (!is_array($this->data['settings']) || !count($this->data['settings'])) { $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'blogTree', 'data' => $information_info)); $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'usp', 'location' => 'information')); $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'banner', 'location' => 'information', 'data' => $information_info)); $this->data['settings']['bottom'][] = $this->getChild('app/widgetsimpleproduct/', array('type' => 'latest', 'limit' => 6)); } // Blog specific if (isset($this->request->get['blog_id'])) { $blog_id = (int) $this->request->get['blog_id']; $blog_info = $this->model_catalog_information->getBlog($blog_id); if ($blog_info) { $this->document->setTitle($blog_info['title']); $this->data['breadcrumbs'][] = array('text' => $blog_info['title'], 'href' => $this->url->link('information/blog', 'blog_id=' . $blog_id)); $this->data['heading_title'] = $blog_info['title']; $this->data['button_back'] = Language::getVar('BUTTON_BACK'); $this->data['description'] = html_entity_decode($blog_info['text'], ENT_QUOTES, 'UTF-8'); $this->data['blog_info'] = $blog_info; $this->data['back'] = $this->url->link('blog'); $this->template = 'information/content.tpl'; $this->children = array('common/footer', 'common/header'); $this->response->setOutput($this->render()); } else { $this->forward($this->url->link('information/blog')); } } else { $this->document->setTitle(Language::getVar('SUMO_NOUN_BLOG_TITLE')); $this->data['heading_title'] = Language::getVar('SUMO_NOUN_BLOG_TITLE'); $this->data['no_results'] = Language::getVar('SUMO_NOUN_BLOG_NONE'); $this->data['blogs'] = array(); $blogs = $this->model_catalog_information->getBlogs(); foreach ($blogs as $list) { $list['link'] = $this->url->link('information/blog', 'blog_id=' . $list['blog_id']); $list['intro_text'] = html_entity_decode($list['intro_text'], ENT_QUOTES, 'UTF-8'); $list['text'] = html_entity_decode($list['text'], ENT_QUOTES, 'UTF-8'); $this->data['blogs'][] = $list; } $this->template = 'information/blog_list.tpl'; $this->children = array('common/footer', 'common/header'); $this->response->setOutput($this->render()); } }
public function editor() { $this->load->model('cms/cms'); $this->load->model('localisation/language'); if (empty($this->request->get['type']) || !in_array($this->request->get['type'], array('blog', 'information')) || !isset($this->request->get['store_id']) || !is_numeric($this->request->get['store_id'])) { $this->redirect($this->url->link('cms/cms', '', 'SSL')); } $data = array(); if (!empty($this->request->get['id'])) { $data = $this->model_cms_cms->getEditorItem($this->request->get['type'], $this->request->get['id']); if (!is_array($data) || !count($data)) { $this->redirect($this->url->link('cms/cms' . ($this->request->get['type'] == 'blog' ? '/blog' : ''), 'store_id=' . $this->request->get['store_id'], 'SSL')); } } if ($this->request->server['REQUEST_METHOD'] == 'POST') { if ($this->request->get['type'] == 'information') { $id = $this->model_cms_cms->saveInformation($this->request->get['store_id'], $this->request->post, !empty($this->request->get['id']) ? $this->request->get['id'] : 0); if (empty($this->request->get['id'])) { $this->request->get['id'] = $id; } } else { $id = $this->model_cms_cms->saveBlog($this->request->get['store_id'], $this->request->post, !empty($this->request->get['id']) ? $this->request->get['id'] : 0); if (empty($this->request->get['id'])) { $this->request->get['id'] = $id; } } if ($this->request->post['save_and_quit']) { $this->redirect($this->url->link('cms/cms' . ($this->request->get['type'] == 'blog' ? '/blog' : ''), 'store_id=' . $this->request->get['store_id'], 'SSL')); } else { $this->redirect($this->url->link('cms/cms/editor', 'type=' . $this->request->get['type'] . '&store_id=' . $this->request->get['store_id'] . '&id=' . $this->request->get['id'], 'SSL')); } } $title = Language::getVar('SUMO_ADMIN_CMS_EDITOR_' . strtoupper($this->request->get['type']) . '_' . (count($data) ? 'EDIT' : 'ADD')); $this->document->setTitle($title); $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_CMS_DASHBOARD'), 'href' => $this->url->link('cms/dashboard', '', 'SSL'))); $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_CMS_LIST_' . strtoupper($this->request->get['type'])), 'href' => $this->url->link('cms/cms' . ($this->request->get['type'] == 'blog' ? '/blog' : ''), 'store_id=' . $this->request->get['store_id'], 'SSL'))); $this->document->addBreadcrumbs(array('text' => $title)); $this->data['data'] = $data; $this->data['type'] = $this->request->get['type']; $this->data['title'] = $title; $this->data['languages'] = $this->model_localisation_language->getLanguages(); if ($this->data['type'] == 'information') { $this->data['parents'] = $this->model_cms_cms->getInformationParents($this->request->get['store_id']); } $this->setParent('cms/cms' . ($this->request->get['type'] == 'blog' ? '/blog' : '')); $this->template = 'cms/editor_' . strtolower($this->data['type'] . '.tpl'); $this->children = array('common/header', 'common/footer'); $this->response->setOutput($this->render()); }
protected function validate() { if (utf8_strlen($this->request->post['password']) < 4 || utf8_strlen($this->request->post['password']) > 20) { $this->error['password'] = Language::getVar('SUMO_NOUN_ERROR_PASSWORD'); } if ($this->request->post['confirm'] != $this->request->post['password']) { $this->error['confirm'] = Language::getVar('SUMO_NOUN_ERROR_PASSWORD_CONFIRM'); } if ($this->session->data['token'] != $this->request->get['token']) { $this->error['token'] = Language::getVar('SUMO_NOUN_ERROR_TOKEN'); } if (!$this->error) { return true; } return false; }
function getQuote($address) { $this->language->load('shipping/pickup'); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int) $this->config->get('pickup_geo_zone_id') . "' AND country_id = '" . (int) $address['country_id'] . "' AND (zone_id = '" . (int) $address['zone_id'] . "' OR zone_id = '0')"); if (!$this->config->get('pickup_geo_zone_id')) { $status = true; } elseif ($query->num_rows) { $status = true; } else { $status = false; } $method_data = array(); if ($status) { $quote_data = array(); $quote_data['pickup'] = array('code' => 'pickup.pickup', 'title' => Language::getVar('SUMO_SHIPPING_PICKUP_DESCRIPTION'), 'cost' => 0.0, 'tax_class_id' => 0, 'text' => $this->currency->format(0.0)); $method_data = array('code' => 'pickup', 'title' => Language::getVar('SUMO_SHIPPING_PICKUP_TITLE'), 'quote' => $quote_data, 'sort_order' => $this->config->get('pickup_sort_order'), 'error' => false); } return $method_data; }
public function backup() { if (!isset($this->request->post['backup'])) { $this->session->data['error'] = Language::getVar('SUMO_ERROR_BACKUP'); $this->redirect($this->url->link('tool/backup', 'token=' . $this->session->data['token'], 'SSL')); } elseif ($this->user->hasPermission('modify', 'tool/backup')) { $this->response->addheader('Pragma: public'); $this->response->addheader('Expires: 0'); $this->response->addheader('Content-Description: File Transfer'); $this->response->addheader('Content-Type: application/octet-stream'); $this->response->addheader('Content-Disposition: attachment; filename=sumostore_backup_' . date('Y-m-d_H-i-s', time()) . '.sql'); $this->response->addheader('Content-Transfer-Encoding: binary'); $this->load->model('tool/backup'); $this->response->setOutput($this->model_tool_backup->backup($this->request->post['backup'])); } else { $this->session->data['error'] = Language::getVar('SUMO_ERROR_NO_PERMISSION'); $this->redirect($this->url->link('tool/backup', 'token=' . $this->session->data['token'], 'SSL')); } }
public function index() { $title = Language::getVar('SUMO_ADMIN_TOOL_CACHE_TITLE'); $this->document->setTitle($title); $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SETTINGS_DASHBOARD'), 'href' => $this->url->link('settings/dashboard', '', 'SSL'))); $this->document->addBreadcrumbs(array('text' => $title)); $data = array(); $data['count'] = $data['size'] = $data['results'] = 0; $files = glob(DIR_CACHE . 'cache.*'); if (is_array($files)) { foreach ($files as $file) { $data['count']++; $data['size'] += filesize($file); $contents = file_get_contents($file); $test = json_decode(base64_decode($contents), true); if (is_array($test) && count($test)) { $data['results'] += count($test); } unset($contents); unset($test); } } unset($files); $files = $this->scan(DIR_IMAGE . 'cache/*', array()); $check = array(); if (is_array($files)) { foreach ($files as $file) { if (!isset($check[$file])) { $data['count']++; $data['size'] += filesize($file); $check[$file] = true; } } } unset($check); unset($files); $this->data['file_count'] = number_format($data['count'], 0, '.', '.'); $this->data['file_size'] = Formatter::bytes($data['size']); $this->data['objects'] = number_format($data['results'], 0, '.', '.'); $this->template = 'tool/cache.tpl'; $this->children = array('common/header', 'common/footer'); $this->response->setOutput($this->render()); }
public function format($number, $currency = '', $value = '', $format = true) { if ($currency && $this->has($currency)) { $symbol_left = $this->currencies[$currency]['symbol_left']; $symbol_right = $this->currencies[$currency]['symbol_right']; $decimal_place = $this->currencies[$currency]['decimal_place']; } else { $symbol_left = $this->currencies[$this->id]['symbol_left']; $symbol_right = $this->currencies[$this->id]['symbol_right']; $decimal_place = $this->currencies[$this->id]['decimal_place']; $currency = $this->id; } if ($value) { $value = $value; } else { $value = $this->currencies[$currency]['value']; } if ($value) { $value = (double) $number * $value; } else { $value = $number; } $string = ''; if ($symbol_left && $format) { $string .= $symbol_left; } if ($format) { $decimal_point = Language::getVar('SUMO_CURRENCY_DECIMAL_POINT'); } else { $decimal_point = ','; } if ($format) { $thousand_point = Language::getVar('SUMO_CURRENCY_THOUSAND_POINT'); } else { $thousand_point = '.'; } $string .= number_format(round($value, (int) $decimal_place), (int) $decimal_place, $decimal_point, $thousand_point); if ($symbol_right && $format) { $string .= $symbol_right; } return $string; }
public function index() { $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_CATALOG_DASHBOARD'), 'href' => $this->url->link('catalog/dashboard'))); $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_CATALOG_IMPORT_EXPORT'))); $this->document->setTitle(Language::getVar('SUMO_ADMIN_CATALOG_IMPORT_EXPORT')); $this->load->model('catalog/data'); $this->data = array_merge($this->data, array('fields' => $this->sqlFields)); if ($this->request->server['REQUEST_METHOD'] == 'POST' && ($data = $this->validateForm()) !== false) { $products = $this->model_catalog_data->getProducts($data); // Assemble CSV if (!empty($products)) { $this->assembleCSV($products, $data); return; } } $this->template = 'catalog/export.tpl'; $this->children = array('common/header', 'common/footer'); $this->document->addStyle('view/css/pages/data.css'); $this->document->addScript('view/js/pages/data.js'); $this->response->setOutput($this->render()); }
protected function index() { $this->language->load('module/account'); $this->data['heading_title'] = Language::getVar('SUMO_ACCOUNT_TITLE'); $this->data['text_register'] = Language::getVar('SUMO_ACCOUNT_REGISTER_TITLE'); $this->data['text_login'] = Language::getVar('SUMO_ACCOUNT_LOGIN_TITLE'); $this->data['text_logout'] = Language::getVar('SUMO_ACCOUNT_LOGOUT_TITLE'); $this->data['text_forgotten'] = Language::getVar('SUMO_ACCOUNT_FORGOTTEN_TITLE'); $this->data['text_account'] = Language::getVar('SUMO_ACCOUNT_TITLE'); $this->data['text_edit'] = $this->language->get('text_edit'); $this->data['text_password'] = $this->language->get('text_password'); $this->data['text_address'] = $this->language->get('text_address'); $this->data['text_wishlist'] = $this->language->get('text_wishlist'); $this->data['text_order'] = $this->language->get('text_order'); $this->data['text_download'] = $this->language->get('text_download'); $this->data['text_return'] = $this->language->get('text_return'); $this->data['text_transaction'] = $this->language->get('text_transaction'); $this->data['text_newsletter'] = $this->language->get('text_newsletter'); $this->data['logged'] = $this->customer->isLogged(); $this->data['register'] = $this->url->link('account/register', '', 'SSL'); $this->data['login'] = $this->url->link('account/login', '', 'SSL'); $this->data['logout'] = $this->url->link('account/logout', '', 'SSL'); $this->data['forgotten'] = $this->url->link('account/forgotten', '', 'SSL'); $this->data['account'] = $this->url->link('account/account', '', 'SSL'); $this->data['edit'] = $this->url->link('account/edit', '', 'SSL'); $this->data['password'] = $this->url->link('account/password', '', 'SSL'); $this->data['address'] = $this->url->link('account/address', '', 'SSL'); $this->data['wishlist'] = $this->url->link('account/wishlist'); $this->data['order'] = $this->url->link('account/order', '', 'SSL'); $this->data['download'] = $this->url->link('account/download', '', 'SSL'); $this->data['return'] = $this->url->link('account/return', '', 'SSL'); $this->data['transaction'] = $this->url->link('account/transaction', '', 'SSL'); $this->data['newsletter'] = $this->url->link('account/newsletter', '', 'SSL'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/account.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/account.tpl'; } else { $this->template = 'default/template/module/account.tpl'; } $this->render(); }
public function getQuote($address) { $this->language->load('shipping/weight'); $quote_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "geo_zone ORDER BY name"); foreach ($query->rows as $result) { if ($this->config->get('weight_' . $result['geo_zone_id'] . '_status')) { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int) $result['geo_zone_id'] . "' AND country_id = '" . (int) $address['country_id'] . "' AND (zone_id = '" . (int) $address['zone_id'] . "' OR zone_id = '0')"); if ($query->num_rows) { $status = true; } else { $status = false; } } else { $status = false; } if ($status) { $cost = ''; $weight = $this->cart->getWeight(); $rates = explode(',', $this->config->get('weight_' . $result['geo_zone_id'] . '_rate')); foreach ($rates as $rate) { $data = explode(':', $rate); if ($data[0] >= $weight) { if (isset($data[1])) { $cost = $data[1]; } break; } } if ((string) $cost != '') { $quote_data['weight_' . $result['geo_zone_id']] = array('code' => 'weight.weight_' . $result['geo_zone_id'], 'title' => $result['name'] . ' (' . Language::getVar('SUMO_NOUN_WEIGHT') . ' ' . $this->weight->format($weight, $this->config->get('config_weight_class_id')) . ')', 'cost' => $cost, 'tax_class_id' => $this->config->get('weight_tax_class_id'), 'text' => $this->currency->format($this->tax->calculate($cost, $this->config->get('weight_tax_class_id'), $this->config->get('config_tax')))); } } } $method_data = array(); if ($quote_data) { $method_data = array('code' => 'weight', 'title' => Language::getVar('SUMO_SHIPPING_WEIGHT_TITLE'), 'quote' => $quote_data, 'sort_order' => $this->config->get('weight_sort_order'), 'error' => false); } return $method_data; }