コード例 #1
0
 function isActive()
 {
     global $application;
     $tables = Configuration::getTables();
     $columns = $tables['store_settings']['columns'];
     $result_rows = array();
     $query = new DB_Select();
     $query->addSelectField($columns['value'], 'value');
     $query->WhereValue($columns['name'], DB_EQ, 'enable_error_document');
     $result_rows = $application->db->getDB_Result($query);
     return $result_rows[0]['value'];
 }
コード例 #2
0
 function getSettings()
 {
     global $application;
     $tables = $this->getTables();
     $query = new DB_Select();
     $query->addSelectTable('frg_settings');
     $query->addSelectField('*');
     $res = $application->db->getDB_Result($query);
     $settings = array();
     foreach ($res as $k => $sval) {
         $settings[$sval['setting_key']] = $sval['setting_value'];
     }
     return $settings;
 }
コード例 #3
0
 function getOrderList()
 {
     global $application;
     $tables = modApiFunc('Checkout', 'getTables');
     $o = $tables['orders']['columns'];
     $request =& $application->getInstance('Request');
     $order_id_list = $request->getValueByKey('order_id');
     $export_all = $request->getValueByKey('export_all');
     //                                        id-
     $query = new DB_Select();
     $query->addSelectField($o['id'], 'id');
     if ($export_all == null || $export_all == 'false') {
         $query->WhereField($o['id'], DB_IN, ' (' . implode(',', $order_id_list) . ') ');
     }
     $result = $application->db->getDB_Result($query);
     $plain_list = array();
     foreach ($result as $item) {
         $plain_list[] = $item['id'];
     }
     return $plain_list;
 }
 function validateOrder($orderID)
 {
     if (ltrim($_GET[WebToPay::PREFIX . 'orderid'], "0") != $orderID) {
         exit('Order ID mismatch!');
     }
     global $application;
     $msg =& $application->getInstance('MessageResources', "payment-module-wtp-messages", "AdminZone");
     $moduleData = $this->getSettings();
     $query = new DB_Select();
     $query->addSelectTable('order_prices');
     $query->addSelectField('*');
     $query->WhereValue('order_id', DB_EQ, $orderID);
     $Order = $application->db->getDB_Result($query);
     try {
         WebToPay::toggleSS2(true);
         $response = WebToPay::checkResponse($_GET, array('projectid' => $moduleData['MODULE_METHOD_ID'], 'sign_password' => $moduleData['MODULE_METHOD_PASS']));
     } catch (Exception $e) {
         exit(get_class($e) . ': ' . $e->getMessage());
     }
     if (intval(number_format($Order[0]['order_total'], 2, '', '')) > $_GET[WebToPay::PREFIX . 'amount']) {
         exit('Bad amount!');
     } else {
         if ($Order[0]['currency_code'] != $_GET[WebToPay::PREFIX . 'currency']) {
             exit('Bad currency!');
         } else {
             modApiFunc("Checkout", "UpdatePaymentStatusInDB", $orderID, 2, 'Payment accepted.');
             exit('OK');
         }
     }
 }
コード例 #5
0
 /**
  *        -                                   .  . .           sort_order
  *                                   .
  *
  */
 function generateCreditCardTypeSortOrder()
 {
     global $application;
     $tables = $this->getTables();
     $columns = $tables['credit_card_settings']['columns'];
     $query = new DB_Select();
     $query->addSelectField($query->fMax($columns['sort_order']), 'max');
     $result = $application->db->getDB_Result($query);
     return $result[0]['max'] + 1;
 }
コード例 #6
0
 function __getMaxSortOrderOfProductImages($product_id)
 {
     global $application;
     $tables = $this->getTables();
     $imgs_table = $tables['pi_images']['columns'];
     $query = new DB_Select();
     $query->addSelectField($query->fMax($imgs_table['sort_order']), 'max_sort_order');
     $query->WhereValue($imgs_table['product_id'], DB_EQ, $product_id);
     $res = $application->db->getDB_Result($query);
     return $res[0]['max_sort_order'];
 }
