当前位置: 首页>>代码示例>>PHP>>正文


PHP has_value函数代码示例

本文整理汇总了PHP中has_value函数的典型用法代码示例。如果您正苦于以下问题:PHP has_value函数的具体用法?PHP has_value怎么用?PHP has_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了has_value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

 public function main()
 {
     $this->loadLanguage('default_banktransfer/default_banktransfer');
     $this->view->assign('text_instructions', $this->language->get('text_instructions'));
     $this->view->assign('text_payment', $this->language->get('text_payment'));
     $this->view->batchAssign($this->language->getASet());
     $lang_id = $this->language->getLanguageID();
     $instructions = $this->config->get('default_banktransfer_instructions_' . $lang_id);
     if (!$instructions) {
         $this->messages->saveError('default_banktransfer error', 'Please, set instructions for all languages!');
         $lang_id = $this->language->getDefaultLanguageID();
         $instructions = $this->config->get('default_banktransfer_instructions_' . $lang_id);
     }
     if (!$instructions) {
         $this->messages->saveError('default_banktransfer error', 'Please, set instructions for all languages!');
     }
     $this->view->assign('instructions', nl2br($instructions));
     $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', '', true));
     } else {
         $this->view->assign('back', $this->html->getSecureURL('checkout/guest_step_2', '', true));
     }
     //check total for to meat min requirement
     if (has_value($this->config->get('default_banktransfer_order_min'))) {
         if ($this->cart->getTotal() < $this->config->get('default_banktransfer_order_min')) {
             $this->view->assign('minimum_notmet', $this->language->get('text_minimum_notmet'));
         }
     }
     $this->processTemplate('responses/default_banktransfer.tpl');
 }
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:31,代码来源:default_banktransfer.php

示例2: main

 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->document->setTitle($this->language->get('heading_title'));
     $this->form = new AForm('ContactUsFrm');
     $this->form->loadFromDb('ContactUsFrm');
     $form = $this->form->getForm();
     if ($this->request->is_POST() && $this->_validate()) {
         // move all uploaded files to their directories
         $file_pathes = $this->form->processFileUploads($this->request->files);
         $mail = new AMail($this->config);
         $mail->setTo($this->config->get('store_main_email'));
         $mail->setFrom($this->request->post['email']);
         $mail->setSender($this->request->post['first_name']);
         $mail->setSubject(sprintf($this->language->get('email_subject'), $this->request->post['name']));
         $msg = $this->request->post['enquiry'] . "\r\n";
         $form_fields = $this->form->getFields();
         foreach ($form_fields as $field_name => $field_info) {
             if (has_value($this->request->post[$field_name]) && !in_array($field_name, array('first_name', 'email', 'enquiry', 'captcha'))) {
                 $field_details = $this->form->getField($field_name);
                 $msg .= "\r\n" . rtrim($field_details['name'], ':') . ":\t" . $this->request->post[$field_name];
             }
         }
         if ($file_pathes) {
             $msg .= "\r\n" . $this->language->get('entry_attached') . ": \r\n";
             foreach ($file_pathes as $file_info) {
                 $basename = pathinfo(str_replace(' ', '_', $file_info['path']), PATHINFO_BASENAME);
                 $msg .= "\t" . $file_info['display_name'] . ': ' . $basename . " (" . round(filesize($file_info['path']) / 1024, 2) . "Kb)\r\n";
                 $mail->addAttachment($file_info['path'], $basename);
             }
         }
         $mail->setText(strip_tags(html_entity_decode($msg, ENT_QUOTES, 'UTF-8')));
         $mail->send();
         //get success_page
         if ($form['success_page']) {
             $success_url = $this->html->getSecureURL($form['success_page']);
         } else {
             $success_url = $this->html->getSecureURL('content/contact/success');
         }
         $this->redirect($success_url);
     }
     if ($this->request->is_POST()) {
         foreach ($this->request->post as $name => $value) {
             $this->form->assign($name, $value);
         }
     }
     $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('form_output', $this->form->getFormHtml());
     $this->view->assign('action', $this->html->getURL('content/contact'));
     $this->view->assign('store', $this->config->get('store_name'));
     $this->view->assign('address', nl2br($this->config->get('config_address')));
     $this->view->assign('telephone', $this->config->get('config_telephone'));
     $this->view->assign('fax', $this->config->get('config_fax'));
     $this->processTemplate('pages/content/contact.tpl');
     //init controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info-store,代码行数:60,代码来源:contact.php

示例3: complete

 public function complete()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $task_id = (int) $this->request->post['task_id'];
     if (!$task_id) {
         return null;
     }
     //check task result
     $tm = new ATaskManager();
     $task_info = $tm->getTaskById($task_id);
     $task_result = $task_info['last_result'];
     if ($task_result) {
         $tm->deleteTask($task_id);
         $result_text = sprintf($this->language->get('text_success_sent'), $task_info['settings']['sent']);
         if (has_value($this->session->data['sale_contact_presave'])) {
             unset($this->session->data['sale_contact_presave']);
         }
     } else {
         $result_text = $this->language->get('text_task_failed');
     }
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->load->library('json');
     $this->response->addJSONHeader();
     $this->response->setOutput(AJson::encode(array('result' => $task_result, 'result_text' => $result_text)));
 }
开发者ID:siddht1,项目名称:abantecart-src,代码行数:27,代码来源:contact.php

示例4: dumpTables

 public function dumpTables()
 {
     if ($this->request->get['eta'] > 30) {
         set_time_limit((int) $this->request->get['eta'] * 2);
     }
     $backup_name = preg_replace('[^0-9A-z_\\.]', '', $this->request->get['backup_name']);
     $backup_name = !$backup_name ? 'manual_backup' : $backup_name;
     $bkp = new ABackup($backup_name);
     if (has_value($this->request->get['sql_dump_mode'])) {
         $bkp->sql_dump_mode = $this->request->get['sql_dump_mode'];
     }
     if (has_value($this->request->get['table_list'])) {
         $table_list = $this->request->get['table_list'];
     }
     if (!$table_list) {
         $this->loadModel('tool/backup');
         $table_list = $this->model_tool_backup->getTables();
     }
     $result = $bkp->dumpTables($table_list);
     if ($result) {
         $this->load->library('json');
         $this->response->addJSONHeader();
         $output = array('result' => true);
         $this->response->setOutput(AJson::encode($output));
     } else {
         $error = new AError('dump tables error');
         return $error->toJSONResponse('APP_ERROR_402', array('error_text' => $bkp->error, 'reset_value' => true));
     }
 }
开发者ID:vglide,项目名称:abantecart-src,代码行数:29,代码来源:backup.php

示例5: _get_refund_form

 private function _get_refund_form($data = array(), $payment_method_data = array(), $not_refunded = 0)
 {
     $refunded_amount = has_value($payment_method_data['refunded_amount']) ? (double) $payment_method_data['refunded_amount'] : 0;
     if ($not_refunded) {
         $data['add_to_capture'] = true;
         $not_refunded = (double) $not_refunded;
     } else {
         $data['add_to_capture'] = false;
         $not_refunded = (double) $payment_method_data['AMT'];
     }
     $data['payment_status'] = $this->baseObject->language->get('text_processing');
     if ((double) $refunded_amount > 0) {
         $data['payment_status'] = $this->baseObject->language->get('text_partially_refunded');
         $data['refunded_amount'] = $this->baseObject->currency->format($refunded_amount, $this->baseObject->data['currency']['code'], $this->baseObject->data['order_info']['value']);
     }
     if ((double) $refunded_amount < $not_refunded) {
         $data['pp_refund_amount'] = $this->baseObject->html->buildInput(array('name' => 'pp_refund_amount', 'value' => $not_refunded - $refunded_amount, 'style' => 'no-save'));
         $data['text_do_paypal_refund'] = $this->baseObject->language->get('text_do_paypal_refund');
         $data['pp_refund_submit'] = $this->baseObject->html->buildButton(array('text' => $this->baseObject->language->get('text_refund'), 'name' => 'pp_refund_submit', 'style' => 'button3'));
         $params = '&order_id=' . (int) $this->baseObject->data['order_info']['order_id'] . '&currency=' . $this->baseObject->data['currency']['code'];
         if ($data['add_to_capture']) {
             $params .= '&refund_captured=1';
         }
         $data['pp_refund_action'] = $this->baseObject->html->getSecureURL('r/extension/default_pp_pro/refund', $params);
     } else {
         $data['payment_status'] = $this->baseObject->language->get('text_refunded');
     }
     $data['text_already_refunded'] = $this->baseObject->language->get('text_already_refunded');
     $data['error_wrong_amount'] = $this->baseObject->language->get('error_wrong_amount');
     $view = new AView(Registry::getInstance(), 0);
     $view->batchAssign($data);
     $this->baseObject->view->addHookVar('order_details', $view->fetch('pages/extension/paypal_refund.tpl'));
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:33,代码来源:default_pp_pro.php

示例6: names

 public function names()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $stdout = '';
     if (has_value($this->request->get['country_name'])) {
         $country_name = $this->request->get['country_name'];
         $stdout = '<option value="FALSE">' . $this->language->get('text_select') . '</option>';
         $this->loadModel('localisation/zone');
         $country_id = $this->model_localisation_zone->getCountryIdByName($country_name);
         $results = $this->model_localisation_zone->getZonesByCountryId($country_id);
         foreach ($results as $result) {
             $stdout .= '<option value="' . $result['name'] . '"';
             if (isset($this->request->get['zone_name']) && $this->request->get['zone_name'] == $result['name']) {
                 $stdout .= ' selected="selected"';
             }
             $stdout .= '>' . $result['name'] . '</option>';
         }
         if (!$results) {
             if (!$this->request->get['zone_name']) {
                 $stdout .= '<option value="0" selected="selected">' . $this->language->get('text_none') . '</option>';
             } else {
                 $stdout .= '<option value="0">' . $this->language->get('text_none') . '</option>';
             }
         }
     }
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->response->setOutput($stdout, $this->config->get('config_compression'));
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:30,代码来源:zone.php

示例7: main

 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']);
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:32,代码来源:unsubscribe.php

示例8: get

 public function get()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('sale/order');
     $this->loadModel('sale/order');
     $request = $this->rest->getRequestParams();
     if (!has_value($request['customer_id'])) {
         $this->rest->setResponseData(array('Error' => 'Customer ID is missing'));
         $this->rest->sendResponse(200);
         return null;
     }
     $filter = array('filter_customer_id' => $request['customer_id'], 'sort' => 'o.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => 20);
     if ($request['start']) {
         $filter['start'] = (int) $request['start'];
     }
     if ($request['limit']) {
         $filter['limit'] = (int) $request['limit'];
     }
     $orders = $this->model_sale_order->getOrders($filter);
     if (!count($orders)) {
         $this->rest->setResponseData(array('Message' => 'No order records found for the customer'));
         $this->rest->sendResponse(200);
         return null;
     }
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->rest->setResponseData($orders);
     $this->rest->sendResponse(200);
 }
开发者ID:siddht1,项目名称:abantecart-src,代码行数:29,代码来源:orders.php

示例9: get

 public function get()
 {
     $customer_details = array();
     $customer_addresses = array();
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadModel('sale/customer');
     $this->loadModel('sale/customer_group');
     $request = $this->rest->getRequestParams();
     if (!has_value($request['customer_id'])) {
         $this->rest->setResponseData(array('Error' => 'Customer ID is missing'));
         $this->rest->sendResponse(200);
         return;
     }
     $customer_details = $this->model_sale_customer->getCustomer($request['customer_id']);
     if (!count($customer_details)) {
         $this->rest->setResponseData(array('Error' => 'Incorrect Customer ID or missing customer data'));
         $this->rest->sendResponse(200);
         return;
     }
     //clean up data before display
     unset($customer_details['password']);
     unset($customer_details['cart']);
     $cst_grp = $this->model_sale_customer_group->getCustomerGroup($customer_details['customer_group_id']);
     $customer_details['customer_group'] = $cst_grp['name'];
     $customer_addresses = $this->model_sale_customer->getAddressesByCustomerId($request['customer_id']);
     $customer_details['addresses'] = $customer_addresses;
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->rest->setResponseData($customer_details);
     $this->rest->sendResponse(200);
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:31,代码来源:details.php

示例10: main

 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('sale/customer');
     $this->loadModel('sale/customer');
     $this->load->library('json');
     $approved = array(1 => $this->language->get('text_yes'), 0 => $this->language->get('text_no'));
     $page = $this->request->post['page'];
     // get the requested page
     $limit = $this->request->post['rows'];
     // get how many rows we want to have into the grid
     $sidx = $this->request->post['sidx'];
     // get index row - i.e. user click to sort
     $sord = $this->request->post['sord'];
     // get the direction
     $data = array('sort' => $sidx, 'order' => $sord, 'start' => ($page - 1) * $limit, 'limit' => $limit);
     if (has_value($this->request->get['customer_group'])) {
         $data['filter']['customer_group_id'] = $this->request->get['customer_group'];
     }
     if (has_value($this->request->get['status'])) {
         $data['filter']['status'] = $this->request->get['status'];
     }
     if (has_value($this->request->get['approved'])) {
         $data['filter']['approved'] = $this->request->get['approved'];
     }
     $allowedFields = array('name', 'email');
     if (isset($this->request->post['_search']) && $this->request->post['_search'] == 'true') {
         $searchData = AJson::decode(htmlspecialchars_decode($this->request->post['filters']), true);
         foreach ($searchData['rules'] as $rule) {
             if (!in_array($rule['field'], $allowedFields)) {
                 continue;
             }
             $data['filter'][$rule['field']] = $rule['data'];
         }
     }
     $total = $this->model_sale_customer->getTotalCustomers($data);
     if ($total > 0) {
         $total_pages = ceil($total / $limit);
     } else {
         $total_pages = 0;
     }
     $response = new stdClass();
     $response->page = $page;
     $response->total = $total_pages;
     $response->records = $total;
     $results = $this->model_sale_customer->getCustomers($data);
     $i = 0;
     foreach ($results as $result) {
         $response->rows[$i]['id'] = $result['customer_id'];
         $response->rows[$i]['cell'] = array($result['name'], '<a href="' . $this->html->getSecureURL('sale/contact', '&email[]=' . $result['email']) . '">' . $result['email'] . '</a>', $result['customer_group'], $this->html->buildCheckbox(array('name' => 'status[' . $result['customer_id'] . ']', 'value' => $result['status'], 'style' => 'btn_switch')), $this->html->buildSelectbox(array('name' => 'approved[' . $result['customer_id'] . ']', 'value' => $result['approved'], 'options' => $approved)), $result['orders_count'] > 0 ? $this->html->buildButton(array('name' => 'view orders', 'text' => $result['orders_count'], 'style' => 'button2', 'href' => $this->html->getSecureURL('sale/order', '&customer_id=' . $result['customer_id']), 'title' => $this->language->get('text_view') . ' ' . $this->language->get('tab_history'), 'target' => '_blank')) : 0);
         $i++;
     }
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->response->setOutput(AJson::encode($response));
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:57,代码来源:customer.php

示例11: product

 public function product()
 {
     if (!has_value($this->request->get['product_id'])) {
         return null;
     }
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $form = new AForm('ST');
     $form->setForm(array('form_name' => 'getEmbedFrm'));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'getEmbedFrm', 'attr' => 'class="aform form-horizontal"'));
     $this->data['fields'][] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'image', 'value' => 1, 'style' => 'btn_switch btn-group-xs'));
     $this->data['fields'][] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'name', 'value' => 1, 'style' => 'btn_switch btn-group-xs'));
     $this->data['fields'][] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'blurb', 'value' => 1, 'style' => 'btn_switch btn-group-xs'));
     $this->data['fields'][] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'price', 'value' => 1, 'style' => 'btn_switch btn-group-xs'));
     $this->data['fields'][] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'rating', 'value' => 1, 'style' => 'btn_switch btn-group-xs'));
     $this->data['fields'][] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'quantity', 'value' => 1, 'style' => 'btn_switch btn-group-xs'));
     $this->data['fields'][] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'addtocart', 'value' => 1, 'style' => 'btn_switch btn-group-xs'));
     $results = $this->language->getAvailableLanguages();
     $languages = $language_codes = array();
     foreach ($results as $v) {
         $languages[$v['code']] = $v['name'];
         $lng_code = $this->language->getLanguageCodeByLocale($v['locale']);
         $language_codes[$lng_code] = $v['name'];
     }
     $this->data['fields'][] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'language', 'value' => $this->config->get('config_storefront_language'), 'options' => $language_codes));
     $this->load->model('localisation/currency');
     $results = $this->model_localisation_currency->getCurrencies();
     $currencies = array();
     foreach ($results as $v) {
         $currencies[$v['code']] = $v['title'];
     }
     $this->data['fields'][] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'currency', 'value' => $this->config->get('config_currency'), 'options' => $currencies));
     $this->data['text_area'] = $form->getFieldHtml(array('type' => 'textarea', 'name' => 'code_area', 'attr' => 'rows="10"', 'style' => 'ml_field'));
     $this->loadModel('catalog/product');
     $this->loadModel('setting/store');
     //if loaded not default store - hide store switcher
     $current_store_settings = $this->model_setting_store->getStore($this->config->get('config_store_id'));
     $remote_store_url = $current_store_settings['config_url'];
     $product_id = $this->request->get['product_id'];
     $this->data['product_id'] = $product_id;
     $product_stores = $this->model_catalog_product->getProductStoresInfo($product_id);
     if (sizeof($product_stores) == 1) {
         $remote_store_url = $product_stores[0]['store_url'];
     }
     $this->data['sf_js_embed_url'] = $remote_store_url . INDEX_FILE . '?rt=r/embed/js';
     $this->data['sf_base_url'] = $remote_store_url;
     $this->data['help_url'] = $this->gen_help_url('embed');
     $this->data['sf_css_embed_url'] = $remote_store_url . 'storefront/view/' . $this->config->get('config_storefront_template') . '/stylesheet/embed.css';
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->loadlanguage('common/do_embed');
     $this->view->batchAssign($this->language->getASet('common/do_embed'));
     $this->view->batchAssign($this->data);
     $this->processTemplate('responses/embed/do_embed_product_modal.tpl');
 }
