本文整理汇总了PHP中fn_get_company_data函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_company_data函数的具体用法?PHP fn_get_company_data怎么用?PHP fn_get_company_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_get_company_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_mve_place_order
function fn_mve_place_order(&$order_id, &$action, &$__order_status, &$cart)
{
$order_info = fn_get_order_info($order_id);
if ($order_info['is_parent_order'] != 'Y' && !empty($order_info['company_id'])) {
// Check if the order already placed
$payout_id = db_get_field('SELECT payout_id FROM ?:vendor_payouts WHERE order_id = ?i', $order_id);
$company_data = fn_get_company_data($order_info['company_id']);
$company_data['commission'] = $order_info['total'] > 0 ? $company_data['commission'] : 0;
$company_data['commission_type'] = isset($company_data['commission_type']) ? $company_data['commission_type'] : '';
$commission_amount = 0;
if ($company_data['commission_type'] == 'P') {
//Calculate commission amount and check if we need to include shipping cost
$commission_amount = ($order_info['total'] - (Registry::get('settings.Vendors.include_shipping') == 'N' ? $order_info['shipping_cost'] : 0)) * $company_data['commission'] / 100;
} else {
$commission_amount = $company_data['commission'];
}
//Check if we need to take payment surcharge from vendor
if (Registry::get('settings.Vendors.include_payment_surcharge') == 'Y') {
$commission_amount += $order_info['payment_surcharge'];
}
$_data = array('company_id' => $order_info['company_id'], 'order_id' => $order_id, 'payout_date' => TIME, 'start_date' => TIME, 'end_date' => TIME, 'commission' => $company_data['commission'], 'commission_type' => $company_data['commission_type'], 'order_amount' => $order_info['total'], 'commission_amount' => $commission_amount);
fn_set_hook('mve_place_order', $order_info, $company_data, $action, $__order_status, $cart, $_data);
if ($commission_amount > $order_info['total']) {
$commission_amount = $order_info['total'];
}
if (empty($payout_id)) {
db_query('INSERT INTO ?:vendor_payouts ?e', $_data);
} else {
db_query('UPDATE ?:vendor_payouts SET ?u WHERE payout_id = ?i', $_data, $payout_id);
}
}
}
示例2: fn_blocks_get_vendor_info
function fn_blocks_get_vendor_info()
{
$company_id = isset($_REQUEST['company_id']) ? $_REQUEST['company_id'] : null;
$company_data = fn_get_company_data($company_id);
$company_data['logos'] = fn_get_logos($company_id);
return $company_data;
}
示例3: fn_vendor_data_premoderation_update_company_pre
function fn_vendor_data_premoderation_update_company_pre(&$company_data, &$company_id, &$lang_code)
{
if (fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) {
$orig_company_data = fn_get_company_data($company_id, $lang_code);
$vendor_profile_updates_approval = Registry::get('addons.vendor_data_premoderation.vendor_profile_updates_approval');
if ($orig_company_data['status'] == 'A' && ($vendor_profile_updates_approval == 'all' || $vendor_profile_updates_approval == 'custom' && !empty($orig_company_data['pre_moderation_edit_vendors']) && $orig_company_data['pre_moderation_edit_vendors'] == 'Y')) {
$logotypes = fn_filter_uploaded_data('logotypes_image_icon');
// FIXME: dirty comparison
// check that some data is changed
if (array_diff_assoc($company_data, $orig_company_data) || !empty($logotypes)) {
$company_data['status'] = 'P';
}
}
}
}
示例4: fn_companies_suppliers_order_notification
function fn_companies_suppliers_order_notification($order_info, $order_statuses, $force_notification)
{
static $notification_sent = array();
if (!empty($notification_sent[$order_info['order_id']][$order_info['status']]) && $notification_sent[$order_info['order_id']][$order_info['status']] || $order_info['status'] == STATUS_INCOMPLETED_ORDER || $order_info['status'] == STATUS_PARENT_ORDER) {
return true;
}
$status_params = $order_statuses[$order_info['status']];
$notify_supplier = isset($force_notification['S']) ? $force_notification['S'] : (!empty($status_params['notify_supplier']) && $status_params['notify_supplier'] == 'Y' ? true : false);
if ($notify_supplier == true) {
$notification_sent[$order_info['order_id']][$order_info['status']] = true;
$suppliers = array();
foreach ($order_info['items'] as $k => $v) {
if (isset($v['company_id'])) {
$suppliers[$v['company_id']] = 0;
}
}
if (!empty($suppliers)) {
if (!empty($order_info['shipping'])) {
foreach ($order_info['shipping'] as $shipping_id => $shipping) {
foreach ((array) $shipping['rates'] as $supplier_id => $rate) {
if (isset($suppliers[$supplier_id])) {
$suppliers[$supplier_id] += $rate;
}
}
}
}
Registry::get('view_mail')->assign('order_status', fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], Registry::get('settings.Appearance.admin_default_language')));
Registry::get('view_mail')->assign('order_info', $order_info);
Registry::get('view_mail')->assign('status_inventory', $order_statuses[$order_info['status']]['inventory']);
foreach ($suppliers as $supplier_id => $shipping_cost) {
if ($supplier_id != 0) {
Registry::get('view_mail')->assign('shipping_cost', $shipping_cost);
Registry::get('view_mail')->assign('supplier_id', $supplier_id);
$supplier = fn_get_company_data($supplier_id);
fn_send_mail($supplier['email'], Registry::get('settings.Company.company_orders_department'), 'orders/supplier_notification_subj.tpl', 'orders/supplier_notification.tpl', '', Registry::get('settings.Appearance.admin_default_language'));
}
}
return true;
}
}
return false;
}
示例5: fn_get_simple_countries
Tygh::$app['view']->assign('countries', fn_get_simple_countries(true, CART_LANGUAGE));
Tygh::$app['view']->assign('states', fn_get_all_states());
Tygh::$app['view']->display('pickers/companies/picker_contents.tpl');
exit;
}
if (fn_allowed_for('MULTIVENDOR')) {
if ($mode == 'merge') {
if (!isset(Tygh::$app['session']['auth']['is_root']) || Tygh::$app['session']['auth']['is_root'] != 'Y' || Registry::get('runtime.company_id')) {
return array(CONTROLLER_STATUS_DENIED);
}
if (empty($_REQUEST['company_id'])) {
return array(CONTROLLER_STATUS_NO_PAGE);
}
$company_id = $_REQUEST['company_id'];
unset($_REQUEST['company_id']);
$company_data = !empty($company_id) ? fn_get_company_data($company_id) : array();
if (empty($company_data)) {
return array(CONTROLLER_STATUS_NO_PAGE);
}
$_REQUEST['exclude_company_id'] = $company_id;
list($companies, $search) = fn_get_companies($_REQUEST, $auth, Registry::get('settings.Appearance.admin_elements_per_page'));
Tygh::$app['view']->assign('company_id', $company_id);
Tygh::$app['view']->assign('company_name', $company_data['company']);
Tygh::$app['view']->assign('companies', $companies);
Tygh::$app['view']->assign('search', $search);
Tygh::$app['view']->assign('countries', fn_get_simple_countries(true, CART_LANGUAGE));
Tygh::$app['view']->assign('states', fn_get_all_states());
} elseif ($mode == 'balance') {
list($payouts, $search, $total) = fn_companies_get_payouts($_REQUEST, Registry::get('settings.Appearance.admin_elements_per_page'));
Tygh::$app['view']->assign('payouts', $payouts);
Tygh::$app['view']->assign('search', $search);
示例6: fn_get_manifest
function fn_get_manifest($area, $lang_code = CART_LANGUAGE, $company_id = 0)
{
$manifest = parse_ini_file(DIR_SKINS . Registry::get('settings.skin_name_' . $area) . '/' . SKIN_MANIFEST, true);
$exclude_key = array('description', 'admin', 'customer');
if (defined('COMPANY_ID')) {
$company_id = COMPANY_ID;
}
if ($company_id) {
$company_data = fn_get_company_data($company_id, $lang_code);
$logos = !empty($company_data['logos']) ? unserialize($company_data['logos']) : array();
$manifest = array_merge($manifest, $logos);
}
$alts = db_get_hash_single_array("SELECT object_holder, description FROM ?:common_descriptions WHERE object_id = ?i AND lang_code = ?s", array('object_holder', 'description'), $company_id, $lang_code);
foreach ($manifest as $key => $val) {
if (!in_array($key, $exclude_key) && isset($alts[$key])) {
$manifest[$key]['alt'] = $alts[$key];
}
}
return $manifest;
}
示例7: fn_twg_get_all_settings
/**
* Prepare all settings, wich should be passed to js
*/
function fn_twg_get_all_settings()
{
$settings = fn_twg_get_boot_settings();
$addon_settings = TwigmoSettings::get();
$settings['access_id'] = $addon_settings['access_id'];
$settings['currency'] = Registry::get('currencies.' . CART_SECONDARY_CURRENCY);
$settings['primaryCurrency'] = Registry::get('currencies.' . CART_PRIMARY_CURRENCY);
$settings['url_for_facebook'] = isset($addon_settings['url_for_facebook']) ? fn_twg_get_external_info_url($addon_settings['url_for_facebook']) : '';
$settings['url_for_twitter'] = isset($addon_settings['url_for_twitter']) ? fn_twg_get_external_info_url($addon_settings['url_for_twitter']) : '';
$settings['lang'] = array_merge(fn_twg_get_default_customer_langvars(), Lang::getCustomerLangVars());
// Countries/states
list($countries) = fn_get_countries(array('only_avail' => true));
$settings = array_merge($settings, Api::getAsList('countries', $countries));
$settings['states'] = fn_twg_get_states();
// Info pages
$pages_location = $addon_settings['home_page_content'] == 'tw_home_page_blocks' ? 'twigmo.post' : 'index.index';
$pages = TwigmoBlock::getBlocksForLocation($pages_location, array('pages'));
$settings['info_pages'] = array();
foreach ($pages as $page) {
$settings['info_pages'] = array_merge($settings['info_pages'], $page['pages']['page']);
}
// If page link begin with # then interpret this link as twigmo page
foreach ($settings['info_pages'] as $k => $page) {
if (preg_match('/^\\#.*$/', $page['link'])) {
$settings['info_pages'][$k]['twigmo_page'] = substr($page['link'], 1);
}
}
// Only required profile fields
$only_required = isset($addon_settings['only_req_profile_fields']) ? $addon_settings['only_req_profile_fields'] : 'N';
$settings['profileFields'] = fn_twg_prepare_profile_fields(fn_get_profile_fields(), $only_required);
$settings['profileFieldsCheckout'] = fn_twg_prepare_profile_fields(fn_get_profile_fields('O'), $only_required);
$settings['show_product_code'] = isset($addon_settings['show_product_code']) ? $addon_settings['show_product_code'] : 'N';
$settings['titles'] = array();
$settings['profile'] = fn_twg_get_user_info($_SESSION['auth']['user_id']);
$settings['cart'] = fn_twg_api_get_session_cart($_SESSION['cart']);
$settings['sortings'] = fn_twg_get_sortings();
$settings['security_hash'] = fn_generate_security_hash();
$settings['productType'] = PRODUCT_EDITION;
$settings['languages'] = array_values(Lang::getLanguages());
$settings['cart_language'] = CART_LANGUAGE;
$settings['cart_prices_w_taxes'] = Registry::get('settings.Appearance.cart_prices_w_taxes');
$settings['show_prices_taxed_clean'] = Registry::get('settings.Appearance.show_prices_taxed_clean');
$settings['no_image_path'] = Registry::get('config.no_image_path');
// Suppliers
$settings['suppliers_vendor'] = Registry::get('settings.Suppliers.apply_for_vendor');
$settings['display_supplier'] = Registry::get('settings.Suppliers.display_supplier') === 'Y' || Registry::get('settings.Vendors.display_vendor') === 'Y';
$settings['display_supplier'] = $settings['display_supplier'] ? 'Y' : 'N';
// General section
$fields = array('use_email_as_login', 'min_order_amount', 'min_order_amount_type', 'allow_negative_amount', 'inventory_tracking', 'allow_anonymous_shopping', 'tax_calculation');
foreach ($fields as $field) {
$settings[$field] = Registry::get('settings.General.' . $field);
}
$settings = array_merge($settings, fn_twg_get_checkout_settings());
if (version_compare(PRODUCT_VERSION, '4.0.2', '>=')) {
$anonymous_shopping_settings_map = array('allow_shopping' => 'Y', 'hide_price_and_add_to_cart' => 'P', 'hide_add_to_cart' => 'B');
$settings['allow_anonymous_shopping'] = $anonymous_shopping_settings_map[$settings['allow_anonymous_shopping']];
}
$settings['default_location'] = array('country' => Registry::get('settings.General.default_country'), 'state' => Registry::get('settings.General.default_state'));
$settings['show_modifiers'] = Registry::get('settings.General.display_options_modifiers');
$settings['SEOEnabled'] = Registry::get('addons.seo.status') == 'A';
$settings['GATrackEcommerce'] = Registry::get('addons.google_analytics.status') == 'A' && Registry::get('addons.google_analytics.track_ecommerce') == 'Y' && file_exists(Registry::get('config.dir.addons') . 'google_analytics/controllers/frontend/checkout.post.php');
if (fn_allowed_for('MULTIVENDOR')) {
$settings['company_data'] = !empty($_SESSION['auth']['company_id']) ? fn_get_company_data($_SESSION['auth']['company_id']) : array();
} else {
$settings['company_data'] = array();
}
$settings['checkout'] = Registry::get('settings.Checkout');
fn_set_hook('twg_get_all_settings', $settings);
$settings['lang'] = fn_twg_process_langvars($settings['lang']);
return $settings;
}
示例8: content_55ccf7c33c4939_75303952
//.........这里部分代码省略.........
if (isset($_capture_assign)) {
$_smarty_tpl->assign($_capture_assign, ob_get_contents());
}
if (isset($_capture_append)) {
$_smarty_tpl->append($_capture_append, ob_get_contents());
}
Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
} else {
$_smarty_tpl->capture_error();
}
?>
<?php
echo $_smarty_tpl->getSubTemplate("common/mainbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('buttons' => Smarty::$_smarty_vars['capture']['buttons'], 'no_sidebar' => true, 'title' => __("dashboard"), 'content' => Smarty::$_smarty_vars['capture']['mainbox'], 'tools' => Smarty::$_smarty_vars['capture']['tools']), 0);
?>
<?php
$_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "index:welcome_dialog"));
$_block_repeat = true;
echo smarty_block_hook(array('name' => "index:welcome_dialog"), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();
?>
<?php
if ($_smarty_tpl->tpl_vars['show_welcome']->value) {
?>
<div class="hidden cm-dialog-auto-open cm-dialog-auto-size" title="<?php
echo $_smarty_tpl->__("installer_complete_title");
?>
" id="after_install_dialog" data-ca-dialog-class="welcome-screen-dialog">
<?php
$_smarty_tpl->tpl_vars["company"] = new Smarty_variable(fn_get_company_data("1"), null, 0);
?>
<?php
if (fn_allowed_for("ULTIMATE")) {
?>
<?php
ob_start();
echo htmlspecialchars(smarty_modifier_unpuny($_smarty_tpl->tpl_vars['company']->value['storefront']), ENT_QUOTES, 'UTF-8');
$_tmp1 = ob_get_clean();
$_smarty_tpl->tpl_vars['link_storefront'] = new Smarty_variable("http://" . $_tmp1, null, 0);
?>
<?php
} else {
?>
<?php
ob_start();
echo htmlspecialchars(fn_url($_smarty_tpl->tpl_vars['config']->value['http_location']), ENT_QUOTES, 'UTF-8');
$_tmp2 = ob_get_clean();
$_smarty_tpl->tpl_vars['link_storefront'] = new Smarty_variable($_tmp2, null, 0);
?>
<?php
}
?>
<div class="welcome-screen">
<p>
<?php
$_smarty_tpl->tpl_vars['user_data'] = new Smarty_variable(fn_get_user_info($_smarty_tpl->tpl_vars['auth']->value['user_id']), null, 0);
?>
<?php
echo $_smarty_tpl->__("welcome_screen.administrator_info", array('[email]' => $_smarty_tpl->tpl_vars['user_data']->value['email']));
?>
</p>
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:67,代码来源:e3bbaed6b9c1024ee236cf10769292ed9861b2dc.tygh.index.tpl.php
示例9: fn_twg_init_api_meta
$lang_code = $_REQUEST['language'];
}
}
$mode = Registry::get('runtime.mode');
$meta = fn_twg_init_api_meta($response);
$is_cache_request = isset($_GET['get_cache_js']) && in_array($meta['action'], array('get', 'details'));
if (($_SERVER['REQUEST_METHOD'] == 'POST' || $is_cache_request) && $mode == 'post') {
if ($meta['action'] == 'login') {
$login = !empty($_REQUEST['login']) ? $_REQUEST['login'] : '';
$password = !empty($_REQUEST['password']) ? $_REQUEST['password'] : '';
if (!($user_data = fn_twg_api_customer_login($login, $password))) {
$response->addError('ERROR_CUSTOMER_LOGIN_FAIL', __('error_incorrect_login'));
}
$profile = fn_twg_get_user_info($user_data['user_id']);
if (fn_allowed_for('MULTIVENDOR')) {
$profile['company_data'] = !empty($_SESSION['auth']['company_id']) ? fn_get_company_data($_SESSION['auth']['company_id']) : array();
} else {
$profile['company_data'] = array();
}
$_profile = array_merge($profile, array('cart' => fn_twg_api_get_session_cart($_SESSION['cart'], $lang_code)));
$response->setData($_profile);
} elseif ($meta['action'] == 'add_to_cart') {
// add to cart
$data = fn_twg_get_api_data($response, $format);
Registry::set('runtime.controller', 'checkout', true);
$ids = fn_twg_api_add_product_to_cart(array($data), $_SESSION['cart']);
Registry::set('runtime.controller', 'twigmo');
$result = fn_twg_api_get_session_cart($_SESSION['cart'], $lang_code);
$response->setData($result);
if (!empty($ids)) {
$ids = array_keys($ids);
示例10: db_query
db_query("DELETE FROM ?:product_subscriptions WHERE subscription_id = ?i", $_REQUEST['deleted_subscription_id']);
}
}
if (empty($product_data)) {
return array(CONTROLLER_STATUS_NO_PAGE);
}
list($product_features, $features_search) = fn_get_paginated_product_features(array('product_id' => $product_data['product_id']), $auth, $product_data, DESCR_SL);
Tygh::$app['view']->assign('product_features', $product_features);
Tygh::$app['view']->assign('features_search', $features_search);
$taxes = fn_get_taxes();
arsort($product_data['category_ids']);
if (fn_allowed_for('MULTIVENDOR')) {
// reload form (refresh categories list if vendor was changed)
if (defined('AJAX_REQUEST') && !empty($_REQUEST['reload_form'])) {
$company_id = isset($_REQUEST['product_data']['company_id']) ? $_REQUEST['product_data']['company_id'] : 0;
$company_data = fn_get_company_data($company_id);
if (!empty($company_data['categories'])) {
$params = array('simple' => false, 'company_ids' => $company_id);
list($cat_ids, ) = fn_get_categories($params);
$cat_ids = array_keys($cat_ids);
//Assign available category ids to be displayed after admin changes product owner.
$product_data['category_ids'] = array_intersect($product_data['category_ids'], $cat_ids);
}
//Assign received company_id to product data for the correct company categories to be displayed in the picker.
$product_data['company_id'] = $company_id;
Tygh::$app['view']->assign('product_data', $product_data);
Tygh::$app['view']->display('views/products/update.tpl');
exit;
}
}
Tygh::$app['view']->assign('product_data', $product_data);
示例11: fn_restore_post_data
$restored_company_data = fn_restore_post_data('company_data');
if ($restored_company_data) {
Tygh::$app['view']->assign('company_data', $restored_company_data);
}
$restored_user_data = fn_restore_post_data('user_data');
if ($restored_user_data) {
Tygh::$app['view']->assign('user_data', $restored_user_data);
}
$profile_fields = fn_get_profile_fields('A', array(), CART_LANGUAGE, array('get_custom' => true, 'get_profile_required' => true));
Tygh::$app['view']->assign('profile_fields', $profile_fields);
Tygh::$app['view']->assign('countries', fn_get_simple_countries(true, CART_LANGUAGE));
Tygh::$app['view']->assign('states', fn_get_all_states());
fn_add_breadcrumb(__('apply_for_vendor_account'));
$_SESSION['apply_for_vendor']['return_url'] = !empty($_REQUEST['return_previous_url']) ? $_REQUEST['return_previous_url'] : fn_url('');
} elseif ($mode == 'products') {
$company_data = !empty($_REQUEST['company_id']) ? fn_get_company_data($_REQUEST['company_id']) : array();
if (empty($company_data)) {
return array(CONTROLLER_STATUS_NO_PAGE);
}
$company_id = $company_data['company_id'];
fn_add_breadcrumb(__('all_vendors'), 'companies.catalog');
$params = $_REQUEST;
$params['company_id'] = $company_id;
$params['extend'] = array('description');
if (!empty($_REQUEST['category_id'])) {
fn_add_breadcrumb($company_data['company'], 'companies.products?company_id=' . $company_id);
$category_id = $_REQUEST['category_id'];
// Get full data for current category
$category_data = fn_get_category_data($category_id);
if (!empty($category_data)) {
$params['cid'] = $category_id;
示例12: update
public function update($id, $params)
{
$data = array();
$valid_params = true;
$status = Response::STATUS_BAD_REQUEST;
unset($params['company_id']);
$company_data = fn_get_company_data($id);
if (empty($company_data)) {
$message = __('api_need_correct_company_id');
$valid_params = false;
} else {
list($valid_params, $message) = $this->checkRequiredParams($params);
}
if ($valid_params) {
if (!empty($this->auth['company_id']) && $this->auth['company_id'] != $id) {
$status = Response::STATUS_FORBIDDEN;
$data = array();
} else {
$lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
$company_id = fn_update_company($params, $id, $lang_code);
if ($company_id) {
$this->updateCompanySettings($params, $id);
$status = Response::STATUS_OK;
$data['store_id'] = $company_id;
}
}
}
if (!empty($message)) {
$data['message'] = $message;
}
return array('status' => $status, 'data' => $data);
}
示例13: fn_get_categories
/**
* Gets categories tree beginning from category identifier defined in params or root category
* @param array $params Categories search params
* category_id - Root category identifier
* visible - Flag that defines if only visible categories should be included
* current_category_id - Identifier of current node for visible categories
* simple - Flag that defines if category path should be getted as set of category IDs
* plain - Flag that defines if continues list of categories should be returned
* --------------------------------------
* Examples:
* Gets whole categories tree:
* fn_get_categories()
* --------------------------------------
* Gets subcategories tree of the category:
* fn_get_categories(array(
* 'category_id' => 123
* ))
* --------------------------------------
* Gets all first-level nodes of the category
* fn_get_categories(array(
* 'category_id' => 123,
* 'visible' => true
* ))
* --------------------------------------
* Gets all visible nodes of the category, start from the root
* fn_get_categories(array(
* 'category_id' => 0,
* 'current_category_id' => 234,
* 'visible' => true
* ))
* @param string $lang_code 2-letters language code
* @return array Categories tree
*/
function fn_get_categories($params = array(), $lang_code = CART_LANGUAGE)
{
/**
* Changes params for the categories search
*
* @param array $params Categories search params
* @param string $lang_code 2-letters language code
*/
fn_set_hook('get_categories_pre', $params, $lang_code);
$default_params = array('category_id' => 0, 'visible' => false, 'current_category_id' => 0, 'simple' => true, 'plain' => false, 'limit' => 0, 'item_ids' => '', 'group_by_level' => true, 'get_images' => false, 'category_delimiter' => '/', 'get_frontend_urls' => false);
$params = array_merge($default_params, $params);
$sortings = array('timestamp' => '?:categories.timestamp', 'name' => '?:category_descriptions.category', 'position' => array('?:categories.position', '?:category_descriptions.category'));
$auth =& $_SESSION['auth'];
$fields = array('?:categories.category_id', '?:categories.parent_id', '?:categories.id_path', '?:category_descriptions.category', '?:categories.position', '?:categories.status');
if ($params['simple'] == false) {
$fields[] = '?:categories.product_count';
}
if (empty($params['current_category_id']) && !empty($params['product_category_id'])) {
$params['current_category_id'] = $params['product_category_id'];
}
$condition = '';
if (fn_allowed_for('MULTIVENDOR')) {
if (Registry::get('runtime.company_id')) {
$company_id = Registry::get('runtime.company_id');
} elseif (!empty($params['company_ids'])) {
$company_id = (int) $params['company_ids'];
}
if (!empty($company_id)) {
$company_data = fn_get_company_data($company_id);
if (!empty($company_data['category_ids'])) {
$company_condition = db_quote(' AND ?:categories.category_id IN (?n)', $company_data['category_ids']);
$condition .= $company_condition;
}
}
}
if (AREA == 'C') {
$_statuses = array('A');
// Show enabled products/categories
$condition .= fn_get_localizations_condition('?:categories.localization', true);
$condition .= " AND (" . fn_find_array_in_set($auth['usergroup_ids'], '?:categories.usergroup_ids', true) . ")";
$condition .= db_quote(" AND ?:categories.status IN (?a)", $_statuses);
}
if (!empty($params['status'])) {
$condition .= db_quote(" AND ?:categories.status IN (?a)", $params['status']);
}
if (isset($params['parent_category_id'])) {
// set parent id, that was set in block properties
$params['category_id'] = $params['parent_category_id'];
}
if ($params['visible'] == true && empty($params['b_id'])) {
if (!empty($params['current_category_id'])) {
$cur_id_path = db_get_field("SELECT id_path FROM ?:categories WHERE category_id = ?i", $params['current_category_id']);
if (!empty($cur_id_path)) {
$parent_categories_ids = explode('/', $cur_id_path);
}
}
if (!empty($params['category_id']) || empty($parent_categories_ids)) {
$parent_categories_ids[] = $params['category_id'];
}
$parents_condition = db_quote(" AND ?:categories.parent_id IN (?n)", $parent_categories_ids);
}
// if we have company_condtion, skip $parents_condition, it will be processed later by PHP
if (!empty($parents_condition) && empty($company_condition)) {
$condition .= $parents_condition;
}
if (!empty($params['category_id'])) {
$from_id_path = db_get_field("SELECT id_path FROM ?:categories WHERE category_id = ?i", $params['category_id']);
//.........这里部分代码省略.........
示例14: fn_init_company_data
/**
* Init company data
* Company data array will be saved in the registry runtime.company_data
*
* @param array $params request parameters
* @return array with init data (init status, redirect url in case of redirect)
*/
function fn_init_company_data($params)
{
$company_data = array('company' => __('all_vendors'));
$company_id = Registry::get('runtime.company_id');
if ($company_id) {
$company_data = fn_get_company_data($company_id);
}
fn_set_hook('init_company_data', $params, $company_id, $company_data);
Registry::set('runtime.company_data', $company_data);
return array(INIT_STATUS_OK);
}
示例15: fn_change_company_status
/**
* Fucntion changes company status. Allowed statuses are A(ctive) and D(isabled)
*
* @param int $company_id
* @param string $status_to A or D
* @param string $reason The reason of the change
* @param string $status_from Previous status
* @param boolean $skip_query By default false. Update query might be skipped if status is already changed.
* @return boolean True on success or false on failure
*/
function fn_change_company_status($company_id, $status_to, $reason = '', &$status_from = '', $skip_query = false, $notify = true)
{
/**
* Actions before change company status
*
* @param int $company_id Company ID
* @param string $status_to Status to letter
* @param string $reason Reason text
* @param string $status_from Status from letter
* @param bool $skip_query Skip query flag
* @param bool $notify Notify flag
*/
fn_set_hook('change_company_status_pre', $company_id, $status_to, $reason, $status_from, $skip_query, $notify);
if (empty($status_from)) {
$status_from = db_get_field("SELECT status FROM ?:companies WHERE company_id = ?i", $company_id);
}
if (!in_array($status_to, array('A', 'P', 'D')) || $status_from == $status_to) {
return false;
}
$result = $skip_query ? true : db_query("UPDATE ?:companies SET status = ?s WHERE company_id = ?i", $status_to, $company_id);
if (!$result) {
return false;
}
$company_data = fn_get_company_data($company_id);
$account = $username = '';
if ($status_from == 'N' && ($status_to == 'A' || $status_to == 'P')) {
if (Registry::get('settings.Vendors.create_vendor_administrator_account') == 'Y') {
if (!empty($company_data['request_user_id'])) {
$password_change_timestamp = db_get_field("SELECT password_change_timestamp FROM ?:users WHERE user_id = ?i", $company_data['request_user_id']);
$_set = '';
if (empty($password_change_timestamp)) {
$_set = ", password_change_timestamp = 1 ";
}
db_query("UPDATE ?:users SET company_id = ?i, user_type = 'V'{$_set} WHERE user_id = ?i", $company_id, $company_data['request_user_id']);
$username = fn_get_user_name($company_data['request_user_id']);
$account = 'updated';
$msg = __('new_administrator_account_created') . '<a href="' . fn_url('profiles.update?user_id=' . $company_data['request_user_id']) . '">' . __('you_can_edit_account_details') . '</a>';
fn_set_notification('N', __('notice'), $msg, 'K');
} else {
$_company_data = $company_data + unserialize($company_data['request_account_data']);
$_company_data['status'] = 'A';
if (!empty($_company_data['request_account_name'])) {
$_company_data['admin_username'] = $_company_data['request_account_name'];
}
$user_data = fn_create_company_admin($_company_data, $_company_data['fields'], false);
if (!empty($user_data['user_id'])) {
$username = $user_data['user_login'];
$account = 'new';
}
}
}
}
if (empty($user_data)) {
$user_id = db_get_field("SELECT user_id FROM ?:users WHERE company_id = ?i AND is_root = 'Y' AND user_type = 'V'", $company_id);
$user_data = fn_get_user_info($user_id);
}
/**
* Actions between change company status and send mail
*
* @param int $company_id Company ID
* @param string $status_to Status to letter
* @param string $reason Reason text
* @param string $status_from Status from letter
* @param bool $skip_query Skip query flag
* @param bool $notify Notify flag
* @param array $company_data Company data
* @param array $user_data User data
* @param bool $result Updated flag
*/
fn_set_hook('change_company_status_before_mail', $company_id, $status_to, $reason, $status_from, $skip_query, $notify, $company_data, $user_data, $result);
if ($notify && !empty($company_data['email'])) {
$e_username = '';
$e_account = '';
$e_password = '';
if ($status_from == 'N' && ($status_to == 'A' || $status_to == 'P')) {
$e_username = $username;
$e_account = $account;
if ($account == 'new') {
$e_password = $user_data['password1'];
}
}
$mail_template = fn_strtolower($status_from . '_' . $status_to);
Mailer::sendMail(array('to' => $company_data['email'], 'from' => 'default_company_support_department', 'data' => array('user_data' => $user_data, 'reason' => $reason, 'status' => __($status_to == 'A' ? 'active' : 'disabled'), 'e_username' => $e_username, 'e_account' => $e_account, 'e_password' => $e_password), 'company_id' => $company_id, 'tpl' => 'companies/status_' . $mail_template . '_notification.tpl'), 'A');
}
return $result;
}