コード例 #7
0
 function __getMaxSortOrderOfManufacturers()
 {
     global $application;
     $tables = $this->getTables();
     $mnf_table = $tables['manufacturers']['columns'];
     $query = new DB_Select();
     $query->addSelectField($query->fMax($mnf_table['sort_order']), 'max_sort_order');
     $res = $application->db->getDB_Result($query);
     return $res[0]['max_sort_order'];
 }
コード例 #8
0
 function getCFldValues()
 {
     global $application;
     $values = "";
     if ($this->mode == "add") {
         $values = "";
         if (isset($this->field_data['postdata']['customFieldValues'])) {
             $values = $this->field_data['postdata']['customFieldValues'];
         }
     } else {
         $itid = $this->field_data[0]['input_type_id'];
         $tables = modAPIFunc("Catalog", "getTables");
         $t_input_type_values = $tables['input_type_values']['columns'];
         $query = new DB_Select();
         $query->setMultiLangAlias('_ml_value', 'input_type_values', $t_input_type_values['value'], $t_input_type_values['id'], 'Catalog');
         $query->addSelectField($query->getMultiLangAlias('_ml_value'), 'value');
         $query->WhereValue($t_input_type_values['it_id'], DB_EQ, $itid);
         $query->SelectOrder($t_input_type_values['id'], 'ASC');
         $result = $application->db->getDB_Result($query);
         foreach ($result as $r) {
             $values .= modApiFunc('Catalog', 'getInputTypeActualValue', $r['value']) . "\n";
         }
     }
     return "<textarea class=\"form-control\"" . $this->HtmlForm->genInputTextAreaField(20, 'customFieldValues', 5) . " id='customFieldValues' disabled=disabled>" . $values . "</textarea>";
 }
コード例 #9
0
 function initQuery($params)
 {
     $key = $params['key'];
     $otables = Customer_Account::getTables();
     $atable = 'ca_person_info_attrs';
     $gtable = 'ca_attrs_to_groups';
     $dtable = 'ca_person_info_data';
     $stables = Subscriptions::getTables();
     $stable = 'subscription_temp';
     $this->setModifiers(DB_IGNORE);
     $this->setInsertFields(array($stables[$stable]['columns']['action_key']));
     $this->setInsertFields(array($stables[$stable]['columns']['email']));
     $squery = new DB_Select($dtable);
     $squery->addSelectField(DBQuery::quoteValue($key));
     $squery->addSelectField(DBQuery::fLower($otables[$dtable]['columns']['data_value']));
     $squery->addInnerJoin($gtable, $otables[$dtable]['columns']['ag_id'], DB_EQ, $otables[$gtable]['columns']['ag_id']);
     $squery->addInnerJoin($atable, $otables[$gtable]['columns']['attr_id'], DB_EQ, $otables[$atable]['columns']['attr_id']);
     $squery->WhereValue($otables[$atable]['columns']['attr_name'], DB_EQ, 'Email');
     $this->setSelectQuery($squery);
     unset($squery);
 }
コード例 #10
0
 /**
  * Checks if options are used during InventoryTracking.
  *
  * @param array $oids - index array of option IDs
  * @return bool; true if at least one option is used, false no option is used
  */
 function __isUsedForIT($oids)
 {
     global $application;
     $tables = $this->getTables();
     $options_table = $tables['po_options']['columns'];
     $query = new DB_Select();
     $query->addSelectField($options_table['use_for_it'], 'use_for_it');
     $query->addSelectField($query->fCount('*'), 'uit_cnt');
     $query->Where($options_table['option_id'], DB_IN, "('" . implode("','", $oids) . "')");
     $query->SelectGroup($options_table['use_for_it']);
     $res = $application->db->getDB_Result($query);
     for ($i = 0; $i < count($res); $i++) {
         if ($res[$i]["use_for_it"] == "Y" and $res[$i]["uit_cnt"] > 0) {
             return true;
         }
     }
     return false;
 }
コード例 #11
0
 function getSettingsRaw()
 {
     global $application;
     $tables = $this->getTables();
     $s = $tables['localization_settings']['columns'];
     $query = new DB_Select();
     $query->addSelectField($s["key"], "setting_key");
     $query->addSelectField($s["val"], "setting_val");
     $result = $application->db->getDB_Result($query);
     $settings = array();
     foreach ($result as $value) {
         $settings[$value["setting_key"]] = $value["setting_val"];
     }
     return $settings;
 }
コード例 #12
0
 function getTaxFormulaViewFull($tax_rate_id, $specific_rate = "")
 {
     if (!$tax_rate_id || $tax_rate_id == 0) {
         return "";
     }
     global $application;
     $MessageResources =& $application->getInstance('MessageResources');
     $tables = $this->getTables();
     $tr = $tables['tax_rates']['columns'];
     $tn = $tables['tax_names']['columns'];
     $query = new DB_Select();
     $query->addSelectField($tr['rate'], 'Rate');
     $query->addSelectField($tr['formula'], 'Formula');
     $query->addSelectField($tr['applicable'], 'Applicable');
     $query->addLeftJoin('tax_names', $tn['id'], DB_EQ, $tr['tn_id']);
     $query->setMultiLangAlias('_name', 'tax_names', $tn['name'], $tn['id'], 'Taxes');
     $query->addSelectField($query->getMultiLangAlias('_name'), 'TaxName');
     $query->WhereValue($tr['id'], DB_EQ, $tax_rate_id);
     $result = $application->db->getDB_Result($query);
     if (sizeof($result) == 0) {
         return "";
     }
     $result = $result[0];
     if ($specific_rate != "") {
         $result['Rate'] = "[{$specific_rate}]";
     }
     if ($result["Applicable"] == "false") {
         return prepareHTMLDisplay($result['TaxName']) . " = " . $MessageResources->getMessage('TAX_RATE_NOT_APPLICABLE_LABEL');
     }
     $replace = array();
     foreach ($this->getTaxNamesList() as $taxNameInfo) {
         $replace['{t_' . $taxNameInfo['Id'] . '}'] = prepareHTMLDisplay($taxNameInfo['Name']);
     }
     foreach ($this->getTaxCostsList() as $cost) {
         $replace['{p_' . $cost['id'] . '}'] = $MessageResources->getMessage($cost['name']);
     }
     preg_match_all("/([0-9]+\\.?[0-9]+)/", $result['Formula'], $numbers);
     for ($j = 0; $j < sizeof($numbers[0]); $j++) {
         $replace[$numbers[0][$j]] = modApiFunc("Localization", "num_format", $numbers[0][$j]);
     }
     $result['Formula'] = strtr($result['Formula'], $replace);
     return prepareHTMLDisplay($result['TaxName']) . " = " . $result['Rate'] . "% * (" . $result['Formula'] . ")";
 }
コード例 #13
0
 function delAllFilesFromProducts($products_ids)
 {
     global $application;
     $tables = $this->getTables();
     $files_table = $tables['pf_files']['columns'];
     $query = new DB_Select();
     $query->addSelectField($files_table['file_path']);
     $query->Where($files_table['product_id'], DB_IN, "('" . implode("','", $products_ids) . "')");
     $query->WhereAND();
     $query->WhereValue($files_table['is_uploaded'], DB_EQ, 'Y');
     $res = $application->db->getDB_Result($query);
     $this->unlinkFiles($res);
     $query = new DB_Delete('pf_files');
     $query->Where($files_table['product_id'], DB_IN, "('" . implode("','", $products_ids) . "')");
     $application->db->PrepareSQL($query);
     $application->db->DB_Exec();
     return;
 }
