public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); if (has_value($this->request->get['customer_id']) && (int) $this->request->get['customer_id'] > 0 && has_value($this->request->get['email'])) { $this->loadModel('account/customer'); $customer = $this->model_account_customer->getCustomer((int) $this->request->get['customer_id']); //check is customer_id exists and compare his email with given if ($customer && $customer['email'] == $this->request->get['email']) { $this->model_account_customer->editNewsletter(0, (int) $this->request->get['customer_id']); } else { //othewise - redirect to index page $this->html->redirect($this->html->getSecureURL('index/home')); } } else { $this->html->redirect($this->html->getSecureURL('index/home')); } $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['text_message'] = $this->language->get('text_message'); $this->data['button_continue'] = $this->language->get('button_continue'); $this->data['continue'] = $this->html->getURL('index/home'); $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->data['continue_button'] = $continue; $this->view->batchAssign($this->data); $this->processTemplate('common/unsubscribe.tpl'); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); unset($this->session->data['success']); }
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'))); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/success'), 'text' => $this->language->get('text_success'), 'separator' => $this->language->get('text_separator'))); $this->view->assign('heading_title', $this->language->get('heading_title')); if ($this->config->get('config_customer_email_activation')) { $this->view->assign('text_message', sprintf($this->language->get('text_activate'), $this->config->get('store_name'), $this->html->getURL('content/contact'))); } elseif ($this->config->get('config_customer_approval')) { $this->view->assign('text_message', sprintf($this->language->get('text_approval'), $this->config->get('store_name'), $this->html->getURL('content/contact'))); } else { $this->view->assign('text_message', sprintf($this->language->get('text_message'), $this->html->getURL('content/contact'))); } $this->view->assign('button_continue', $this->language->get('button_continue')); if ($this->session->data['redirect']) { $this->view->assign('continue', $this->session->data['redirect']); unset($this->session->data['redirect']); } else { if ($this->cart->hasProducts()) { $this->view->assign('continue', $this->html->getURL('checkout/cart')); } else { $this->view->assign('continue', $this->html->getURL('account/account')); } } $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->view->assign('continue_button', $continue); $this->processTemplate('common/success.tpl'); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); unset($this->session->data['success']); }
public function main() { $this->loadLanguage('default_pp_pro_uk/default_pp_pro_uk'); $this->load->model('checkout/order'); $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']); $data['cc_owner'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_owner', 'value' => $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname'], 'style' => 'input-medium')); $data['cc_owner'] = $data['cc_owner']->getHtml(); $cards = array('Visa' => 'Visa', 'MasterCard' => 'MasterCard', 'Maestro' => 'Maestro'); $data['cc_type'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_type', 'value' => 0, 'options' => $cards, 'style' => 'short input-small')); $data['cc_number'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_number', 'value' => '', 'style' => 'input-medium')); $months = array(); for ($i = 1; $i <= 12; $i++) { $months[sprintf('%02d', $i)] = strftime('%B', mktime(0, 0, 0, $i, 1, 2000)); } $data['cc_expire_date_month'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_expire_date_month', 'value' => sprintf('%02d', date('m')), 'options' => $months, 'style' => 'short input-small')); $today = getdate(); $years = array(); for ($i = $today['year']; $i < $today['year'] + 11; $i++) { $years[strftime('%Y', mktime(0, 0, 0, 1, 1, $i))] = strftime('%Y', mktime(0, 0, 0, 1, 1, $i)); } $data['cc_expire_date_year'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_expire_date_year', 'value' => sprintf('%02d', date('Y') + 1), 'options' => $years, 'style' => 'short input-small')); $data['cc_start_date_month'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_start_date_month', 'value' => sprintf('%02d', date('m')), 'options' => $months, 'style' => 'short input-small')); $years = array(); for ($i = $today['year'] - 10; $i < $today['year'] + 2; $i++) { $years[strftime('%Y', mktime(0, 0, 0, 1, 1, $i))] = strftime('%Y', mktime(0, 0, 0, 1, 1, $i)); } $data['cc_start_date_year'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_start_date_year', 'value' => sprintf('%02d', date('Y')), 'options' => $years, 'style' => 'short input-small')); $data['cc_cvv2'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_cvv2', 'value' => '', 'style' => 'short', 'attr' => ' size="3" ')); $data['cc_issue'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_issue', 'value' => '', 'style' => 'short', 'attr' => ' size="1" ')); $back = $this->request->get['rt'] != 'checkout/guest_step_3' ? $this->html->getSecureURL('checkout/payment') : $this->html->getSecureURL('checkout/guest_step_2'); $data['back'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'style' => 'button', 'href' => $back)); $data['submit'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'paypal_button', 'text' => $this->language->get('button_confirm'), 'style' => 'button btn-orange')); $this->view->batchAssign($data); $this->processTemplate('responses/default_pp_pro_uk.tpl'); }
public function review() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->loadLanguage('product/product'); $this->loadModel('catalog/review'); $this->view->assign('text_no_reviews', $this->language->get('text_no_reviews')); if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } $reviews = array(); $results = $this->model_catalog_review->getReviewsByProductId($this->request->get['product_id'], ($page - 1) * 5, 5); foreach ($results as $result) { $reviews[] = array('author' => $result['author'], 'rating' => $result['rating'], 'text' => strip_tags($result['text']), 'stars' => sprintf($this->language->get('text_stars'), $result['rating']), 'date_added' => dateISO2Display($result['date_added'], $this->language->get('date_format_short'))); } $this->data['reviews'] = $reviews; $review_total = $this->model_catalog_review->getTotalReviewsByProductId($this->request->get['product_id']); $this->data['pagination_bootstrap'] = HtmlElementFactory::create(array('type' => 'Pagination', 'name' => 'pagination', 'text' => $this->language->get('text_pagination'), 'text_limit' => $this->language->get('text_per_page'), 'total' => $review_total, 'page' => $page, 'limit' => 5, 'url' => $this->html->getURL('product/review/review', '&product_id=' . $this->request->get['product_id'] . '&page={page}'), 'style' => 'pagination')); $this->view->batchAssign($this->data); $this->processTemplate('responses/product/review.tpl'); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); if (!$this->customer->isLogged()) { $this->session->data['redirect'] = $this->html->getSecureURL('account/newsletter'); $this->redirect($this->html->getSecureURL('account/login')); } $this->document->setTitle($this->language->get('heading_title')); if ($this->request->is_POST()) { $this->loadModel('account/customer'); $this->model_account_customer->editNewsletter($this->request->post['newsletter']); $this->session->data['success'] = $this->language->get('text_success'); $this->redirect($this->html->getURL('account/account')); } $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'))); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/newsletter'), 'text' => $this->language->get('text_newsletter'), 'separator' => $this->language->get('text_separator'))); $form = new AForm(); $form->setForm(array('form_name' => 'newsFrm')); $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'newsFrm', 'action' => $this->html->getSecureURL('account/newsletter'))); $this->data['form']['newsletter'] = $form->getFieldHtml(array('type' => 'radio', 'name' => 'newsletter', 'value' => $this->customer->getNewsletter(), 'options' => array('1' => $this->language->get('text_yes'), '0' => $this->language->get('text_no')))); $this->data['form']['continue'] = $form->getFieldHtml(array('type' => 'submit', 'icon' => 'fa fa-check', 'name' => $this->language->get('button_continue'))); $this->data['back'] = $this->html->getURL('account/account'); $back = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'icon' => 'fa fa-arrow-left', 'style' => 'button')); $this->data['form']['back'] = $back; $this->view->batchAssign($this->data); $this->processTemplate('pages/account/newsletter.tpl'); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); if (isset($this->session->data['order_id'])) { $amount = $this->session->data['used_balance']; // in default currency if ($amount) { $transaction_data = array('order_id' => (int) $this->session->data['order_id'], 'amount' => $amount, 'transaction_type' => 'order', 'created_by' => $this->customer->getId(), 'description' => sprintf($this->language->get('text_applied_balance_to_order'), $this->currency->format($this->currency->convert($amount, $this->config->get('config_currency'), $this->session->data['currency']), $this->session->data['currency'], 1), (int) $this->session->data['order_id'])); $this->customer->debitTransaction($transaction_data); } // google analytics data for js-script in footer.tpl $order = new AOrder($this->registry); $order_data = $order->buildOrderData($this->session->data); $order_tax = $order_total = $order_shipping = 0.0; foreach ($order_data['totals'] as $total) { if ($total['total_type'] == 'total') { $order_total += $total['value']; } elseif ($total['total_type'] == 'tax') { $order_tax += $total['value']; } elseif ($total['total_type'] == 'shipping') { $order_shipping += $total['value']; } } $this->registry->set('google_analytics_data', array('transaction_id' => (int) $this->session->data['order_id'], 'store_name' => $this->config->get('store_name'), 'currency_code' => $order_data['currency'], 'total' => $order_total, 'tax' => $order_tax, 'shipping' => $order_shipping, 'city' => $order_data['shipping_city'], 'state' => $order_data['shipping_zone'], 'country' => $order_data['shipping_country'])); $this->cart->clear(); unset($this->session->data['shipping_method'], $this->session->data['shipping_methods'], $this->session->data['payment_method'], $this->session->data['payment_methods'], $this->session->data['guest'], $this->session->data['comment'], $this->session->data['order_id'], $this->session->data['coupon'], $this->session->data['used_balance'], $this->session->data['used_balance_full']); //Redirect back. Fix for clearing shopping cart content $this->redirect($this->html->getSecureURL('checkout/success')); } $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/cart'), 'text' => $this->language->get('text_basket'), 'separator' => $this->language->get('text_separator'))); if ($this->customer->isLogged()) { $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/shipping'), 'text' => $this->language->get('text_shipping'), 'separator' => $this->language->get('text_separator'))); $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/payment'), 'text' => $this->language->get('text_payment'), 'separator' => $this->language->get('text_separator'))); $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/confirm'), 'text' => $this->language->get('text_confirm'), 'separator' => $this->language->get('text_separator'))); } else { $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/guest'), 'text' => $this->language->get('text_guest'), 'separator' => $this->language->get('text_separator'))); $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/guest/confirm'), 'text' => $this->language->get('text_confirm'), 'separator' => $this->language->get('text_separator'))); } $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/success'), 'text' => $this->language->get('text_success'), 'separator' => $this->language->get('text_separator'))); $this->view->assign('heading_title', $this->language->get('heading_title')); if ($this->session->data['account'] == 'guest') { $this->view->assign('text_message', sprintf($this->language->get('text_message_guest'), $this->html->getURL('content/contact'))); } else { $this->view->assign('text_message', sprintf($this->language->get('text_message'), $this->html->getSecureURL('account/account'), $this->html->getSecureURL('account/history'), $this->html->getURL('content/contact'))); } $this->view->assign('button_continue', $this->language->get('button_continue')); $this->view->assign('continue', $this->html->getURL('index/home')); $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->view->assign('continue_button', $continue); $this->processTemplate('common/success.tpl'); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function main() { $this->loadLanguage('default_pp_express/default_pp_express'); if ($this->request->get['rt'] != 'checkout/guest_step_3') { $back = $this->html->getSecureURL('checkout/payment'); } else { $back = $this->html->getSecureURL('checkout/guest_step_2'); } $this->data['button_back'] = $this->html->buildElement(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'href' => $back)); $this->data['button_confirm'] = HtmlElementFactory::create(array('type' => 'submit', 'name' => $this->language->get('button_confirm'), 'style' => 'button', 'href' => $this->html->getSecureURL('r/extension/default_pp_express/confirm'))); $this->view->batchAssign($this->data); $this->processTemplate('responses/default_pp_express.tpl'); }
public function main() { $item = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'style' => 'button mr10', 'text' => $this->language->get('button_back'), 'icon' => 'fa fa-arrow-left')); $this->view->assign('button_back', $item); $item = HtmlElementFactory::create(array('type' => 'button', 'name' => 'checkout', 'style' => 'button btn-orange pull-right', 'text' => $this->language->get('button_confirm'), 'icon' => 'fa fa-check')); $this->view->assign('button_confirm', $item); $this->view->assign('continue', $this->html->getSecureURL('checkout/success')); if ($this->request->get['rt'] != 'checkout/guest_step_3') { $this->view->assign('back', $this->html->getSecureURL('checkout/cart')); } else { $this->view->assign('back', $this->html->getSecureURL('checkout/guest_step_2')); } $this->processTemplate('responses/checkout/no_payment.tpl'); }
/** * Main controller function to show order hitory */ public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); if (!$this->customer->isLogged()) { $this->session->data['redirect'] = $this->html->getSecureURL('account/history'); $this->redirect($this->html->getSecureURL('account/login')); } $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'))); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/history'), 'text' => $this->language->get('text_history'), 'separator' => $this->language->get('text_separator'))); $this->loadModel('account/order'); $order_total = $this->model_account_order->getTotalOrders(); if ($order_total) { $this->data['action'] = $this->html->getURL('account/history'); if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int) $this->request->get['limit']; $limit = $limit > 50 ? 50 : $limit; } else { $limit = $this->config->get('config_catalog_limit'); } $orders = array(); $results = $this->model_account_order->getOrders(($page - 1) * $limit, $limit); foreach ($results as $result) { $product_total = $this->model_account_order->getTotalOrderProductsByOrderId($result['order_id']); $button = HtmlElementFactory::create(array('type' => 'button', 'name' => 'button_edit', 'text' => $this->language->get('button_view'), 'style' => 'btn-default', 'icon' => 'fa fa-info', 'attr' => ' onclick = "viewOrder(' . $result['order_id'] . ');" ')); $orders[] = array('order_id' => $result['order_id'], 'name' => $result['firstname'] . ' ' . $result['lastname'], 'status' => $result['status'], 'date_added' => dateISO2Display($result['date_added'], $this->language->get('date_format_short')), 'products' => $product_total, 'total' => $this->currency->format($result['total'], $result['currency'], $result['value']), 'href' => $this->html->getSecureURL('account/invoice', '&order_id=' . $result['order_id']), 'button' => $button->getHtml()); } $this->data['order_url'] = $this->html->getSecureURL('account/invoice'); $this->data['orders'] = $orders; $this->data['pagination_bootstrap'] = HtmlElementFactory::create(array('type' => 'Pagination', 'name' => 'pagination', 'text' => $this->language->get('text_pagination'), 'text_limit' => $this->language->get('text_per_page'), 'total' => $order_total, 'page' => $page, 'limit' => $limit, 'url' => $this->html->getURL('account/history', '&limit=' . $limit . '&page={page}'), 'style' => 'pagination')); $this->data['continue'] = $this->html->getSecureURL('account/account'); $this->view->setTemplate('pages/account/history.tpl'); } else { $this->data['continue'] = $this->html->getSecureURL('account/account'); $this->view->setTemplate('pages/error/not_found.tpl'); } $this->data['button_continue'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->view->batchAssign($this->data); $this->processTemplate(); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
/** * Main Controller function to show transaction hitory. * Note: Regular orders are considered in the transactions. */ public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); if (!$this->customer->isLogged()) { $this->session->data['redirect'] = $this->html->getSecureURL('account/transactions'); $this->redirect($this->html->getSecureURL('account/login')); } $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'))); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/transactions'), 'text' => $this->language->get('text_transactions'), 'separator' => $this->language->get('text_separator'))); $this->loadModel('account/customer'); $trans_total = $this->model_account_customer->getTotalTransactions(); $balance = $this->customer->getBalance(); $this->data['balance_amount'] = $this->currency->format($balance); if ($trans_total) { $this->data['action'] = $this->html->getURL('account/transactions'); if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int) $this->request->get['limit']; $limit = $limit > 50 ? 50 : $limit; } else { $limit = $this->config->get('config_catalog_limit'); } $trans = array(); $results = $this->model_account_customer->getTransactions(($page - 1) * $limit, $limit); foreach ($results as $result) { $trans[] = array('customer_transaction_id' => $result['customer_transaction_id'], 'order_id' => $result['order_id'], 'section' => $result['section'], 'credit' => $this->currency->format($result['credit']), 'debit' => $this->currency->format($result['debit']), 'transaction_type' => $result['transaction_type'], 'description' => $result['description'], 'create_date' => dateISO2Display($result['create_date'], $this->language->get('date_format_short'))); } $this->data['transactions'] = $trans; $this->data['pagination_bootstrap'] = HtmlElementFactory::create(array('type' => 'Pagination', 'name' => 'pagination', 'text' => $this->language->get('text_pagination'), 'text_limit' => $this->language->get('text_per_page'), 'total' => $trans_total, 'page' => $page, 'limit' => $limit, 'url' => $this->html->getURL('account/transactions', '&limit=' . $limit . '&page={page}'), 'style' => 'pagination')); $this->data['continue'] = $this->html->getSecureURL('account/account'); $this->view->setTemplate('pages/account/transactions.tpl'); } else { $this->data['continue'] = $this->html->getSecureURL('account/account'); $this->view->setTemplate('pages/account/transactions.tpl'); } $this->data['button_continue'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->view->batchAssign($this->data); $this->processTemplate(); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function main() { $item = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'style' => 'button', 'text' => $this->language->get('button_back'))); $this->view->assign('button_back', $item); $item = HtmlElementFactory::create(array('type' => 'button', 'name' => 'checkout', 'style' => 'button btn-primary', 'text' => $this->language->get('button_confirm'))); $this->view->assign('button_confirm', $item); $this->view->assign('continue', $this->html->getSecureURL('checkout/success')); if ($this->request->get['rt'] != 'checkout/guest_step_3') { $this->view->assign('back', $this->html->getSecureURL('checkout/payment', '&mode=edit', true)); // to prevent coming back when payment method only one } else { $this->view->assign('back', $this->html->getSecureURL('checkout/guest_step_2')); } $this->processTemplate('responses/default_cod.tpl'); }
public function main() { $this->loadLanguage('default_pp_pro/default_pp_pro'); $this->load->model('checkout/order'); $this->load->model('extension/default_pp_pro'); $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']); $data['cc_owner'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_owner', 'value' => $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname'], 'style' => 'input-medium')); //load accepted card types $cardtypes = $this->model_extension_default_pp_pro->getCreditCardTypes(); $cards = unserialize($this->config->get('default_pp_pro_creditcard_types')); $options = array(''); foreach ($cards as $card) { if ($card && isset($cardtypes[$card])) { $options[$card] = $cardtypes[$card]; } } $data['accepted_cards'] = $options; $data['cc_type'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_type', 'value' => '', 'options' => $options, 'style' => 'input-medium')); $data['cc_number'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_number', 'value' => '', 'style' => 'input-medium', 'attr' => 'autocomplete="off"')); $months = array(); for ($i = 1; $i <= 12; $i++) { $months[sprintf('%02d', $i)] = strftime('%B', mktime(0, 0, 0, $i, 1, 2000)); } $data['cc_expire_date_month'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_expire_date_month', 'value' => sprintf('%02d', date('m')), 'options' => $months, 'style' => 'short input-small')); $today = getdate(); $years = array(); for ($i = $today['year']; $i < $today['year'] + 11; $i++) { $years[strftime('%Y', mktime(0, 0, 0, 1, 1, $i))] = strftime('%Y', mktime(0, 0, 0, 1, 1, $i)); } $data['cc_expire_date_year'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_expire_date_year', 'value' => sprintf('%02d', date('Y') + 1), 'options' => $years, 'style' => 'short input-small')); $data['cc_start_date_month'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_start_date_month', 'value' => sprintf('%02d', date('m')), 'options' => $months, 'style' => 'short input-small')); $years = array(); for ($i = $today['year'] - 10; $i < $today['year'] + 2; $i++) { $years[strftime('%Y', mktime(0, 0, 0, 1, 1, $i))] = strftime('%Y', mktime(0, 0, 0, 1, 1, $i)); } $data['cc_start_date_year'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_start_date_year', 'value' => sprintf('%02d', date('Y')), 'options' => $years, 'style' => 'short input-small')); $data['cc_cvv2'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_cvv2', 'value' => '', 'style' => 'short', 'attr' => ' size="3" maxlength="4" autocomplete="off"')); $data['cc_issue'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_issue', 'value' => '', 'style' => 'short', 'attr' => ' size="1" maxlength="2" autocomplete="off"')); $back = $this->request->get['rt'] != 'checkout/guest_step_3' ? $this->html->getSecureURL('checkout/payment') : $this->html->getSecureURL('checkout/guest_step_2'); $data['back'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'style' => 'button', 'href' => $back)); $data['submit'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'paypal_button', 'text' => $this->language->get('button_confirm'), 'style' => 'button btn-orange')); //load creditcard input validation $this->document->addScriptBottom($this->view->templateResource('/javascript/credit_card_validation.js')); $this->view->batchAssign($data); $this->processTemplate('responses/default_pp_pro.tpl'); }
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); if ($this->customer->isLogged() || $this->customer->isUnauthCustomer()) { $this->customer->logout(); $this->cart->clear(); unset($this->session->data['shipping_address_id']); unset($this->session->data['shipping_method']); unset($this->session->data['shipping_methods']); unset($this->session->data['payment_address_id']); unset($this->session->data['payment_method']); unset($this->session->data['payment_methods']); unset($this->session->data['comment']); unset($this->session->data['order_id']); unset($this->session->data['coupon']); unset($this->session->data['merchant']); if ($this->config->get('config_tax_store')) { $country_id = $this->config->get('config_country_id'); $zone_id = $this->config->get('config_zone_id'); } else { $country_id = $zone_id = 0; } $this->tax->setZone($country_id, $zone_id); $this->redirect($this->html->getSecureURL('account/logout')); } $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'))); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/logout'), 'text' => $this->language->get('text_logout'), 'separator' => $this->language->get('text_separator'))); $this->view->assign('continue', $this->html->getURL('index/home')); $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->view->assign('continue_button', $continue); if ($this->config->get('embed_mode') == true) { //load special headers $this->addChild('responses/embed/head', 'head'); $this->addChild('responses/embed/footer', 'footer'); $this->processTemplate('embed/common/success.tpl'); } else { $this->processTemplate('common/success.tpl'); } //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function main() { $this->loadLanguage('default_cheque/default_cheque'); $this->view->batchAssign($this->language->getASet()); $this->view->assign('payable', $this->config->get('default_cheque_payable')); $this->view->assign('address', $this->config->get('config_address')); $this->view->assign('continue', $this->html->getSecureURL('checkout/success')); $item = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'style' => 'button', 'text' => $this->language->get('button_back'))); $this->view->assign('button_back', $item); $item = HtmlElementFactory::create(array('type' => 'button', 'name' => 'checkout', 'style' => 'button', 'text' => $this->language->get('button_confirm'))); $this->view->assign('button_confirm', $item); if ($this->request->get['rt'] != 'checkout/guest_step_3') { $this->view->assign('back', $this->html->getSecureURL('checkout/payment')); } else { $this->view->assign('back', $this->html->getSecureURL('checkout/guest_step_2')); } $this->processTemplate('responses/default_cheque.tpl'); }
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->loadLanguage('default_stripe/default_stripe'); //neeed an order details $this->loadModel('checkout/order'); $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']); $data['payment_address'] = $order_info['payment_address_1'] . " " . $order_info['payment_address_2']; $data['edit_address'] = $this->html->getSecureURL('checkout/address/payment'); $data['text_credit_card'] = $this->language->get('text_credit_card'); $data['text_wait'] = $this->language->get('text_wait'); $data['entry_cc_owner'] = $this->language->get('entry_cc_owner'); $data['cc_owner'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_owner', 'placeholder' => $this->language->get('entry_cc_owner'), 'value' => $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname'])); $data['entry_cc_number'] = $this->language->get('entry_cc_number'); $data['cc_number'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_number', 'attr' => 'autocomplete="off"', 'placeholder' => $this->language->get('entry_cc_number'), 'value' => '')); $data['entry_cc_expire_date'] = $this->language->get('entry_cc_expire_date'); $data['entry_cc_cvv2'] = $this->language->get('entry_cc_cvv2'); $data['entry_cc_cvv2_short'] = $this->language->get('entry_cc_cvv2_short'); $data['cc_cvv2_help_url'] = $this->html->getURL('r/extension/default_stripe/cvv2_help'); $data['cc_cvv2'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_cvv2', 'value' => '', 'style' => 'short', 'attr' => ' autocomplete="off" ')); $data['button_confirm'] = $this->language->get('button_confirm'); $data['button_back'] = $this->language->get('button_back'); $months = array(); for ($i = 1; $i <= 12; $i++) { $months[sprintf('%02d', $i)] = sprintf('%02d - ', $i) . strftime('%B', mktime(0, 0, 0, $i, 1, 2000)); } $data['cc_expire_date_month'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_expire_date_month', 'value' => sprintf('%02d', date('m')), 'options' => $months, 'style' => 'input-medium short')); $today = getdate(); $years = array(); for ($i = $today['year']; $i < $today['year'] + 11; $i++) { $years[strftime('%Y', mktime(0, 0, 0, 1, 1, $i))] = strftime('%Y', mktime(0, 0, 0, 1, 1, $i)); } $data['cc_expire_date_year'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_expire_date_year', 'value' => sprintf('%02d', date('Y') + 1), 'options' => $years, 'style' => 'short')); $back = $this->request->get['rt'] != 'checkout/guest_step_3' ? $this->html->getSecureURL('checkout/payment') : $this->html->getSecureURL('checkout/guest_step_2'); $data['back'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'style' => 'button', 'href' => $back, 'icon' => 'icon-arrow-left')); $data['submit'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'strype_button', 'text' => $this->language->get('button_confirm'), 'style' => 'button btn-orange pull-right', 'icon' => 'icon-ok icon-white')); $this->view->batchAssign($data); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); //load creditcard input validation $this->document->addScriptBottom($this->view->templateResource('/javascript/credit_card_validation.js')); $this->processTemplate('responses/default_stripe.tpl'); }
public function main() { $this->loadLanguage('default_cashflows/default_cashflows'); $data['text_credit_card'] = $this->language->get('text_credit_card'); $data['text_start_date'] = $this->language->get('text_start_date'); $data['text_issue'] = $this->language->get('text_issue'); $data['text_wait'] = $this->language->get('text_wait'); $data['entry_cc_number'] = $this->language->get('entry_cc_number'); $data['entry_cc_start_date'] = $this->language->get('entry_cc_start_date'); $data['entry_cc_expire_date'] = $this->language->get('entry_cc_expire_date'); $data['entry_cc_cvv2'] = $this->language->get('entry_cc_cvv2'); $data['entry_cc_issue'] = $this->language->get('entry_cc_issue'); $data['button_confirm'] = $this->language->get('button_confirm'); $data['button_back'] = $this->language->get('button_back'); $data['cc_owner'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_owner', 'value' => $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname'], 'style' => 'input-medium')); $data['cc_number'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_number', 'value' => '', 'style' => 'input-medium')); $months = array(); for ($i = 1; $i <= 12; $i++) { $months[sprintf('%02d', $i)] = strftime('%B', mktime(0, 0, 0, $i, 1, 2000)); } $data['cc_expire_date_month'] = $this->html->buildElement(array('type' => 'selectbox', 'name' => 'cc_expire_date_month', 'value' => sprintf('%02d', date('m')), 'options' => $months, 'style' => 'short input-small')); $data['cc_start_date_month'] = $this->html->buildElement(array('type' => 'selectbox', 'name' => 'cc_start_date_month', 'value' => sprintf('%02d', date('m')), 'options' => $months, 'style' => 'short input-small')); $today = getdate(); $years = array(); for ($i = $today['year']; $i < $today['year'] + 11; $i++) { $years[strftime('%Y', mktime(0, 0, 0, 1, 1, $i))] = strftime('%Y', mktime(0, 0, 0, 1, 1, $i)); } $data['cc_expire_date_year'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_expire_date_year', 'value' => sprintf('%02d', date('Y') + 1), 'options' => $years, 'style' => 'short input-small')); $data['cc_start_date_year'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_start_date_year', 'value' => sprintf('%02d', date('Y') + 1), 'options' => $years, 'style' => 'short input-small')); $data['cc_cvv2'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_cvv2', 'value' => '', 'style' => 'short', 'attr' => ' size="3" maxlength="4" ')); $data['cc_issue'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_issue', 'value' => '', 'style' => 'short', 'attr' => ' size="1" maxlength="2" ')); if ($this->request->get['rt'] != 'checkout/guest_step_3') { $back = $this->html->getSecureURL('checkout/payment'); } else { $back = $this->html->getSecureURL('checkout/guest_step_2'); } $data['back'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'style' => 'button', 'href' => $back)); $data['submit'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'pp_button', 'text' => $this->language->get('button_confirm'), 'style' => 'button btn-orange')); $this->view->batchAssign($data); //load creditcard input validation $this->document->addScriptBottom($this->view->templateResource('/javascript/credit_card_validation.js')); $this->processTemplate('responses/default_cashflows.tpl'); }
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->loadLanguage('default_authorizenet_aim/default_authorizenet_aim'); $data['text_credit_card'] = $this->language->get('text_credit_card'); $data['text_wait'] = $this->language->get('text_wait'); $data['entry_cc_owner'] = $this->language->get('entry_cc_owner'); $data['cc_owner'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_owner', 'value' => '')); $data['cc_owner'] = $data['cc_owner']->getHtml(); $data['entry_cc_number'] = $this->language->get('entry_cc_number'); $data['cc_number'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_number', 'value' => '')); $data['cc_number'] = $data['cc_number']->getHtml(); $data['entry_cc_expire_date'] = $this->language->get('entry_cc_expire_date'); $data['entry_cc_cvv2'] = $this->language->get('entry_cc_cvv2'); $data['entry_cc_cvv2_short'] = $this->language->get('entry_cc_cvv2_short'); $data['cc_cvv2_help_url'] = $this->html->getURL('r/extension/default_authorizenet_aim/cvv2_help'); $data['cc_cvv2'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'cc_cvv2', 'value' => '', 'style' => 'short input-mini', 'attr' => ' size="3" ')); $data['cc_cvv2'] = $data['cc_cvv2']->getHtml(); $data['button_confirm'] = $this->language->get('button_confirm'); $data['button_back'] = $this->language->get('button_back'); $months = array(); for ($i = 1; $i <= 12; $i++) { $months[sprintf('%02d', $i)] = strftime('%B', mktime(0, 0, 0, $i, 1, 2000)); } $data['cc_expire_date_month'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_expire_date_month', 'value' => sprintf('%02d', date('m')), 'options' => $months, 'style' => 'short input-small')); $data['cc_expire_date_month'] = $data['cc_expire_date_month']->getHtml(); $today = getdate(); $years = array(); for ($i = $today['year']; $i < $today['year'] + 11; $i++) { $years[strftime('%Y', mktime(0, 0, 0, 1, 1, $i))] = strftime('%Y', mktime(0, 0, 0, 1, 1, $i)); } $data['cc_expire_date_year'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'cc_expire_date_year', 'value' => sprintf('%02d', date('Y') + 1), 'options' => $years, 'style' => 'short input-small')); $data['cc_expire_date_year'] = $data['cc_expire_date_year']->getHtml(); $back = $this->request->get['rt'] != 'checkout/guest_step_3' ? $this->html->getSecureURL('checkout/payment') : $this->html->getSecureURL('checkout/guest_step_2'); $data['back'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'style' => 'button', 'href' => $back)); $data['submit'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'authorizenet_button', 'text' => $this->language->get('button_confirm'), 'style' => 'button')); $this->view->batchAssign($data); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); $this->processTemplate('responses/default_authorizenet_aim.tpl'); }
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); if (!$this->customer->isLogged()) { $this->session->data['redirect'] = $this->html->getSecureURL('account/password'); $this->redirect($this->html->getSecureURL('account/login')); } $this->document->setTitle($this->language->get('heading_title')); if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->_validate()) { $this->loadModel('account/customer'); $this->model_account_customer->editPassword($this->customer->getLoginName(), $this->request->post['password']); $this->session->data['success'] = $this->language->get('text_success'); $this->redirect($this->html->getSecureURL('account/account')); } $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'))); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/password'), 'text' => $this->language->get('heading_title'), 'separator' => $this->language->get('text_separator'))); $this->view->assign('error_warning', $this->error['warning']); $this->view->assign('error_current_password', $this->error['current_password']); $this->view->assign('error_password', $this->error['password']); $this->view->assign('error_confirm', $this->error['confirm']); $form = new AForm(); $form->setForm(array('form_name' => 'PasswordFrm')); $form_open = $form->getFieldHtml(array('type' => 'form', 'name' => 'PasswordFrm', 'action' => $this->html->getSecureURL('account/password'))); $this->view->assign('form_open', $form_open); $current_password = $form->getFieldHtml(array('type' => 'password', 'name' => 'current_password', 'value' => '', 'required' => true)); $password = $form->getFieldHtml(array('type' => 'password', 'name' => 'password', 'value' => '', 'required' => true)); $confirm = $form->getFieldHtml(array('type' => 'password', 'name' => 'confirm', 'value' => '', 'required' => true)); $submit = $form->getFieldHtml(array('type' => 'submit', 'name' => $this->language->get('button_continue'), 'icon' => 'icon-check')); $this->view->assign('current_password', $current_password); $this->view->assign('password', $password); $this->view->assign('submit', $submit); $this->view->assign('confirm', $confirm); $this->view->assign('back', $this->html->getSecureURL('account/account')); $back = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'icon' => 'icon-arrow-left', 'style' => 'button')); $this->view->assign('button_back', $back); $this->processTemplate('pages/account/password.tpl'); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . '/1.1 404 Not Found'); $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); if (isset($this->request->get['rt'])) { $this->document->addBreadcrumb(array('href' => $this->html->getURL($this->request->get['rt']), 'text' => $this->language->get('text_error'), 'separator' => $this->language->get('text_separator'))); } $this->view->assign('heading_title', $this->language->get('heading_title')); $this->view->assign('text_error', $this->language->get('text_error')); $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->view->assign('button_continue', $continue); $this->view->assign('continue', $this->html->getURL('index/home')); $this->processTemplate('pages/error/not_found.tpl'); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function details() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->loadLanguage('common/header'); $this->loadLanguage('common/home'); $this->loadLanguage('banner_manager/banner_manager'); $this->document->setTitle($this->language->get('banner_manager_name_stat')); $this->loadModel('extension/banner_manager'); $info = $this->model_extension_banner_manager->getBanner((int) $this->request->get['banner_id']); $this->data['heading_title'] = $this->language->get('banner_manager_name_stat') . ': ' . $info['name']; $this->data['chart_url'] = $this->html->getSecureURL('extension/banner_manager_chart', '&banner_id=' . $this->request->get['banner_id']); $options = array('day' => $this->language->get('text_day'), 'week' => $this->language->get('text_week'), 'month' => $this->language->get('text_month'), 'year' => $this->language->get('text_year')); $this->data['select_range'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'range', 'options' => $options, 'value' => 'day')); $this->data['select_range'] = $this->data['select_range']->getHtml(); $this->data['text_count'] = $this->language->get('text_count'); $this->view->batchAssign($this->data); $this->processTemplate('pages/extension/banner_manager_stat_details.tpl'); //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function main() { $request = $this->request->get; //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->loadModel('catalog/content'); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); if (isset($request['content_id'])) { $content_id = $request['content_id']; } else { $content_id = 0; } $content_info = $this->model_catalog_content->getContent($content_id); if ($content_info) { $this->document->setTitle($content_info['title']); $this->document->addBreadcrumb(array('href' => $this->html->getSEOURL('content/content', '&content_id=' . $request['content_id'], true), 'text' => $content_info['title'], 'separator' => $this->language->get('text_separator'))); $this->view->assign('heading_title', $content_info['title']); $this->view->assign('button_continue', $this->language->get('button_continue')); $this->view->assign('description', html_entity_decode($content_info['description'])); $this->view->assign('content', html_entity_decode($content_info['content'])); $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->view->assign('button_continue', $continue); $this->view->assign('continue', $this->html->getURL('index/home')); $this->view->setTemplate('pages/content/content.tpl'); } else { $this->document->addBreadcrumb(array('href' => $this->html->getSEOURL('content/content', '&content_id=' . $request['content_id'], true), 'text' => $this->language->get('text_error'), 'separator' => $this->language->get('text_separator'))); $this->document->setTitle($this->language->get('text_error')); $this->view->assign('heading_title', $this->language->get('text_error')); $this->view->assign('text_error', $this->language->get('text_error')); $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->view->assign('button_continue', $continue); $this->view->assign('continue', $this->html->getURL('index/home')); $this->view->setTemplate('pages/error/not_found.tpl'); } $this->processTemplate(); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
private function getWishList() { $cart_rt = 'checkout/cart'; //is this an embed mode if ($this->config->get('embed_mode') == true) { $cart_rt = 'r/checkout/cart/embed'; } $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'))); $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/wishlist'), 'text' => $this->language->get('heading_title'), 'separator' => $this->language->get('text_separator'))); $whishlist = $this->customer->getWishList(); if ($whishlist) { $this->loadModel('tool/seo_url'); $this->loadModel('catalog/product'); $products = array(); $resource = new AResource('image'); foreach ($whishlist as $product_id => $timestamp) { $product_info = $this->model_catalog_product->getProduct($product_id); $thumbnail = $resource->getMainThumb('products', $product_id, (int) $this->config->get('config_image_cart_width'), (int) $this->config->get('config_image_cart_height'), true); $options = $this->model_catalog_product->getProductOptions($product_id); if ($options) { $add = $this->html->getSEOURL('product/product', '&product_id=' . $product_id, '&encode'); } else { $add = $this->html->getSecureURL($cart_rt, '&product_id=' . $product_id, '&encode'); } $products[] = array('product_id' => $product_id, 'name' => $product_info['name'], 'model' => $product_info['model'], 'thumb' => $thumbnail, 'added' => dateInt2Display($timestamp), 'price' => $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))), 'href' => $this->html->getSEOURL('product/product', '&product_id=' . $product_id, true), 'call_to_order' => $product_info['call_to_order'], 'add' => $add); } $this->data['products'] = $products; if (isset($this->session->data['redirect'])) { $this->data['continue'] = str_replace('&', '&', $this->session->data['redirect']); unset($this->session->data['redirect']); } else { $this->data['continue'] = $this->html->getURL('index/home'); } $this->view->assign('error', ''); if ($this->session->data['error']) { $this->view->assign('error', $this->session->data['error']); unset($this->session->data['error']); } if ($this->config->get('config_customer_price')) { $display_price = TRUE; } elseif ($this->customer->isLogged()) { $display_price = TRUE; } else { $display_price = FALSE; } $this->data['display_price'] = $display_price; $this->view->setTemplate('pages/account/wishlist.tpl'); } else { $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['text_error'] = $this->language->get('text_empty_wishlist'); $this->data['button_continue'] = HtmlElementFactory::create(array('name' => 'continue', 'type' => 'button', 'text' => $this->language->get('button_continue'), 'href' => $this->html->getURL('index/home'), 'style' => 'button')); $this->view->setTemplate('pages/error/not_found.tpl'); } $this->data['cart'] = $this->html->getSecureURL($cart_rt); $this->view->batchAssign($this->data); $this->processTemplate(); }
public function success() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->document->addBreadcrumb(array('href' => $this->html->getURL('content/contact'), 'text' => $this->language->get('heading_title'), 'separator' => $this->language->get('text_separator'))); $this->view->assign('continue', $this->html->getURL('index/home')); $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->view->assign('continue_button', $continue); $this->processTemplate('common/success.tpl'); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function resources() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $rm = new AResourceManager(); $rm->setType($this->request->get['type']); $uri = '&type=' . $this->request->get['type'] . '&language_id=' . $this->request->get['language_id']; $filter_data = array('type_id' => $rm->getTypeId(), 'language_id' => $this->request->get['language_id']); if (!empty($this->request->get['keyword'])) { $filter_data['keyword'] = $this->request->get['keyword']; $uri .= '&keyword=' . $this->request->get['keyword']; } if (!empty($this->request->get['object_name'])) { $filter_data['object_name'] = $this->request->get['object_name']; $uri .= '&object_name=' . $this->request->get['object_name']; } if (!empty($this->request->get['object_id'])) { $filter_data['object_id'] = $this->request->get['object_id']; $uri .= '&object_id=' . $this->request->get['object_id']; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; if ((int) $page < 1) { $page = 1; } $filter_data['page'] = $page; $filter_data['limit'] = 12; } if (!empty($this->request->get['sort'])) { $filter_data['sort'] = $this->request->get['sort']; } else { $filter_data['sort'] = 'sort_order'; } $result = array('items' => $rm->getResourcesList($filter_data), 'pagination' => '', 'object_name' => $this->request->get['object_name'], 'object_id' => $this->request->get['object_id']); foreach ($result['items'] as $key => $item) { $result['items'][$key]['thumbnail_url'] = $rm->getResourceThumb($item['resource_id'], $this->thumb_sizes['width'], $this->thumb_sizes['height'], $item['language_id']); $result['items'][$key]['url'] = $rm->buildResourceURL($item['resource_path'], 'full'); $result['items'][$key]['relative_url'] = $rm->buildResourceURL($item['resource_path'], 'relative'); $result['items'][$key]['can_delete'] = $result['items'][$key]['mapped'] == 1 ? true : false; } if (isset($this->request->get['page'])) { $resources_total = $rm->getResourcesList($filter_data, true); if ($resources_total > 12) { $result['pagination'] = (string) HtmlElementFactory::create(array('type' => 'Pagination', 'name' => 'pagination', 'text' => $this->language->get('text_pagination'), 'text_limit' => $this->language->get('text_per_page'), 'total' => $resources_total, 'page' => $page, 'limit' => 12, 'url' => $this->html->getSecureURL('common/resource_library/resources', $uri . '&page={page}'), 'style' => 'pagination')); } } //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); $this->load->library('json'); $this->response->addJSONHeader(); $this->response->setOutput(AJson::encode($result)); }
/** * create html code based on passed data * @param $data - array with element data * sample * $data = array( * 'type' => 'input' //(hidden, textarea, selectbox, file...) * 'name' => 'input name' * 'value' => 'input value' // could be array for select * 'style' => 'my-form' * 'form' => 'form id' // needed for unique element ID * * ); * @return object */ public function buildElement($data) { return HtmlElementFactory::create($data); }
public function main() { //is this an embed mode if ($this->config->get('embed_mode') == true) { $cart_rt = 'r/checkout/cart/embed'; } else { $cart_rt = 'checkout/cart'; } //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->loadLanguage('product/category'); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->loadModel('catalog/category'); $this->loadModel('tool/seo_url'); if (!isset($this->request->get['path']) && isset($this->request->get['category_id'])) { $this->request->get['path'] = $this->request->get['category_id']; } if (isset($this->request->get['path'])) { $path = ''; $parts = explode('_', $this->request->get['path']); if (count($parts) == 1) { //see if this is a category ID to sub category, need to build full path $parts = explode('_', $this->model_catalog_category->buildPath($this->request->get['path'])); } foreach ($parts as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$path) { $path = $path_id; } else { $path .= '_' . $path_id; } $this->document->addBreadcrumb(array('href' => $this->html->getSEOURL('product/category', '&path=' . $path, '&encode'), 'text' => $category_info['name'], 'separator' => $this->language->get('text_separator'))); } } $category_id = array_pop($parts); } else { $category_id = 0; } $category_info = array(); if ($category_id) { $category_info = $this->model_catalog_category->getCategory($category_id); } elseif ($this->config->get('embed_mode') == true) { $category_info['name'] = $this->language->get('text_top_category'); } if ($category_info) { $this->document->setTitle($category_info['name']); $this->document->setKeywords($category_info['meta_keywords']); $this->document->setDescription($category_info['meta_description']); $this->view->assign('heading_title', $category_info['name']); $this->view->assign('description', html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8')); $this->view->assign('text_sort', $this->language->get('text_sort')); if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int) $this->request->get['limit']; $limit = $limit > 50 ? 50 : $limit; } else { $limit = $this->config->get('config_catalog_limit'); } if (isset($this->request->get['sort'])) { $sorting_href = $this->request->get['sort']; list($sort, $order) = explode("-", $sorting_href); } else { $sorting_href = $this->config->get('config_product_default_sort_order'); list($sort, $order) = explode("-", $sorting_href); if ($sort == 'name') { $sort = 'pd.' . $sort; } elseif (in_array($sort, array('sort_order', 'price'))) { $sort = 'p.' . $sort; } } $url = '&sort=' . $sort . "-" . $order; if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $this->loadModel('catalog/product'); $category_total = $this->model_catalog_category->getTotalCategoriesByCategoryId($category_id); $product_total = $this->model_catalog_product->getTotalProductsByCategoryId($category_id); if ($category_total || $product_total) { $categories = array(); $results = $this->model_catalog_category->getCategories($category_id); $resource = new AResource('image'); foreach ($results as $result) { $thumbnail = $resource->getMainThumb('categories', $result['category_id'], (int) $this->config->get('config_image_category_width'), (int) $this->config->get('config_image_category_height'), true); $categories[] = array('name' => $result['name'], 'href' => $this->html->getSEOURL('product/category', '&path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url, '&encode'), 'thumb' => $thumbnail); } $this->view->assign('categories', $categories); $this->loadModel('catalog/review'); $this->view->assign('button_add_to_cart', $this->language->get('button_add_to_cart')); $products = array(); $products_result = $this->model_catalog_product->getProductsByCategoryId($category_id, $sort, $order, ($page - 1) * $limit, $limit); foreach ($products_result as $p) { $product_ids[] = (int) $p['product_id']; } $products_info = $this->model_catalog_product->getProductsAllInfo($product_ids); foreach ($products_result as $result) { $thumbnail = $resource->getMainThumb('products', $result['product_id'], (int) $this->config->get('config_image_product_width'), (int) $this->config->get('config_image_product_height'), true); $rating = $products_info[$result['product_id']]['rating']; $special = FALSE; $discount = $products_info[$result['product_id']]['discount']; if ($discount) { $price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax'))); } else { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))); $special = $products_info[$result['product_id']]['special']; if ($special) { $special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax'))); } } $options = $products_info[$result['product_id']]['options']; if ($options) { $add = $this->html->getSEOURL('product/product', '&product_id=' . $result['product_id'], '&encode'); } else { if ($this->config->get('config_cart_ajax')) { $add = '#'; } else { $add = $this->html->getSecureURL($cart_rt, '&product_id=' . $result['product_id'], '&encode'); } } //check for stock status, availability and config $track_stock = false; $in_stock = false; $no_stock_text = $result['stock']; $total_quantity = 0; if ($this->model_catalog_product->isStockTrackable($result['product_id'])) { $track_stock = true; $total_quantity = $this->model_catalog_product->hasAnyStock($result['product_id']); //we have stock or out of stock checkout is allowed if ($total_quantity > 0 || $this->config->get('config_stock_checkout')) { $in_stock = true; } } $products[] = array('product_id' => $result['product_id'], 'name' => $result['name'], 'blurb' => $result['blurb'], 'model' => $result['model'], 'rating' => $rating, 'stars' => sprintf($this->language->get('text_stars'), $rating), 'thumb' => $thumbnail, 'price' => $price, 'call_to_order' => $result['call_to_order'], 'options' => $options, 'special' => $special, 'href' => $this->html->getSEOURL('product/product', '&path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'], '&encode'), 'add' => $add, 'description' => html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'), 'track_stock' => $track_stock, 'in_stock' => $in_stock, 'no_stock_text' => $no_stock_text, 'total_quantity' => $total_quantity); } $this->data['products'] = $products; if ($this->config->get('config_customer_price')) { $display_price = TRUE; } elseif ($this->customer->isLogged()) { $display_price = TRUE; } else { $display_price = FALSE; } $this->view->assign('display_price', $display_price); $url = ''; if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $sorts = array(); $sorts[] = array('text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->html->getSEOURL('product/category', $url . '&path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->html->getSEOURL('product/category', $url . '&path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->html->getSEOURL('product/category', $url . '&path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->html->getSEOURL('product/category', $url . '&path=' . $this->request->get['path'] . '&sort=p.price&order=ASC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->html->getSEOURL('product/category', $url . '&path=' . $this->request->get['path'] . '&sort=p.price&order=DESC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->html->getSEOURL('product/category', $url . '&path=' . $this->request->get['path'] . '&sort=rating&order=DESC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->html->getSEOURL('product/category', $url . '&path=' . $this->request->get['path'] . '&sort=rating&order=ASC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_date_desc'), 'value' => 'date_modified-DESC', 'href' => $this->html->getSEOURL('product/category', $url . '&path=' . $this->request->get['path'] . '&sort=date_modified&order=DESC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_date_asc'), 'value' => 'date_modified-ASC', 'href' => $this->html->getSEOURL('product/category', $url . '&path=' . $this->request->get['path'] . '&sort=date_modified&order=ASC', '&encode')); $options = array(); foreach ($sorts as $item) { $options[$item['value']] = $item['text']; } $sorting = $this->html->buildSelectbox(array('name' => 'sort', 'options' => $options, 'value' => $sort . '-' . $order)); $this->view->assign('sorting', $sorting); $this->view->assign('url', $this->html->getSEOURL('product/category', '&path=' . $this->request->get['path'])); $pegination_url = $this->html->getSEOURL('product/category', '&path=' . $this->request->get['path'] . '&sort=' . $sorting_href . '&page={page}' . '&limit=' . $limit, '&encode'); $this->view->assign('pagination_bootstrap', HtmlElementFactory::create(array('type' => 'Pagination', 'name' => 'pagination', 'text' => $this->language->get('text_pagination'), 'text_limit' => $this->language->get('text_per_page'), 'total' => $product_total, 'page' => $page, 'limit' => $limit, 'url' => $pegination_url, 'style' => 'pagination'))); $this->view->assign('sort', $sort); $this->view->assign('order', $order); $this->view->setTemplate('pages/product/category.tpl'); } else { $this->document->setTitle($category_info['name']); $this->document->setDescription($category_info['meta_description']); $this->view->assign('heading_title', $category_info['name']); $this->view->assign('text_error', $this->language->get('text_empty')); $this->view->assign('button_continue', $this->language->get('button_continue')); $this->view->assign('continue', $this->html->getURL('index/home')); $this->view->assign('categories', array()); $this->data['products'] = array(); $this->view->setTemplate('pages/product/category.tpl'); } $this->data['review_status'] = $this->config->get('enable_reviews'); $this->view->batchAssign($this->data); } else { $url = ''; 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['path'])) { $this->document->addBreadcrumb(array('href' => $this->html->getSEOURL('product/category', '&path=' . $this->request->get['path'] . $url, '&encode'), 'text' => $this->language->get('text_error'), 'separator' => $this->language->get('text_separator'))); } $this->document->setTitle($this->language->get('text_error')); $this->view->assign('heading_title', $this->language->get('text_error')); $this->view->assign('text_error', $this->language->get('text_error')); $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->view->assign('button_continue', $continue); $this->view->assign('continue', $this->html->getURL('index/home')); $this->view->setTemplate('pages/error/not_found.tpl'); } $this->processTemplate(); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function success() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => false)); $this->document->addBreadcrumb(array('href' => $this->html->getURL('content/contact'), 'text' => $this->language->get('heading_title'), 'separator' => $this->language->get('text_separator'))); if ($this->config->get('embed_mode') == true) { $continue_url = $this->html->getURL('product/category'); } else { $continue_url = $this->html->getURL('index/home'); } $this->view->assign('continue', $continue_url); $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button')); $this->view->assign('continue_button', $continue); if ($this->config->get('embed_mode') == true) { //load special headers $this->addChild('responses/embed/head', 'head'); $this->addChild('responses/embed/footer', 'footer'); $this->processTemplate('embed/common/success.tpl'); } else { $this->processTemplate('common/success.tpl'); } //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); if (!$this->customer->isLogged()) { $this->session->data['redirect'] = $this->html->getSecureURL('account/download'); $this->redirect($this->html->getSecureURL('account/login')); } //if disabled downloads redirect to if (!$this->config->get('config_download')) { $this->redirect($this->html->getSecureURL('account/account')); } $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'))); $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('account/download'), 'text' => $this->language->get('text_downloads'), 'separator' => $this->language->get('text_separator'))); if (isset($this->request->get['limit'])) { $limit = (int) $this->request->get['limit']; $limit = $limit > 50 ? 50 : $limit; } else { $limit = $this->config->get('config_catalog_limit'); } if ($this->config->get('config_download')) { if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } $downloads = array(); //get only enabled, not expired, which have remaining count > 0 and available $customer_downloads = $this->download->getCustomerDownloads(($page - 1) * $limit, $limit); $resource = new AResource('image'); foreach ($customer_downloads as $download_info) { $text_status = $this->download->getTextStatusForOrderDownload($download_info); $size = filesize(DIR_RESOURCE . $download_info['filename']); $i = 0; $suffix = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); while ($size / 1024 > 1) { $size = $size / 1024; $i++; } if (!$text_status) { $link = HtmlElementFactory::create(array('type' => 'button', 'name' => 'download_button_' . $download_info['order_download_id'], 'title' => $this->language->get('text_download'), 'text' => $this->language->get('text_download'), 'style' => 'button', 'href' => $this->html->getSecureURL('account/download/startdownload', '&order_download_id=' . $download_info['order_download_id']), 'icon' => 'icon-download-alt')); } else { $link = $text_status; } $thumbnail = $resource->getMainThumb('products', $download_info['product_id'], $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'), false); $attributes = $this->download->getDownloadAttributesValuesForCustomer($download_info['download_id']); $downloads[] = array('thumbnail' => $thumbnail, 'attributes' => $attributes, 'order_id' => $download_info['order_id'], 'date_added' => dateISO2Display($download_info['date_added'], $this->language->get('date_format_short')), 'name' => $download_info['name'], 'remaining' => $download_info['remaining_count'], 'size' => round(substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i], 'link' => $link, 'expire_date' => dateISO2Display($download_info['expire_date'], $this->language->get('date_format_short') . ' ' . $this->language->get('time_format_short'))); } $this->data['downloads'] = $downloads; $this->data['pagination_bootstrap'] = HtmlElementFactory::create(array('type' => 'Pagination', 'name' => 'pagination', 'text' => $this->language->get('text_pagination'), 'text_limit' => $this->language->get('text_per_page'), 'total' => sizeof($downloads), 'page' => $page, 'limit' => $limit, 'url' => $this->html->getURL('account/download&page={page}', '&encode'), 'style' => 'pagination')); if ($downloads) { $template = 'pages/account/download.tpl'; } else { $template = 'pages/error/not_found.tpl'; } } else { $template = 'pages/error/not_found.tpl'; } $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button', 'icon' => 'icon-arrow-right', 'href' => $this->html->getSecureURL('account/account'))); $this->data['button_continue'] = $continue; $this->view->batchAssign($this->data); $this->processTemplate($template); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $url = ''; if (isset($this->request->get['keyword'])) { $url .= '&keyword=' . $this->request->get['keyword']; } if (isset($this->request->get['category_id'])) { $url .= '&category_id=' . $this->request->get['category_id']; } if (isset($this->request->get['description'])) { $url .= '&description=' . $this->request->get['description']; } if (isset($this->request->get['model'])) { $url .= '&model=' . $this->request->get['model']; } 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']; } $this->document->addBreadcrumb(array('href' => $this->html->getURL('product/search', $url), 'text' => $this->language->get('heading_title'), 'separator' => $this->language->get('text_separator'))); if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } if (isset($this->request->get['sort'])) { list($sort, $order) = explode("-", $this->request->get['sort']); } else { list($sort, $order) = explode("-", $this->config->get('config_product_default_sort_order')); if ($sort == 'name') { $sort = 'pd.' . $sort; } elseif (in_array($sort, array('sort_order', 'price'))) { $sort = 'p.' . $sort; } } $this->data['keyword'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'keyword', 'value' => $this->request->get['keyword'])); $this->data['keyword'] = $this->data['keyword']->getHtml(); $this->loadModel('catalog/category'); $categories = $this->_getCategories(0); $options = array(0 => $this->language->get('text_category')); if ($categories) { foreach ($categories as $item) { $options[$item['category_id']] = $item['name']; } } $this->data['category'] = HtmlElementFactory::create(array('type' => 'selectbox', 'name' => 'category_id', 'options' => $options, 'value' => $this->request->get['category_id'])); $this->data['description'] = HtmlElementFactory::create(array('type' => 'checkbox', 'id' => 'description', 'name' => 'description', 'checked' => (int) $this->request->get['description'], 'value' => 1, 'label_text' => $this->language->get('entry_description'))); $this->data['model'] = HtmlElementFactory::create(array('type' => 'checkbox', 'id' => 'model', 'name' => 'model', 'checked' => (bool) $this->request->get['model'], 'value' => 1, 'label_text' => $this->language->get('entry_model'))); $this->data['submit'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'search_button', 'text' => $this->language->get('button_search'), 'icon' => 'icon-search', 'style' => 'button')); if (isset($this->request->get['keyword'])) { $this->loadModel('catalog/product'); $promoton = new APromotion(); if (isset($this->request->get['category_id'])) { $category_id = explode(',', $this->request->get['category_id']); end($category_id); $category_id = current($category_id); } else { $category_id = ''; } $product_total = $this->model_catalog_product->getTotalProductsByKeyword($this->request->get['keyword'], $category_id, isset($this->request->get['description']) ? $this->request->get['description'] : '', isset($this->request->get['model']) ? $this->request->get['model'] : ''); if ($product_total) { $url = ''; if (isset($this->request->get['category_id'])) { $url .= '&category_id=' . $this->request->get['category_id']; } if (isset($this->request->get['description'])) { $url .= '&description=' . $this->request->get['description']; } if (isset($this->request->get['model'])) { $url .= '&model=' . $this->request->get['model']; } $limit = $this->config->get('config_catalog_limit'); if (isset($this->request->get['limit']) && intval($this->request->get['limit']) > 0) { $limit = intval($this->request->get['limit']); if ($limit > 50) { $limit = 50; } } $this->loadModel('catalog/review'); $this->loadModel('tool/seo_url'); $products = array(); $results = $this->model_catalog_product->getProductsByKeyword($this->request->get['keyword'], $category_id, isset($this->request->get['description']) ? $this->request->get['description'] : '', isset($this->request->get['model']) ? $this->request->get['model'] : '', $sort, $order, ($page - 1) * $limit, $limit); //if single result, redirect to the product if (count($results) == 1) { $this->redirect($this->html->getSEOURL('product/product', '&product_id=' . key($results), '&encode')); } $resource = new AResource('image'); if (is_array($results) && $results) { foreach ($results as $result) { $thumbnail = $resource->getMainThumb('products', $result['product_id'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'), true); if ($this->config->get('enable_reviews')) { $rating = $this->model_catalog_review->getAverageRating($result['product_id']); } else { $rating = false; } $special = FALSE; $discount = $promoton->getProductDiscount($result['product_id']); if ($discount) { $price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax'))); } else { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))); $special = $promoton->getProductSpecial($result['product_id']); if ($special) { $special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax'))); } } $options = $this->model_catalog_product->getProductOptions($result['product_id']); if ($options) { $add = $this->html->getSEOURL('product/product', '&product_id=' . $result['product_id'], '&encode'); } else { if ($this->config->get('config_cart_ajax')) { $add = '#'; } else { $add = $this->html->getSecureURL('checkout/cart', '&product_id=' . $result['product_id'], '&encode'); } } $products[] = array('product_id' => $result['product_id'], 'name' => $result['name'], 'model' => $result['model'], 'rating' => $rating, 'stars' => sprintf($this->language->get('text_stars'), $rating), 'thumb' => $thumbnail, 'price' => $price, 'call_to_order' => $result['call_to_order'], 'options' => $options, 'special' => $special, 'href' => $this->html->getSEOURL('product/product', '&keyword=' . $this->request->get['keyword'] . $url . '&product_id=' . $result['product_id'], '&encode'), 'add' => $add, 'description' => html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')); } } $this->data['products'] = $products; if ($this->config->get('config_customer_price')) { $display_price = TRUE; } elseif ($this->customer->isLogged()) { $display_price = TRUE; } else { $display_price = FALSE; } $this->data['display_price'] = $display_price; $url = ''; if (isset($this->request->get['keyword'])) { $url .= '&keyword=' . $this->request->get['keyword']; } if (isset($this->request->get['category_id'])) { $url .= '&category_id=' . $this->request->get['category_id']; } if (isset($this->request->get['description'])) { $url .= '&description=' . $this->request->get['description']; } if (isset($this->request->get['model'])) { $url .= '&model=' . $this->request->get['model']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $sorts = array(); $sorts[] = array('text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->html->getURL('product/search', $url . '&sort=p.sort_order&order=ASC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->html->getURL('product/search', $url . '&sort=pd.name&order=ASC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->html->getURL('product/search', $url . '&sort=pd.name&order=DESC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->html->getURL('product/search', $url . '&sort=p.price&order=ASC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->html->getURL('product/search', $url . '&sort=p.price&order=DESC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->html->getURL('product/search', $url . '&sort=rating&order=DESC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->html->getURL('product/search', $url . '&sort=rating&order=ASC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_date_desc'), 'value' => 'date_modified-DESC', 'href' => $this->html->getSEOURL('product/search', $url . '&sort=date_modified&order=DESC', '&encode')); $sorts[] = array('text' => $this->language->get('text_sorting_date_asc'), 'value' => 'date_modified-ASC', 'href' => $this->html->getSEOURL('product/search', $url . '&sort=date_modified&order=ASC', '&encode')); $this->data['sorts'] = $sorts; $options = array(); foreach ($sorts as $item) { $options[$item['value']] = $item['text']; } $sorting = $this->html->buildSelectbox(array('name' => 'sort', 'options' => $options, 'value' => $sort . '-' . $order)); $this->data['sorting'] = $sorting; $url = ''; if (isset($this->request->get['keyword'])) { $url .= '&keyword=' . $this->request->get['keyword']; } if (isset($this->request->get['category_id'])) { $url .= '&category_id=' . $this->request->get['category_id']; } if (isset($this->request->get['description'])) { $url .= '&description=' . $this->request->get['description']; } if (isset($this->request->get['model'])) { $url .= '&model=' . $this->request->get['model']; } 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['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $this->data['pagination_bootstrap'] = HtmlElementFactory::create(array('type' => 'Pagination', 'name' => 'pagination', 'text' => $this->language->get('text_pagination'), 'text_limit' => $this->language->get('text_per_page'), 'total' => $product_total, 'page' => $page, 'limit' => $limit, 'url' => $this->html->getURL('product/search', $url . '&page={page}', '&encode'), 'style' => 'pagination')); $this->data['sort'] = $sort; $this->data['order'] = $order; $this->data['limit'] = $limit; } } $this->data['review_status'] = $this->config->get('enable_reviews'); $this->view->batchAssign($this->data); $this->processTemplate('pages/product/search.tpl'); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
public function main() { $error_msg = array(); //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); if ($this->request->server['REQUEST_METHOD'] == 'GET' && isset($this->request->get['product_id'])) { if (isset($this->request->get['option'])) { $option = $this->request->get['option']; } else { $option = array(); } if (isset($this->request->get['quantity'])) { $quantity = $this->request->get['quantity']; } else { $quantity = 1; } unset($this->session->data['shipping_methods']); unset($this->session->data['shipping_method']); unset($this->session->data['payment_methods']); unset($this->session->data['payment_method']); $this->cart->add($this->request->get['product_id'], $quantity, $option); $this->redirect($this->html->getSecureURL('checkout/cart')); } else { if ($this->request->server['REQUEST_METHOD'] == 'POST') { //if this is coupon, validate and apply if (isset($this->request->post['coupon']) && $this->_validateCoupon()) { $this->session->data['coupon'] = $this->request->post['coupon']; $this->data['success'] = $this->session->data['success'] = $this->language->get('text_coupon_success'); //process data $this->extensions->hk_ProcessData($this); } if ($this->error['error_warning']) { $error_msg[] = $this->error['error_warning']; } if (isset($this->request->post['quantity'])) { if (!is_array($this->request->post['quantity'])) { $this->loadModel('catalog/product'); $product_id = $this->request->post['product_id']; if (isset($this->request->post['option'])) { $options = $this->request->post['option']; } else { $options = array(); } if (has_value($this->request->files['option']['name'])) { $am = new AAttribute('product_option'); $fm = new AFile(); foreach ($this->request->files['option']['name'] as $id => $name) { $attribute_data = $am->getAttributeByProductOptionId($id); $file_path_info = $fm->getUploadFilePath($attribute_data['settings']['directory'], $name); $options[$id] = $file_path_info['name']; if ($text_errors = $this->model_catalog_product->validateProductOptions($product_id, $options)) { $this->session->data['error'] = implode('<br>', $text_errors); $this->redirect($_SERVER['HTTP_REFERER']); } elseif (!has_value($name)) { continue; } $file_data = array('option_id' => $id, 'name' => $file_path_info['name'], 'path' => $file_path_info['path'], 'type' => $this->request->files['option']['type'][$id], 'tmp_name' => $this->request->files['option']['tmp_name'][$id], 'error' => $this->request->files['option']['error'][$id], 'size' => $this->request->files['option']['size'][$id]); $file_errors = $fm->validateFileOption($attribute_data['settings'], $file_data); if (has_value($file_errors)) { $this->session->data['error'] = implode('<br/>', $file_errors); $this->redirect($_SERVER['HTTP_REFERER']); } else { $result = move_uploaded_file($file_data['tmp_name'], $file_path_info['path']); if (!$result || $this->request->files['package_file']['error']) { $this->session->data['error'] .= '<br>Error: ' . getTextUploadError($this->request->files['option']['error'][$id]); $this->redirect($_SERVER['HTTP_REFERER']); } } $dataset = new ADataset('file_uploads', 'admin'); $dataset->addRows(array('date_added' => date("Y-m-d H:i:s", time()), 'name' => $file_path_info['name'], 'type' => $file_data['type'], 'section' => 'product_option', 'section_id' => $attribute_data['attribute_id'], 'path' => $file_path_info['path'])); } } if ($text_errors = $this->model_catalog_product->validateProductOptions($product_id, $options)) { $this->session->data['error'] = $text_errors; //send options values back via _GET $url = '&' . http_build_query(array('option' => $this->request->post['option'])); $this->redirect($this->html->getSecureURL('product/product', '&product_id=' . $this->request->post['product_id'] . $url)); } $this->cart->add($this->request->post['product_id'], $this->request->post['quantity'], $options); } else { foreach ($this->request->post['quantity'] as $key => $value) { $this->cart->update($key, $value); } } unset($this->session->data['shipping_methods']); unset($this->session->data['shipping_method']); unset($this->session->data['payment_methods']); unset($this->session->data['payment_method']); #upate min and max $this->cart->setMinQty(); $this->cart->setMaxQty(); } if (isset($this->request->post['remove'])) { foreach (array_keys($this->request->post['remove']) as $key) { $this->cart->remove($key); } } if (isset($this->request->post['redirect'])) { $this->session->data['redirect'] = $this->request->post['redirect']; } if (isset($this->request->post['quantity']) || isset($this->request->post['remove'])) { unset($this->session->data['shipping_methods']); unset($this->session->data['shipping_method']); unset($this->session->data['payment_methods']); unset($this->session->data['payment_method']); $this->redirect($this->html->getSecureURL('checkout/cart')); } } } $this->document->setTitle($this->language->get('heading_title')); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/cart'), 'text' => $this->language->get('text_basket'), 'separator' => $this->language->get('text_separator'))); if ($this->cart->hasProducts()) { if (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) { $error_msg[] = $this->language->get('error_stock'); } $this->loadModel('tool/seo_url'); $products = array(); $resource = new AResource('image'); $form = new AForm(); $form->setForm(array('form_name' => 'cart')); $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'cart', 'action' => $this->html->getSecureURL('checkout/cart'))); $cart_products = $this->cart->getProducts(); foreach ($cart_products as $result) { $option_data = array(); $thumbnail = $resource->getMainThumb('products', $result['product_id'], (int) $this->config->get('config_image_cart_width'), (int) $this->config->get('config_image_cart_height'), true); foreach ($result['option'] as $option) { $option_data[] = array('name' => $option['name'], 'value' => $option['value']); } $products[] = array('remove' => $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'remove[' . $result['key'] . ']')), 'key' => $result['key'], 'name' => $result['name'], 'model' => $result['model'], 'thumb' => $thumbnail, 'option' => $option_data, 'quantity' => $form->getFieldHtml(array('type' => 'input', 'name' => 'quantity[' . $result['key'] . ']', 'value' => $result['quantity'], 'attr' => ' size="3" ', 'style' => 'short')), 'stock' => $result['stock'], 'price' => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))), 'total' => $this->currency->format($this->tax->calculate($result['total'], $result['tax_class_id'], $this->config->get('config_tax'))), 'href' => $this->html->getSEOURL('product/product', '&product_id=' . $result['product_id'], true)); } $this->data['products'] = $products; $this->data['form']['update'] = $form->getFieldHtml(array('type' => 'submit', 'name' => $this->language->get('button_update'))); $this->data['form']['checkout'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'checkout', 'text' => $this->language->get('button_checkout'), 'style' => 'button')); if ($this->config->get('config_cart_weight')) { $this->data['weight'] = $this->weight->format($this->cart->getWeight(), $this->config->get('config_weight_class')); } else { $this->data['weight'] = FALSE; } $display_totals = $this->cart->buildTotalDisplay(); $this->data['totals'] = $display_totals['total_data']; if (isset($this->session->data['redirect'])) { $this->data['continue'] = str_replace('&', '&', $this->session->data['redirect']); unset($this->session->data['redirect']); } else { $this->data['continue'] = $this->html->getURL('index/home'); } $this->data['form']['continue_shopping'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'continue_shopping', 'text' => $this->language->get('button_shopping'), 'style' => 'button', 'href' => $this->data['continue'])); $this->data['checkout'] = $this->html->getSecureURL('checkout/shipping'); #Check if order total max/min is set and met $cf_total_min = $this->config->get('total_order_minimum'); $cf_total_max = $this->config->get('total_order_maximum'); if (!$this->cart->hasMinRequirement()) { $this->data['form']['checkout'] = ''; $error_msg[] = sprintf($this->language->get('error_order_minimum'), $this->currency->format($cf_total_min)); } if (!$this->cart->hasMaxRequirement()) { $this->data['form']['checkout'] = ''; $error_msg[] = sprintf($this->language->get('error_order_maximum'), $this->currency->format($cf_total_max)); } //prepare coupon display if ($this->config->get('config_coupon_on_cart_page')) { $this->view->assign('coupon_status', $this->config->get('coupon_status')); $action = $this->html->getSecureURL('checkout/cart'); $coupon_form = $this->dispatch('blocks/coupon_codes', array('action' => $action)); $this->view->assign('coupon_form', $coupon_form->dispatchGetOutput()); } if ($this->config->get('config_shipping_tax_estimate')) { $form = new AForm(); $form->setForm(array('form_name' => 'estimate')); $this->data['form_estimate']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'estimate', 'action' => $this->html->getSecureURL('checkout/cart'))); $this->data['estimates_enabled'] = true; } //try to get shipping address details if we have them $country_id = $this->config->get('config_country_id'); if ($this->session->data['shipping_address_id']) { $this->loadModel('account/address'); $shipping_address = $this->model_account_address->getAddress($this->session->data['shipping_address_id']); $postcode = $shipping_address['postcode']; $country_id = $shipping_address['country_id']; $zone_id = $shipping_address['zone_id']; } // use default address of customer for estimate form whe shipping address is unknown if (!$zone_id && $this->customer->isLogged()) { $this->loadModel('account/address'); $payment_address = $this->model_account_address->getAddress($this->customer->getAddressId()); $postcode = $payment_address['postcode']; $country_id = $payment_address['country_id']; $zone_id = $payment_address['zone_id']; } if ($this->request->post['postcode']) { $postcode = $this->request->post['postcode']; } if ($this->request->post['country'][0]) { $country_id = $this->request->post['country'][0]; } if ($this->request->post['country_zones'][0]) { $zone_id = $this->request->post['country_zones'][0]; } if ($zone_id) { $this->loadModel('localisation/zone'); $zone_data = $this->model_localisation_zone->getZone($zone_id); } $this->data['form_estimate']['postcode'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'postcode', 'value' => $postcode, 'style' => 'short')); $this->data['form_estimate']['country_zones'] = $form->getFieldHtml(array('type' => 'zones', 'name' => 'country', 'submit_mode' => 'id', 'value' => $country_id, 'zone_name' => $zone_data['name'], 'zone_value' => $zone_id)); $this->data['form_estimate']['submit'] = $form->getFieldHtml(array('type' => 'submit', 'name' => $this->language->get('button_text_estimate'))); $this->view->assign('error_warning', $error_msg); $this->view->setTemplate('pages/checkout/cart.tpl'); } else { $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['text_error'] = $this->language->get('text_error'); $this->data['button_continue'] = HtmlElementFactory::create(array('name' => 'continue', 'type' => 'button', 'text' => $this->language->get('button_continue'), 'href' => $this->html->getURL('index/home'), 'style' => 'button')); $this->view->setTemplate('pages/error/not_found.tpl'); } $this->view->batchAssign($this->data); $this->processTemplate(); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }