public function ajax() { $return = array(); $return['response'] = false; $check = !empty($this->request->post['check']) ? $this->request->post['check'] : false; $key = !empty($this->request->post['key']) ? $this->request->post['key'] : ''; $id = !empty($this->request->post['id']) ? $this->request->post['id'] : ''; switch ($check) { case 'validate-api': case 'payment-options': if (empty($id) || strlen($id) <= 6) { $return['message'] = Sumo\Language::getVar('APP_SISOW_ERROR_ID'); } if (empty($key) || strlen($key) != 40) { $return['message'] = Sumo\Language::getVar('APP_SISOW_ERROR_KEY'); } if (count($return) == 1) { $this->load->appModel('Api'); $this->sisow_model_api->setMerchant($id, $key); $response = $this->sisow_model_api->callMethods(); if (isset($response['error'])) { $return['message'] = $response['error']['errorcode'] . ': ' . $response['error']['errormessage']; } else { $return['response'] = true; $return['options'] = $response['merchant']['payments']; } } break; } $this->response->setOutput(json_encode($return)); }
public function index() { $this->document->setTitle(Sumo\Language::getVar('APP_PAYMENTPICKUP_TITLE')); $this->document->addBreadcrumbs(array('href' => $this->url->link('common/apps', '', 'SSL'), 'text' => Sumo\Language::getVar('SUMO_ADMIN_APPS_DASHBOARD'))); $this->document->addBreadcrumbs(array('text' => Sumo\Language::getVar('APP_PAYMENTPICKUP_TITLE'))); $this->data['stores'] = $this->model_settings_stores->getStores(); $this->data['current_store'] = isset($this->request->get['store_id']) ? $this->request->get['store_id'] : 0; $this->load->model('localisation/language'); $this->data['languages'] = $this->model_localisation_language->getLanguages(); $this->load->model('localisation/order_status'); $this->data['statusses'] = $this->model_localisation_order_status->getOrderStatuses(); $this->load->appModel('Settings'); if ($this->request->server['REQUEST_METHOD'] == 'POST') { $this->paymentpickup_model_settings->setSettings($this->data['current_store'], $this->request->post['settings']); $this->redirect($this->url->link('app/paymentpickup', '', 'SSL')); } $this->data['settings'] = $this->paymentpickup_model_settings->getSettings($this->data['current_store']); /* If required; geo_zone setup to enable/disable different geo_zones or different rates $this->load->model('localisation/geo_zone'); $this->data['zones'] = $this->model_localisation_geo_zone->getGeoZones(); $this->data['geo_zone_id'] = isset($this->request->get['geo_zone_id']) ? $this->request->get['geo_zone_id'] : $this->config->get('zone_id'); */ /* If required; fetch the tax_percentage for the selected store $this->load->model('settings/stores'); $this->data['tax'] = $this->model_settings_stores->getSettings($this->data['current_store'], 'tax_percentage'); if (!is_array($this->data['tax']) || !count($this->data['tax']) || !isset($this->data['tax']['default'])) { $this->data['tax'] = $this->model_settings_general->getSetting('tax_percentage'); } */ $this->template = 'index.tpl'; $this->children = array('common/header', 'common/footer'); $this->response->setOutput($this->render()); }
public function sendBatchMail() { $json = array(); $store = $this->model_settings_stores->getStore(isset($this->request->post['store_id']) ? (int) $this->request->post['store_id'] : 0); $page = 1; if (isset($this->request->get['page'])) { $page = (int) $this->request->get['page']; } $this->request->post['start'] = ($page - 1) * 10; $this->request->post['limit'] = 10; $emails = $this->getData(); if (count($emails)) { $json['next'] = str_replace('&', '&', $this->url->link('app/newsletterbasic/sendbatchmail', 'token=' . $this->session->data['token'] . '&page=' . ($page + 1), 'SSL')); $json['success'] = Sumo\Language::getVar('APP_NEWSLETTERBASIC_BATCH_EMAILS_SENT', $page); $mail = $this->request->post['mail']; foreach ($emails as $data) { $language = $this->config->get('language_id'); if (isset($data['language_id']) && !empty($data['language_id'])) { $language = (int) $data['language_id']; } $data['name'] = $store['name']; $data['url'] = 'http://' . rtrim($store['base_http'], '/') . '/'; $this->sendMail($data, $mail[$language]['subject'], html_entity_decode($mail[$language]['message']) . '<!-- Email send with SumoStore, leading E-commerce software -->'); } } else { $json['next'] = ''; $json['success'] = Sumo\Language::getVar('APP_NEWSLETTERBASIC_ALL_EMAILS_SENT'); } $json['debug'] = $this->request->post; $json['debug_get'] = $this->request->get; $this->response->setOutput(json_encode($json)); }
public function index() { $this->document->setTitle(Sumo\Language::getVar('APP_MULTISAFEPAY_TITLE')); $this->document->addBreadcrumbs(array('href' => $this->url->link('common/apps', '', 'SSL'), 'text' => Sumo\Language::getVar('SUMO_ADMIN_APPS_DASHBOARD'))); $this->document->addBreadcrumbs(array('text' => Sumo\Language::getVar('APP_MULTISAFEPAY_TITLE'))); $this->data['stores'] = $this->model_settings_stores->getStores(); $this->data['current_store'] = isset($this->request->get['store_id']) ? $this->request->get['store_id'] : 0; $this->load->model('localisation/language'); $this->data['languages'] = $this->model_localisation_language->getLanguages(); $this->load->model('localisation/order_status'); $this->data['statusses'] = $this->model_localisation_order_status->getOrderStatuses(); $this->data['link_msp'] = 'http://www.multisafepay.com/en/'; $this->load->appModel('Settings'); $this->load->appModel('Api'); if ($this->request->server['REQUEST_METHOD'] == 'POST') { $this->multisafepay_model_settings->setSettings($this->data['current_store'], $this->request->post['settings']); //$this->redirect($this->url->link('app/multisafepay', '', 'SSL')); } $this->data['settings'] = $this->multisafepay_model_settings->getSettings($this->data['current_store']); $this->load->model('localisation/geo_zone'); $this->data['zones'] = $this->model_localisation_geo_zone->getGeoZones(); $this->data['geo_zone_id'] = isset($this->request->get['geo_zone_id']) ? $this->request->get['geo_zone_id'] : $this->config->get('zone_id'); $this->data['tax'] = $this->model_settings_stores->getSettings($this->data['current_store'], 'tax_percentage'); if (!is_array($this->data['tax']) || !count($this->data['tax']) || !isset($this->data['tax']['default'])) { $this->data['tax'] = $this->model_settings_general->getSetting('tax_percentage'); } $this->document->addScript('../apps/multisafepay/admin/view/js/multisafepay.js'); $this->template = 'index.tpl'; $this->children = array('common/header', 'common/footer'); $this->response->setOutput($this->render()); }
public function usp() { if (empty($this->request->get['store_id'])) { $this->request->get['store_id'] = 0; } $this->load->appModel('Usp'); $this->load->model('localisation/language'); $this->load->model('tool/image'); $this->document->setTitle(Sumo\Language::getVar('APP_WIDGET_SS_USP_PLURAL_EDIT')); $this->document->addScript('view/js/jquery/jquery.ajaxupload.js'); $this->document->addBreadcrumbs(array('href' => $this->url->link('common/apps', '', 'SSL'), 'text' => Sumo\Language::getVar('SUMO_ADMIN_APPS_DASHBOARD'))); $this->document->addBreadcrumbs(array('href' => $this->url->link('app/widgetsimplesidebar', '', 'SSL'), 'text' => Sumo\Language::getVar('APP_WIDGET_SS_TITLE'))); $this->document->addBreadcrumbs(array('text' => Sumo\Language::getVar('APP_WIDGET_SS_USP_PLURAL_EDIT'))); $this->data['stores'] = $this->model_settings_stores->getStores(); $this->data['current_store'] = $this->request->get['store_id']; $this->data['languages'] = $this->model_localisation_language->getLanguages(); $this->data['usps'] = array(); $usps = $this->widgetsimplesidebar_model_usp->getUsps($this->request->get['store_id']); foreach ($usps as $id => $list) { if (!empty($list['image'])) { $list['image'] = $this->model_tool_image->resize($list['image'], 60, 60); } else { $list['image'] = 'niet-gevonden'; unset($list['image']); } $this->data['usps'][$id] = $list; } $this->template = 'usp.tpl'; $this->children = array('common/header', 'common/footer'); $this->response->setOutput($this->render()); }
public function index() { $this->document->setTitle(Sumo\Language::getVar('APP_SHIPPINGWEIGHT_TITLE')); $this->document->addBreadcrumbs(array('href' => $this->url->link('common/apps', '', 'SSL'), 'text' => Sumo\Language::getVar('SUMO_ADMIN_APPS_DASHBOARD'))); $this->document->addBreadcrumbs(array('text' => Sumo\Language::getVar('APP_SHIPPINGWEIGHT_TITLE'))); $this->data['stores'] = $this->model_settings_stores->getStores(); $this->data['current_store'] = isset($this->request->get['store_id']) ? $this->request->get['store_id'] : 0; $this->load->appModel('Settings'); if ($this->request->server['REQUEST_METHOD'] == 'POST') { $this->shippingweight_model_settings->setSettings($this->data['current_store'], $this->request->post['settings']); $this->redirect($this->url->link('app/shippingweight', '', 'SSL')); } $this->data['settings'] = $this->shippingweight_model_settings->getSettings($this->data['current_store']); $this->load->model('localisation/geo_zone'); $this->data['zones'] = $this->model_localisation_geo_zone->getGeoZones(); $this->data['geo_zone_id'] = isset($this->request->get['geo_zone_id']) ? $this->request->get['geo_zone_id'] : $this->config->get('zone_id'); $this->load->model('settings/stores'); $this->data['tax'] = $this->model_settings_stores->getSettings($this->data['current_store'], 'tax_percentage'); if (!is_array($this->data['tax']) || !count($this->data['tax']) || !isset($this->data['tax']['default'])) { $this->data['tax'] = $this->model_settings_general->getSetting('tax_percentage'); } $this->template = 'index.tpl'; $this->children = array('common/header', 'common/footer'); $this->response->setOutput($this->render()); }
public function check() { $json = array(); $this->load->appModel('Settings'); if (isset($this->request->post['status'])) { $this->sumoguardbasic_model_settings->setStatus($this->request->post['status']); } $check = $this->sumoguardbasic_model_settings->enabled(); switch ($check) { case 0: $json['text'] = Sumo\Language::getVar('APP_SUMOGUARDBASIC_STATUS_INACTIVE'); $json['icon'] = 'fa-frown-o'; $json['class'] = 'has-warning'; break; case 1: $json['text'] = Sumo\Language::getVar('APP_SUMOGUARDBASIC_STATUS_ACTIVE'); $json['icon'] = 'fa-check'; $json['class'] = 'has-success'; break; case 2: $json['text'] = Sumo\Language::getVar('APP_SUMOGUARDBASIC_STATUS_NO_LICENSE_KEY'); $json['icon'] = 'fa-exclamation-circle'; $json['class'] = 'has-warning'; break; case 3: $json['text'] = Sumo\Language::getVar('APP_SUMOGUARDBASIC_STATUS_INVALID_LICENSE'); $json['icon'] = 'fa-exclamation-triangle'; $json['class'] = 'has-error'; break; } $this->response->setOutput(json_encode($json)); }
public function paymentpickup() { $this->load->model('checkout/order'); $this->load->appModel('Settings'); $settings = $this->paymentpickup_model_settings->getSettings($this->config->get('store_id')); if (!empty($settings['payment']['status'])) { $this->model_checkout_order->updateStatus($this->session->data['order_id'], $settings['payment']['status']); } $this->session->data['success'] = Sumo\Language::getVar('SUMO_CHECKOUT_SUCCESS_MESSAGE'); $data = json_encode(array('success' => true, 'location' => $this->url->link('checkout/success'))); $this->response->setOutput($data); }
public function blogTree($input) { $this->load->model('catalog/information'); $items = $this->model_catalog_information->getBlogs(array('limit' => 5, 'order' => 'b.publish_date')); $this->data['title'] = Sumo\Language::getVar('SUMO_NOUN_BLOG_TITLE'); $this->data['items'] = $items; if (isset($this->request->get['blog_id'])) { $this->data['item_id'] = $this->request->get['blog_id']; } $this->data['url'] = 'information/blog'; $this->data['type'] = 'blog_id'; $this->template = 'information_tree.tpl'; $this->output = $this->render(); }
public function index() { $this->document->setTitle(Sumo\Language::getVar('APP_SHIPPINGPICKUP_TITLE')); $this->document->addBreadcrumbs(array('href' => $this->url->link('common/apps', '', 'SSL'), 'text' => Sumo\Language::getVar('SUMO_ADMIN_APPS_DASHBOARD'))); $this->document->addBreadcrumbs(array('text' => Sumo\Language::getVar('APP_SHIPPINGPICKUP_TITLE'))); $this->document->addScript('view/js/jquery/jquery.parsley.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; $this->load->appModel('Settings'); if ($this->request->server['REQUEST_METHOD'] == 'POST') { $this->shippingpickup_model_settings->setSettings($this->data['current_store'], $this->request->post['settings']); //$this->redirect($this->url->link('app/shippingpickup', '', 'SSL')); } $this->data['settings'] = $this->shippingpickup_model_settings->getSettings($this->data['current_store']); $this->load->model('localisation/geo_zone'); $this->data['zones'] = $this->model_localisation_geo_zone->getGeoZones(); $this->data['geo_zone_id'] = isset($this->request->get['geo_zone_id']) ? $this->request->get['geo_zone_id'] : $this->config->get('zone_id'); $this->template = 'index.tpl'; $this->children = array('common/header', 'common/footer'); $this->response->setOutput($this->render()); }
private function updateStatus($transaction_id, $data) { $this->setupAPI(); $payment_id = $this->sisow_model_payments->getPaymentId($transaction_id); $this->sisow_model_payments->update($payment_id, $data); $order_id = $this->sisow_model_payments->getOrderId($transaction_id); if ($data['status'] == 'Success' || $data['status'] == 'Pending') { $message = Sumo\Language::getVar('APP_SISOW_CATALOG_SUCCESS_' . strtoupper($data['status'])); $amount = $data['amount'] / 100; $this->model_checkout_order->addTransaction($order_id, $amount, 'via Sisow, ' . $data['description']); } else { $message = Sumo\Language::getVar('APP_SISOW_CATALOG_ERROR_' . strtoupper($data['status'])); } $this->model_checkout_order->updateStatus($order_id, $this->settings['status'][strtolower($data['status'])], $message); return $data; }
public function checkSettings($store_id = 0) { // update 1.0.1; language string for sofort Sumo\Language::getVar('APP_MOLLIE_CATALOG_SOFORT_DESCRIPTION'); $check = self::query("SELECT value FROM PREFIX_translations WHERE key_id = (SELECT id FROM PREFIX_translations_keys WHERE name = 'APP_MOLLIE_CATALOG_SOFORT_DESCRIPTION') AND language_id = 1")->fetch(); if (empty($check['value'])) { self::query("INSERT INTO PREFIX_translations SET value = 'Betaal met SoFort banking', key_id = (SELECT id FROM PREFIX_translations_keys WHERE name = 'APP_MOLLIE_CATALOG_SOFORT_DESCRIPTION'), language_id =1"); } $data = $this->getSettings($store_id); if (!$data['enabled']) { return true; } unset($data['enabled']); if (empty($data['general']['api_key'])) { Sumo\Logger::warning('[Mollie] API Key is not set'); return false; } else { include 'api.php'; $test = new ModelApi($this->registry); try { $test->setKey($data['general']['api_key']); } catch (\Exception $e) { Sumo\Logger::warning('[Mollie] API Key is invalid'); return false; } try { $testData = $test->callMethods(); if (isset($testData['error'])) { Sumo\Logger::warning('[Mollie] API Key is invalid, error returned from Mollie: ' . Sumo\Language::getVar('APP_MOLLIE_ERROR_' . strtoupper($response['error']['type']))); return false; } else { if (!count($testData['data'])) { Sumo\Logger::warning('[Mollie] API Key is valid, but no payment options are available!'); return false; } else { $countDisabled = 0; foreach ($testData['data'] as $list) { if (!isset($data[$list['id']]['enabled']) || !$data[$list['id']]['enabled']) { $countDisabled++; } } if ($countDisabled == count($testData['data'])) { Sumo\Logger::warning('[Mollie] There are no payment options enabled'); return false; } } } } catch (\Exception $e) { Sumo\Logger::warning('[Mollie] Unknown API error occured'); return false; } } if (!isset($data['tax'])) { Sumo\Logger::warning('[Mollie] Tax is not set'); return false; } if (empty($data['instructions'][$this->config->get('language_id')])) { Sumo\Logger::warning('[Mollie] Instructions for default language is not set'); return false; } unset($data['instructions']); if (!count($data)) { return false; } return true; }
public function ajax() { $return = array(); $return['response'] = false; $check = !empty($this->request->post['check']) ? $this->request->post['check'] : false; $key = !empty($this->request->post['key']) ? $this->request->post['key'] : ''; switch ($check) { case 'validate-api': case 'payment-options': if (!preg_match("!^(?:live|test)_\\w+\$!", $key)) { $return['response'] = false; $return['message'] = Sumo\Language::getVar('APP_MOLLIE_ERROR_INVALID_API_KEY'); } else { $this->load->appModel('Api'); $this->mollie_model_api->setKey($key); try { $response = $this->mollie_model_api->callMethods(); if (isset($response['error'])) { $return['response'] = false; $return['message'] = Sumo\Language::getVar('APP_MOLLIE_ERROR_' . strtoupper($response['error']['type'])); } else { $return['response'] = true; if ($check == 'payment-options') { $return['options'] = $response['data']; } } } catch (\Exception $e) { $return['response'] = false; $return['message'] = $e->getMessage(); } } break; case 'validate-discount': $username = $this->request->post['username']; $password = $this->request->post['password']; $errors = array(); if (empty($username)) { // code 20 $errors[] = Sumo\Language::getVar('APP_MOLLIE_ERROR_USERNAME_EMPTY'); } if (empty($password)) { // code 21 $errors[] = Sumo\Language::getVar('APP_MOLLIE_ERROR_PASSWORD_EMPTY'); } if (!count($errors)) { $this->load->appModel('Api'); $result = $this->mollie_model_api->addDiscount($username, $password); if ($result['resultcode'] == 10) { $return['response'] = true; $this->load->appModel('settings'); foreach ($this->model_settings_stores->getStores() as $list) { $this->mollie_model_settings->setSetting($list['store_id'], 'discount', 1); } } else { $return['response'] = false; $return['text'] = Sumo\Language::getVar('APP_MOLLIE_ERROR_RESELLER_CODE_' . $result['resultcode']); } } else { $return['response'] = false; $return['text'] = implode('<br />', $errors); } break; case 'ignore-discount': $this->load->appModel('Settings'); $this->load->appModel('settings'); foreach ($this->model_settings_stores->getStores() as $list) { $this->mollie_model_settings->setSetting($list['store_id'], 'discount', -1); } break; default: break; } $this->response->setOutput(json_encode($return)); }
private function updateStatus($transaction_id) { $this->setupAPI(); $data = $this->mollie_model_api->getStatus($transaction_id); $payment_id = $this->mollie_model_payments->getPaymentId($transaction_id); $this->mollie_model_payments->update($transaction_id, $data); $order_id = $this->mollie_model_payments->getOrderId($transaction_id); if ($data['status'] == 'paid' || $data['status'] == 'open') { $message = Sumo\Language::getVar('APP_MOLLIE_CATALOG_SUCCESS_' . strtoupper($data['status'])); $this->model_checkout_order->addTransaction($order_id, $data['amount'], 'via Mollie, ' . $data['description']); } else { $message = Sumo\Language::getVar('APP_MOLLIE_CATALOG_ERROR_' . strtoupper($data['status'])); } $this->model_checkout_order->updateStatus($order_id, $this->settings['status'][strtolower($data['status'])], $message); return $data; }
private function getSortAndLimits($search = false) { $url = ''; if (!$search) { if (isset($this->request->get['filter'])) { if (is_array($this->request->get['filter'])) { foreach ($this->request->get['filter'] as $key => $value) { $url .= '&filter[' . $key . ']=' . $value; } } else { $url .= '&filter=' . $this->request->get['filter']; } } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } 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['path'])) { $base = $this->url->link('product/category', 'path=' . $this->request->get['path']); } else { if (isset($this->request->get['manufacturer_id'])) { $base = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $this->request->get['manufacturer_id']); } } } else { if (isset($this->request->get['search'])) { $url .= '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['tag'])) { $url .= '&tag=' . urlencode(html_entity_decode($this->request->get['tag'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['description'])) { $url .= '&description=' . $this->request->get['description']; } if (isset($this->request->get['category_id'])) { $url .= '&category_id=' . $this->request->get['category_id']; } if (isset($this->request->get['sub_category'])) { $url .= '&sub_category=' . $this->request->get['sub_category']; } 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 (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $base = $this->url->link('product/search'); } $this->data['sorts'] = array(); $this->data['sorts'][] = array('text' => Sumo\Language::getVar('SUMO_CATEGORY_SORT_DEFAULT'), 'value' => 'p.sort_order-ASC', 'href' => $base . '&sort=p.sort_order&order=ASC' . $url); $this->data['sorts'][] = array('text' => Sumo\Language::getVar('SUMO_CATEGORY_SORT_NAME_ASC'), 'value' => 'pd.name-ASC', 'href' => $base . '&sort=pd.name&order=ASC' . $url); $this->data['sorts'][] = array('text' => Sumo\Language::getVar('SUMO_CATEGORY_SORT_NAME_DESC'), 'value' => 'pd.name-DESC', 'href' => $base . '&sort=pd.name&order=DESC' . $url); $this->data['sorts'][] = array('text' => Sumo\Language::getVar('SUMO_CATEGORY_SORT_PRICE_ASC'), 'value' => 'p.price-ASC', 'href' => $base . '&sort=p.price&order=ASC' . $url); $this->data['sorts'][] = array('text' => Sumo\Language::getVar('SUMO_CATEGORY_SORT_PRICE_DESC'), 'value' => 'p.price-DESC', 'href' => $base . '&sort=p.price&order=DESC' . $url); if ($this->config->get('config_review_status')) { $this->data['sorts'][] = array('text' => Sumo\Language::getVar('SUMO_CATEGORY_SORT_RATING_DESC'), 'value' => 'rating-DESC', 'href' => $base . '&sort=rating&order=DESC' . $url); $this->data['sorts'][] = array('text' => Sumo\Language::getVar('SUMO_CATEGORY_SORT_RATING_ASC'), 'value' => 'rating-ASC', 'href' => $base . '&sort=rating&order=ASC' . $url); } $this->data['sorts'][] = array('text' => Sumo\Language::getVar('SUMO_CATEGORY_SORT_MODEL_ASC'), 'value' => 'p.model-ASC', 'href' => $base . '&sort=p.model&order=ASC' . $url); $this->data['sorts'][] = array('text' => Sumo\Language::getVar('SUMO_CATEGORY_SORT_MODEL_DESC'), 'value' => 'p.model-DESC', 'href' => $base . '&sort=p.model&order=DESC' . $url); $this->data['limits'] = array(); $limits = array_unique(array($this->config->get('catalog_display_limit'), 12, 24, 36, 48, 96)); sort($limits); foreach ($limits as $limit) { if (empty($limit)) { continue; } $this->data['limits'][] = array('text' => Sumo\Language::getVar('SUMO_NOUN_DISPLAY_AMOUNT', $limit), 'value' => $limit, 'href' => $base . $url . '&limit=' . $limit); } }
protected function getList() { $this->document->addBreadcrumbs(array('text' => Sumo\Language::getVar('SUMO_ADMIN_CATALOG_DASHBOARD'), 'href' => $this->url->link('catalog/dashboard'))); $this->document->addBreadcrumbs(array('text' => Sumo\Language::getVar('SUMO_ADMIN_CATALOG_STOCK'))); $filter_keys = array('name', 'quantity_from', 'quantity_to', 'quantity', 'category', 'store'); $filter = array(); $url = ''; foreach ($filter_keys as $filter_key) { $filter[$filter_key] = isset($this->request->get[$filter_key]) ? $this->request->get[$filter_key] : ''; if ($filter[$filter_key] != '') { $url .= '&' . $filter_key . '=' . $filter[$filter_key]; } } // Limit? $limit = 25; if (isset($this->request->get['limit'])) { $limit = $this->request->get['limit']; } $page = 1; $start = 0; if (isset($this->request->get['page']) && $this->request->get['page'] > 0) { $page = (int) $this->request->get['page']; $start = ($page - 1) * $limit; } // We need this variable in all circumstances $this->data['products'] = array(); // Get product list $this->load->appModel('Inventory'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->inventory_model_inventory->getProducts(array_merge($filter, array('start' => $start, 'limit' => $limit))); $totalProducts = $this->inventory_model_inventory->getTotalProducts($filter); $totalProductsInView = $this->inventory_model_inventory->getTotalProductsInView($filter); foreach ($products as $k => $product) { $image = $this->model_tool_image->resize('no_image.jpg', 60, 60); if ($product['image'] && file_exists(DIR_IMAGE . $product['image'])) { $image = $this->model_tool_image->resize($product['image'], 60, 60); } $this->data['products'][] = array_merge($product, array('product_id' => $product['product_id'], 'stock_id' => $product['stock_id'], 'name' => $product['name'], 'model' => !empty($product['model_2']) ? $product['model_2'] : $product['model'], 'image' => $image, 'quantity' => $product['quantity'], 'price' => $product['price'], 'price_net' => $product['price'] + $product['price'] * $product['tax_percentage'] / 100, 'value' => $product['cost_price'], 'options' => $this->model_catalog_product->getProductOptions($product['product_id']), 'edit' => $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $product['product_id']))); } // The quantity filter is something a bit different $filter_quantity = $filter_quantity_type = ''; if (!empty($filter['quantity_from'])) { $filter_quantity = $filter['quantity_from']; $filter_quantity_type = 'quantity_from'; } elseif (!empty($filter['quantity_to'])) { $filter_quantity = $filter['quantity_to']; $filter_quantity_type = 'quantity_to'; } elseif (!empty($filter['quantity'])) { $filter_quantity = $filter['quantity']; $filter_quantity_type = 'quantity'; } // Get some stats $this->data = array_merge($this->data, array('filter_name' => $filter['name'], 'filter_category' => $filter['category'], 'filter_store' => $filter['store'], 'filter_quantity' => $filter_quantity, 'filter_quantity_type' => $filter_quantity_type, 'token' => $this->session->data['token'], 'limit' => $limit, 'token' => $this->session->data['token'], 'total_products' => $totalProducts, 'total_value' => Sumo\Formatter::currency($this->inventory_model_inventory->getTotalProductsValue($filter)), 'total_price' => Sumo\Formatter::currency($this->inventory_model_inventory->getTotalProductsPrice($filter)), 'url' => $this->url->link('app/inventory', 'token=' . $this->session->data['token'] . $url), 'reset' => $this->url->link('app/inventory', 'token=' . $this->session->data['token']), 'export' => $this->url->link('app/inventory/export', 'token=' . $this->session->data['token'] . $url))); // List some categories $categories = $this->inventory_model_inventory->getCategories(); foreach ($categories as $store_id => $store_categories) { foreach ($store_categories as $k => $category) { for ($i = 0; $i < $category['level'] * 4; $i++) { $categories[$store_id][$k]['name'] = ' ' . $categories[$store_id][$k]['name']; } } } // List some stores $this->load->model('settings/stores'); $stores = $this->model_settings_stores->getStores(); // Set pagination $pagination = new Sumo\Pagination(); $pagination->total = $totalProductsInView; $pagination->limit = $limit; $pagination->page = $page; $pagination->url = $this->url->link('app/inventory', 'token=' . $this->session->data['token'] . $url . '&page={page}&limit=' . $limit); $this->data['pagination'] = $pagination->renderAdmin(); $this->data['stores'] = $stores; $this->data['categories'] = isset($categories[$filter['store']]) ? $categories[$filter['store']] : array(); $this->data['json_categories'] = json_encode($categories); $this->document->addStyle('view/css/pages/product.css'); $this->document->addScript('../apps/inventory/admin/view/js/inventory.js'); $this->template = 'index.tpl'; $this->children = array('common/header', 'common/footer'); $this->response->setOutput($this->render()); }
public function banktransfer() { $this->load->model('checkout/order'); $this->load->appModel('Settings'); $settings = $this->banktransfer_model_settings->getSettings($this->config->get('store_id')); $instructions = $settings['instructions']; if (isset($instructions[$this->config->get('language_id')])) { $instructions = $instructions[$this->config->get('language_id')]; } else { $instructions = reset($instructions); } $instructions = nl2br(html_entity_decode($instructions)); if (!empty($settings['payment']['status'])) { $this->model_checkout_order->updateStatus($this->session->data['order_id'], $settings['payment']['status'], nl2br($instructions)); } $this->session->data['success'] = Sumo\Language::getVar('SUMO_CHECKOUT_SUCCESS_MESSAGE') . '<br />' . $instructions; $data = json_encode(array('success' => true, 'location' => $this->url->link('checkout/success'))); $this->response->setOutput($data); }