开发者ID:siddht1,项目名称:abantecart-src,代码行数:55,代码来源:do_embed.php

示例12: getField

 /**
  * @param int $field_id
  * @return array
  */
 public function getField($field_id)
 {
     $result = $this->db->query('SELECT * FROM ' . $this->db->table('fields') . ' WHERE field_id =	"' . (int) $field_id . '"');
     if ($result->num_rows) {
         if (has_value($result->row['settings'])) {
             $result->row['settings'] = unserialize($result->row['settings']);
         }
         return $result->row;
     }
     return array();
 }
开发者ID:siddht1,项目名称:abantecart-src,代码行数:15,代码来源:file_uploads.php

示例13: _validate_ip

 private function _validate_ip()
 {
     if (!has_value($this->config->get('config_admin_access_ip_list'))) {
         return true;
     }
     $ips = array_map('trim', explode(",", $this->config->get('config_admin_access_ip_list')));
     if (in_array($_SERVER['REMOTE_ADDR'], $ips)) {
         return true;
     }
     return false;
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:11,代码来源:access.php

示例14: getCustomerTransactions

 public function getCustomerTransactions($data = array(), $mode = '')
 {
     // get decrypted customer name first
     $this->load->model('sale/customer');
     $customer_info = $this->model_sale_customer->getCustomer((int) $data['customer_id']);
     $sql = "SELECT *, t.date_added, t.date_modified,\n\t\t\t\tCASE\n\t\t\t\t\tWHEN t.section=1\n\t\t\t\t\t\tTHEN CONCAT(u.firstname,' ',u.lastname, ' (',u.username,')')\n\t\t\t\t\tELSE\n\t\t\t\t\t\t'" . $customer_info['firstname'] . ' ' . $customer_info['lastname'] . "'\n\t\t\t\t\t END as user\n\t\t\t\tFROM " . $this->db->table("customer_transactions") . " t\n\t\t\t\tLEFT JOIN " . $this->db->table("users") . " u ON u.user_id = t.created_by\n\t\t\t\tWHERE t.customer_id = '" . (int) $data['customer_id'] . "'";
     $filter = isset($data['filter']) ? $data['filter'] : array();
     $implode = array();
     if (has_value($filter['date_start']) && has_value($filter['date_end'])) {
         $implode[] = "DATE(t.date_added) BETWEEN DATE('" . $this->db->escape($filter['date_start']) . "') AND DATE('" . $this->db->escape($filter['date_end']) . "')";
     }
     if (has_value($filter['debit'])) {
         $implode[] = "ROUND(t.debit,2) = '" . round((double) $filter['debit'], 2) . "'";
     }
     if (has_value($filter['credit'])) {
         $implode[] = "ROUND(t.credit,2) = '" . round((double) $filter['credit'], 2) . "'";
     }
     if (has_value($filter['transaction_type'])) {
         $implode[] = "t.transaction_type like '%" . $this->db->escape($filter['transaction_type']) . "%'";
     }
     if (has_value($filter['user'])) {
         $implode[] = "LOWER(CASE\n\t\t\t\t\t\t\t\tWHEN t.section=1\n\t\t\t\t\t\t\t\t\tTHEN CONCAT(u.firstname,' ',u.lastname, ' (',u.username,')')\n\t\t\t\t\t\t\t\tELSE\n\t\t\t\t\t\t\t\t\t'" . $customer_info['firstname'] . ' ' . $customer_info['lastname'] . "'\n\t\t\t\t\t\t\t\t END) like '%" . mb_strtolower($this->db->escape($filter['user'])) . "%'";
     }
     if ($implode) {
         $sql .= " AND " . implode(" AND ", $implode);
     }
     //If for total, we done bulding the query
     if ($mode == 'total_only') {
         $query = $this->db->query($sql);
         return $query->num_rows;
     }
     $sort_data = array('t.date_added', 'user', 'debit', 'credit', 'transaction_type');
     if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
         $sql .= " ORDER BY " . $data['sort'];
     } else {
         $sql .= " ORDER BY t.date_added";
     }
     if (isset($data['order']) && strtoupper($data['order']) == 'DESC') {
         $sql .= " DESC";
     } else {
         $sql .= " ASC";
     }
     if (isset($data['start']) || isset($data['limit'])) {
         if ($data['start'] < 0) {
             $data['start'] = 0;
         }
         if ($data['limit'] < 1) {
             $data['limit'] = 20;
         }
         $sql .= " LIMIT " . (int) $data['start'] . "," . (int) $data['limit'];
     }
     $query = $this->db->query($sql);
     return $query->rows;
 }
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:54,代码来源:customer_transaction.php