コード例 #14
0
 /**
  * Deletes old records in the news table.
  * After that <= NEWS_MAX_COUNT records remain.
  */
 function deleteOldNews()
 {
     global $application;
     $tables = $this->getTables();
     $columns = $tables['news']['columns'];
     # select the latest date piece of news among the remain ones in the table...
     $query = new DB_Select('news');
     $query->addSelectField($columns['date'], 'NewsDate');
     $query->SelectOrder($columns['date'], 'DESC');
     $query->SelectLimit($this->settings[NEWS_MAX_COUNT] - 1, 1);
     $result = $application->db->getDB_Result($query);
     if ($result == NULL) {
         return;
     }
     # ...delete all the latest news @ check this line
     $query = new DB_Delete('news');
     $query->WhereValue($columns['date'], DB_LT, $result[0]['NewsDate']);
     $query->WhereAND();
     $query->WhereValue($columns['type'], DB_EQ, 'avactis');
     $application->db->getDB_Result($query);
 }
コード例 #15
0
 /**
  *
  *
  * @param
  * @return
  */
 function decrypt($name, $encrypted_string)
 {
     if (!$name && !$encrypted_string) {
         return $encrypted_string;
     }
     global $application;
     $session_id = session_id();
     $tables = $this->getTables();
     $table = 'crypto_keys';
     $k = $tables[$table]['columns'];
     $query = new DB_Select();
     $query->addSelectField($k["key"], "crypto_key");
     $query->WhereValue($k["id"], DB_EQ, $session_id);
     $query->WhereAnd();
     $query->WhereValue($k["name"], DB_EQ, $name);
     $result = $application->db->getDB_Result($query);
     if (isset($result[0]['crypto_key']) && $result[0]['crypto_key']) {
         $key = $result[0]['crypto_key'];
         $query = new DB_Delete($table);
         $query->WhereValue($k["id"], DB_EQ, $session_id);
         $query->WhereAnd();
         $query->WhereValue($k["name"], DB_EQ, $name);
         $application->db->getDB_Result($query);
         $blowfish = new Crypt_Blowfish($key);
         $blowfish->setKey($key);
         $string = $blowfish->decrypt($encrypted_string);
     } else {
         return "";
     }
     return $string;
 }
コード例 #16
0
 /**
  *
  * @author Alexandr Girin
  */
 function getTablesAndRecordsCount($count_records = true)
 {
     global $application;
     $avactis_tables = array();
     $tables = $this->getTables();
     $module_tbl = 'module';
     $module_columns = $tables[$module_tbl]['columns'];
     $module_class_tbl = 'module_class';
     $module_class_columns = $tables[$module_class_tbl]['columns'];
     $db_select = new DB_Select();
     $db_select->addSelectField($module_columns['name']);
     $modules = $application->db->getDB_Result($db_select, QUERY_RESULT_NUM);
     $total_records = 0;
     foreach ($modules as $module) {
         if (method_exists($application->getInstance($module[0]), "getTables")) {
             $tables = modApiFunc($module[0], "getTables");
             if (sizeof($tables)) {
                 foreach ($tables as $tableName => $tableInfo) {
                     if (method_exists($application->getInstance($module[0]), "getIgnoredTablesForBackup")) {
                         $ignoredTables = modApiFunc($module[0], "getIgnoredTablesForBackup");
                         //print_r($ignoredTables);
                         if (in_array($tableName, $ignoredTables)) {
                             continue;
                         }
                     }
                     if ($count_records) {
                         $query = new DB_Select();
                         $query->addSelectTable($tableName);
                         $query->addSelectField($query->fCount('*'), 'count');
                         $result = $application->db->getDB_Result($query);
                         $avactis_tables[] = array('table_name' => $application->getAppIni('DB_TABLE_PREFIX') . $tableName, 'records_count' => $result[0]['count']);
                         $total_records += $result[0]['count'];
                     } else {
                         $avactis_tables[] = $application->getAppIni('DB_TABLE_PREFIX') . $tableName;
                     }
                 }
             }
         }
     }
     if ($count_records) {
         $avactis_tables['Total_Records'] = $total_records;
     }
     return $avactis_tables;
 }