示例15: main

 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('blocks/manufacturer');
     $this->view->assign('heading_title', $this->language->get('heading_title'));
     $this->view->assign('text_select', $this->language->get('text_select'));
     //For product page show only brand icon
     if (isset($this->request->get['product_id']) && is_int($this->request->get['product_id'])) {
         $product_id = $this->request->get['product_id'];
         $this->view->assign('product_id', $product_id);
         $result = $this->model_catalog_manufacturer->getManufacturerByProductId($product_id);
         $manuf_detls = $result[0];
         $resource = new AResource('image');
         $thumbnail = $resource->getMainThumb('manufacturers', $manuf_detls['manufacturer_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), true);
         $manufacturer = array('manufacturer_id' => $manuf_detls['manufacturer_id'], 'name' => $manuf_detls['name'], 'href' => $this->html->getSEOURL('product/manufacturer', '&manufacturer_id=' . $manuf_detls['manufacturer_id'], '&encode'), 'icon' => $thumbnail['thumb_url']);
         $this->view->assign('manufacturer', $manufacturer);
     } else {
         if (isset($this->request->get['manufacturer_id']) && is_int($this->request->get['manufacturer_id'])) {
             $manufacturer_id = $this->request->get['manufacturer_id'];
         } else {
             $manufacturer_id = 0;
         }
         $this->view->assign('manufacturer_id', $manufacturer_id);
         $this->loadModel('catalog/manufacturer');
         $manufacturers = array();
         $results = $this->model_catalog_manufacturer->getManufacturers();
         $thumbnail_list = $this->cache->get('manufacturer.block.thumbnals', '', (int) $this->config->get('config_store_id'));
         $is_cache_exists = $this->cache->exists('manufacturer.block.thumbnals', '', (int) $this->config->get('config_store_id'));
         $resource = new AResource('image');
         foreach ($results as $result) {
             if (!$is_cache_exists) {
                 $thumbnail = $resource->getMainThumb('manufacturers', $result['manufacturer_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), true);
                 $thumbnails_cache[$result['manufacturer_id']] = $thumbnail;
             } else {
                 if (has_value($thumbnail_list[$result['manufacturer_id']])) {
                     $thumbnail = $thumbnail_list[$result['manufacturer_id']];
                 }
             }
             $manufacturers[] = array('manufacturer_id' => $result['manufacturer_id'], 'name' => $result['name'], 'href' => $this->html->getSEOURL('product/manufacturer', '&manufacturer_id=' . $result['manufacturer_id'], '&encode'), 'icon' => $thumbnail);
         }
         if (!$is_cache_exists) {
             $this->cache->set('manufacturer.block.thumbnals', $thumbnails_cache, '', (int) $this->config->get('config_store_id'));
         }
         $this->view->assign('manufacturers', $manufacturers);
     }
     // framed needs to show frames for generic block.
     //If tpl used by listing block framed was set by listing block settings
     $this->view->assign('block_framed', true);
     $this->processTemplate('blocks/manufacturer.tpl');
     //init controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:53,代码来源:manufacturer.php


注:本文中的has_value函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。