コード例 #17
0
 function __loadCOPITypesIDs()
 {
     global $application;
     loadClass('Checkout');
     $co_tables = Checkout::getTables();
     $pa_table = $co_tables['person_info_types']['columns'];
     $query = new DB_Select();
     $query->addSelectTable('person_info_types');
     $query->addSelectField($pa_table['id'], 'type_id');
     $query->addSelectField($pa_table['tag'], 'type_tag');
     $res = $application->db->getDB_Result($query);
     foreach ($res as $k => $pa_info) {
         $this->_co_pi_types_ids[_ml_strtolower(str_replace('Info', '', $pa_info['type_tag']))] = $pa_info['type_id'];
     }
 }
コード例 #18
0
 function __getNotificationNameById($n_id)
 {
     global $application;
     $tables = $this->getTables();
     $actions_table = $tables['notifications']['columns'];
     $query = new DB_Select();
     $query->addSelectField($actions_table['name'], 'notification_name');
     $query->addSelectTable('notifications');
     $query->WhereValue($actions_table['id'], DB_EQ, $n_id);
     $res = $application->db->getDB_Result($query);
     return $res[0]['notification_name'];
 }
コード例 #19
0
 /**
  *
  *
  * @author Alexandr Girin
  * @param
  * @return
  */
 function DeleteOrders($ordersId)
 {
     modApiFunc('EventsManager', 'throwEvent', 'OrdersWillBeDeleted', $ordersId);
     global $application;
     $tables = $this->getTables();
     $on = $tables['order_notes']['columns'];
     $opd = $tables['order_person_data']['columns'];
     $opr = $tables['order_prices']['columns'];
     $otx = $tables['order_taxes']['columns'];
     $otdo = $tables['order_tax_display_options']['columns'];
     $op = $tables['order_product']['columns'];
     $opca = $tables['order_product_custom_attributes']['columns'];
     $opta = $tables['order_product_to_attributes']['columns'];
     $opot = $tables['order_product_options']['columns'];
     $o = $tables['orders']['columns'];
     $DB_IN_string = "('" . implode("', '", $ordersId) . "')";
     $query = new DB_Select();
     $query->addSelectField($op['id'], 'id');
     $query->WhereField($op['order_id'], DB_IN, $DB_IN_string);
     $order_products_id = $application->db->getDB_Result($query);
     foreach ($order_products_id as $key => $order_product_id) {
         $order_products_id[$key] = $order_product_id['id'];
     }
     $query = new DB_Delete('order_notes');
     $query->WhereField($on['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_person_data');
     $query->WhereField($opd['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_prices');
     $query->WhereField($opr['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_taxes');
     $query->WhereField($otx['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_tax_display_options');
     $query->WhereField($otdo['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_product');
     $query->WhereField($op['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_product_custom_attributes');
     $query->WhereField($opca['product_id'], DB_IN, "('" . implode("', '", $order_products_id) . "')");
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_product_to_attributes');
     $query->WhereField($opta['product_id'], DB_IN, "('" . implode("', '", $order_products_id) . "')");
     $application->db->getDB_Result($query);
     $query = new DB_Select();
     $query->addSelectField($opot['option_value'], 'option_value');
     $query->WhereValue($opot['is_file'], DB_EQ, 'Y');
     $query->WhereAND();
     $query->Where($opot['order_product_id'], DB_IN, "('" . implode("', '", $order_products_id) . "')");
     $__res = $application->db->getDB_Result($query);
     if (count($__res) > 0) {
         foreach ($__res as $oinfo) {
             if ($oinfo['option_value'] != '') {
                 modApiFunc('Shell', 'removeDirectory', dirname($oinfo['option_value']));
             }
         }
     }
     $query = new DB_Delete('order_product_options');
     $query->WhereField($opot['order_product_id'], DB_IN, "('" . implode("', '", $order_products_id) . "')");
     $application->db->getDB_Result($query);
     modApiFunc("PromoCodes", "DeleteOrders", $ordersId);
     modApiFunc("TaxExempts", "DeleteOrders", $ordersId);
     modApiFunc('GiftCertificateApi', 'DeleteOrders', $ordersId);
     $query = new DB_Delete('orders');
     $query->WhereField($o['id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
 }
コード例 #20
0
 function __getMaxFPSortOrderForCategory($category_id)
 {
     global $application;
     $tables = $this->getTables();
     $fp_table = $tables['fp_links']['columns'];
     $query = new DB_Select();
     $query->addSelectTable('fp_links');
     $query->addSelectField($query->fMax($fp_table['sort_order']), 'max_so');
     $query->WhereValue($fp_table['category_id'], DB_EQ, $category_id);
     $res = $application->db->getDB_Result($query);
     if (count($res) == 1) {
         return $res[0]['max_so'];
     } else {
         return 0;
     }
 }
コード例 #21
0
 /**
  * Gets settings.
  *
  * @return array of the settings
  */
 function getSettings()
 {
     global $application;
     if (!isset($this->settings)) {
         $tables = $this->getTables();
         $columns = $tables['scc_settings']['columns'];
         $query = new DB_Select();
         $query->addSelectTable('scc_settings');
         $query->addSelectField($columns['key']);
         $query->addSelectField($columns['value']);
         $result = $application->db->getDB_Result($query);
         $settings = array();
         foreach ($result as $k => $v) {
             $settings[$v['scc_settings_key']] = $v['scc_settings_value'];
         }
         $this->settings = $settings;
     }
     return $this->settings;
 }
コード例 #22
0
 function getOrderGCs($order_id = NULL, $gc_code = NULL)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['order_gc']['columns'];
     $result_array = array();
     $query = new DB_Select();
     $query->addSelectField($tr["order_id"], "order_id");
     $query->addSelectField($tr["gc_id"], "gc_id");
     $query->addSelectField($tr["gc_code"], "gc_code");
     if ($order_id !== NULL) {
         #$query->WhereAnd();
         $query->WhereValue($tr["order_id"], DB_EQ, $order_id);
     }
     if ($gc_code !== NULL) {
         if ($order_id !== NULL) {
             $query->WhereAND();
         }
         $query->WhereValue($tr["gc_code"], DB_EQ, $gc_code);
     }
     $result_rows = $application->db->getDB_Result($query);
     return $result_rows;
 }
コード例 #23
0
 function getTopicsEmailsCount($topics_ids, $unique = true)
 {
     global $application;
     if (empty($topics_ids)) {
         return array();
     }
     $tables = $this->getTables();
     $etable = 'subscription_email';
     $ecolumns =& $tables[$etable]['columns'];
     $query = new DB_Select($etable);
     if ($unique) {
         $query->addSelectField(DB_Select::fCountDistinct($ecolumns['email_id']), 'email_count');
     } else {
         $query->addSelectField(DB_Select::fCount($ecolumns['email_id']), 'email_count');
     }
     $query->Where($ecolumns['topic_id'], DB_IN, DBQuery::arrayToIn($topics_ids));
     $res = $application->db->getDB_Result($query);
     return $res[0]['email_count'];
 }
コード例 #24
0
 function getOrderCoupons($order_id = NULL, $coupon_id = NULL)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['order_promo_codes']['columns'];
     $result_array = array();
     $query = new DB_Select();
     $query->addSelectField($tr["order_id"], "order_id");
     $query->addSelectField($tr["coupon_id"], "coupon_id");
     $query->addSelectField($tr["coupon_promo_code"], "coupon_promo_code");
     $query->WhereValue('', '', '1');
     if ($order_id !== NULL) {
         $query->WhereAnd();
         $query->WhereValue($tr["order_id"], DB_EQ, $order_id);
     }
     if ($coupon_id !== NULL) {
         $query->WhereAND();
         $query->WhereValue($tr["coupon_id"], DB_EQ, $coupon_id);
     }
     $result_rows = $application->db->getDB_Result($query);
     return $result_rows;
 }
コード例 #25
0
 /**
  *           transaction        .
  *
  * @return unknown
  */
 function getModulesSettings()
 {
     global $application;
     static $ModulesSettings = NULL;
     $ModulesSettings = array();
     $tables = TransactionTracking::getTables();
     $ttm = $tables['transaction_tracking_modules_settings']['columns'];
     $query = new DB_Select();
     $query->addSelectField($ttm['id'], 'id');
     $query->addSelectField($ttm['module_id'], 'module_id');
     $query->addSelectField($ttm['key_name'], 'key_name');
     $query->addSelectField($ttm['value'], 'value');
     $result = $application->db->getDB_Result($query);
     if (!empty($result)) {
         foreach ($result as $entry) {
             $m_uid = $entry['module_id'];
             if (!isset($ModulesSettings[$m_uid])) {
                 $ModulesSettings[$m_uid] = array();
             }
             $ModulesSettings[$m_uid][$entry['key_name']] = $entry['value'];
         }
     }
     return $ModulesSettings;
 }
コード例 #26
0
function getProductAttributeId($view_tag_name, $default_value = null)
{
    global $application;
    if (!is_object($application)) {
        return $default_value;
    }
    $attr_ids_cache = $application->getAttrIdsCache();
    $attr_id = $attr_ids_cache->read($view_tag_name);
    if ($attr_id == null) {
        if ($application->db->DB_isTableExists($application->getAppIni('DB_TABLE_PREFIX') . "attributes") != null) {
            $s = new DB_Select();
            $s->addSelectTable("attributes");
            $s->addSelectField('attribute_id', 'attribute_id');
            $s->WhereValue('attribute_view_tag', DB_EQ, $view_tag_name);
            $m = new DB_MySQL();
            $m->PrepareSQL($s);
            $result = $m->getDB_Result($s);
            $attr_id = !empty($result) ? $result[0]['attribute_id'] : $default_value;
        } else {
            $attr_id = $default_value;
        }
        $attr_ids_cache->write($view_tag_name, $attr_id);
    }
    return $attr_id;
}
コード例 #27
0
 /**
  * Gets detailed user info.
  *
  * @
  * @param
  * @return
  */
 function getUserInfo($uid)
 {
     global $application;
     $tables = $this->getTables();
     $a = $tables["admin"]["columns"];
     $query = new DB_Select();
     $query->addSelectField($a['id'], 'id');
     $query->addSelectField($a['firstname'], 'firstname');
     $query->addSelectField($a['lastname'], 'lastname');
     $query->addSelectField($a['email'], 'email');
     $query->addSelectField($a['lognum'], 'lognum');
     $query->addSelectField($a['logdate'], 'logdate');
     $query->addSelectField($a['created'], 'created');
     $query->addSelectField($a['modified'], 'modified');
     $query->addSelectField($a['options'], 'options');
     $query->WhereValue($a['id'], DB_EQ, $uid);
     $user_info = $application->db->getDB_Result($query);
     return @$user_info[0];
 }
コード例 #28
0
 /**
  * Gets credit card info by the order.
  *
  * @return array - the array of module settings
  */
 function getOrderCCInfoFromDB($order_id)
 {
     global $application;
     $tables = $this->getTables();
     $columns = $tables['pm_offline_cc_order_cc_info']['columns'];
     $query = new DB_Select();
     $query->addSelectField($columns["key"], "set_key");
     $query->addSelectField($columns["value"], "set_value");
     $query->WhereValue($field['order_id'], DB_EQ, $order_id);
     $result = $application->db->getDB_Result($query);
     $res = array();
     for ($i = 0; $i < sizeof($result); $i++) {
         $res[$result[$i]['key']] = $result[$i]['value'];
     }
     return $res;
 }
コード例 #29
0
 /**
  * Returnts the full person custom attribute record (person_attributes and person_info_variants_to_attributes)
  *
  * @author Andrei V. Zhuravlev
  * @param $variantId integer variant id
  * @param $attributeId integer attribute id
  */
 function getPersonCustomAttributeData($attributeId)
 {
     global $application;
     $tables = $this->getTables();
     $piva = $tables['person_info_variants_to_attributes']['columns'];
     $pa = $tables['person_attributes']['columns'];
     $query = new DB_Select();
     foreach ($piva as $k => $v) {
         if ($k != 'name' && $k != 'descr') {
             $query->addSelectField($v);
         }
     }
     $query->setMultiLangAlias('_ml_name', 'person_info_variants_to_attributes', $piva['name'], $piva['id'], 'Checkout');
     $query->addSelectField($query->getMultiLangAlias('_ml_name'), 'person_attribute_visible_name');
     $query->setMultiLangAlias('_ml_descr', 'person_info_variants_to_attributes', $piva['descr'], $piva['id'], 'Checkout');
     $query->addSelectField($query->getMultiLangAlias('_ml_descr'), 'person_attribute_description');
     foreach ($pa as $v) {
         $query->addSelectField($v);
     }
     $query->WhereField($piva['attribute_id'], DB_EQ, $pa['id']);
     $query->WhereAnd();
     $query->WhereValue($piva['attribute_id'], DB_EQ, $attributeId);
     $query->WhereAnd();
     $query->WhereValue($pa['is_custom'], DB_EQ, "1");
     $result = $application->db->getDB_Result($query);
     return $result;
 }
コード例 #30
0
 function __loadOrdersSummary()
 {
     if (!$this->search_completed or empty($this->orders_ids)) {
         return;
     }
     //                        :
     //                                                               ,
     //               main_store_currency                            .
     //                               main_store_currency,
     //           .
     //                                 main_store_currency.
     global $application;
     $co_tables = modApiStaticFunc('Checkout', 'getTables');
     $orders_table = $co_tables['orders']['columns'];
     $order_prices_table = $co_tables['order_prices']['columns'];
     $query = new DB_Select();
     $query->addSelectTable('orders');
     $query->addSelectField($order_prices_table['order_total'], 'order_total');
     $query->addSelectField($orders_table['payment_status_id'], 'payment_status_id');
     $query->addSelectField($order_prices_table['currency_code'], 'currency_code');
     $query->WhereValue($order_prices_table['currency_type'], DB_EQ, CURRENCY_TYPE_MAIN_STORE_CURRENCY);
     $query->WhereAnd();
     $query->Where($orders_table['id'], DB_IN, "('" . implode("','", $this->orders_ids) . "')");
     $query->addLeftJoin('order_prices', $orders_table['id'], DB_EQ, $order_prices_table['order_id']);
     $rows = $application->db->getDB_Result($query);
     $amount = 0.0;
     $fully_paid_amount = 0.0;
     $main_store_currency = modApiFunc("Localization", "getCurrencyCodeById", modApiFunc("Localization", "getMainStoreCurrency"));
     foreach ($rows as $order_info) {
         $order_main_currency = $order_info['currency_code'];
         $order_total = $order_info['order_total'];
         if ($order_main_currency != $main_store_currency) {
             $order_total = modApiFunc('Currency_Converter', 'convert', $order_total, $order_main_currency, $main_store_currency);
         }
         $amount += $order_total;
         if ($order_info['payment_status_id'] == ORDER_PAYMENT_STATUS_FULLY_PAID) {
             $fully_paid_amount += $order_total;
         }
     }
     $query = new DB_Select();
     $query->addSelectTable('orders');
     $query->addSelectField($query->fMax($orders_table['date']), 'max_date');
     $query->addSelectField($query->fMin($orders_table['date']), 'min_date');
     $query->Where($orders_table['id'], DB_IN, "('" . implode("','", $this->orders_ids) . "')");
     $res = $application->db->getDB_Result($query);
     $this->orders_summary = array('amount' => $amount, 'max_date' => $res[0]['max_date'], 'min_date' => $res[0]['min_date'], 'fully_paid_amount' => $fully_paid_amount);
 }