public function index($id = 0, $params = array()) { $lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE); if (!empty($id)) { $data = fn_get_category_data($id, $lang_code); if (empty($data)) { $status = Response::STATUS_NOT_FOUND; } else { $status = Response::STATUS_OK; } } else { if (!empty($params['category_ids']) && is_array($params['category_ids'])) { $params['item_ids'] = $params['category_ids']; } $params['plain'] = $this->safeGet($params, 'plain', true); $params['simple'] = $this->safeGet($params, 'simple', false); $params['group_by_level'] = $this->safeGet($params, 'group_by_level', false); $items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_products_per_page')); $page = $this->safeGet($params, 'page', 1); list($data, $params) = fn_get_categories($params, $lang_code); $params['items_per_page'] = $items_per_page; $params['page'] = $page; $params['total_items'] = count($data); if ($items_per_page) { $data = array_slice($data, ($page - 1) * $items_per_page, $items_per_page); } $data = array('categories' => $data, 'params' => $params); $status = Response::STATUS_OK; } return array('status' => $status, 'data' => $data); }
$_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; if (Registry::get('settings.General.show_products_from_subcategories') == 'Y') { $params['subcats'] = 'Y'; } // [Breadcrumbs] $parent_ids = explode('/', $category_data['id_path']); array_pop($parent_ids); if (!empty($parent_ids)) { $cats = fn_get_category_name($parent_ids); foreach ($parent_ids as $c_id) { fn_add_breadcrumb($cats[$c_id], "companies.products?category_id={$c_id}&company_id={$company_id}"); } } fn_add_breadcrumb($category_data['category']);
function fn_is_accessible_discussion($data, &$auth) { $access = false; if ($data['object_type'] == 'P') { //product $access = fn_get_product_data($data['object_id'], $auth, CART_LANGUAGE, $field_list = '?:products.product_id', false, false, false); } elseif ($data['object_type'] == 'C') { //category $access = fn_get_category_data($data['object_id'], '', $field_list = '?:categories.category_id', false); } elseif ($data['object_type'] == 'M') { //company $access = fn_get_company_data($data['object_id']); } elseif ($data['object_type'] == 'O') { //order if (!empty($auth['user_id'])) { $access = db_get_field("SELECT order_id FROM ?:orders WHERE order_id = ?i AND user_id = ?i", $data['object_id'], $auth['user_id']); } elseif (!empty($auth['order_ids'])) { $access = in_array($data['object_id'], $auth['order_ids']); } } elseif ($data['object_type'] == 'A') { // page $access = fn_get_page_data($data['object_id'], CART_LANGUAGE); } elseif ($data['object_type'] == 'E') { // testimonials $access = true; } fn_set_hook('is_accessible_discussion', $data, $auth, $access); return !empty($access); }
$_condition .= ' AND (' . fn_find_array_in_set($auth['usergroup_ids'], 'usergroup_ids', true) . ')'; $_condition .= db_quote(' AND status IN (?a)', $_statuses); } if (fn_allowed_for('ULTIMATE')) { $_condition .= fn_get_company_condition('?:categories.company_id'); } $category_exists = db_get_field("SELECT category_id FROM ?:categories WHERE category_id = ?i ?p", $_REQUEST['category_id'], $_condition); if (!empty($category_exists)) { // Save current url to session for 'Continue shopping' button $_SESSION['continue_url'] = "categories.view?category_id={$_REQUEST['category_id']}"; // Save current category id to session $_SESSION['current_category_id'] = $_SESSION['breadcrumb_category_id'] = $_REQUEST['category_id']; // Get subcategories list for current category Tygh::$app['view']->assign('subcategories', fn_get_subcategories($_REQUEST['category_id'])); // Get full data for current category $category_data = fn_get_category_data($_REQUEST['category_id'], CART_LANGUAGE, '*', true, false, $preview); $category_parent_ids = fn_explode('/', $category_data['id_path']); array_pop($category_parent_ids); if (!empty($category_data['meta_description']) || !empty($category_data['meta_keywords'])) { Tygh::$app['view']->assign('meta_description', $category_data['meta_description']); Tygh::$app['view']->assign('meta_keywords', $category_data['meta_keywords']); } $params = $_REQUEST; if ($items_per_page = fn_change_session_param($_SESSION, $_REQUEST, 'items_per_page')) { $params['items_per_page'] = $items_per_page; } if ($sort_by = fn_change_session_param($_SESSION, $_REQUEST, 'sort_by')) { $params['sort_by'] = $sort_by; } if ($sort_order = fn_change_session_param($_SESSION, $_REQUEST, 'sort_order')) { $params['sort_order'] = $sort_order;
if (!empty($field_groups['A'][$field])) { $filled_groups['A'][$field] = __($desc); continue; } elseif (!empty($field_groups['B'][$field])) { $filled_groups['B'][$field] = __($desc); continue; } elseif (!empty($field_groups['C'][$field])) { $filled_groups['C'][$field] = __($desc); continue; } $field_names[$field] = __($desc); } ksort($filled_groups, SORT_STRING); $categories_data = array(); foreach ($category_ids as $value) { $categories_data[$value] = fn_get_category_data($value, DESCR_SL, '?:categories.category_id, ?:categories.company_id' . $data_search_fields, $get_main_pair); } Tygh::$app['view']->assign('field_groups', $field_groups); Tygh::$app['view']->assign('filled_groups', $filled_groups); Tygh::$app['view']->assign('fields2update', $fields2update); Tygh::$app['view']->assign('field_names', $field_names); Tygh::$app['view']->assign('categories_data', $categories_data); // // 'Management' page // } elseif ($mode == 'manage' || $mode == 'picker') { if ($mode == 'manage') { unset($_SESSION['category_ids']); unset($_SESSION['selected_fields']); Tygh::$app['view']->assign('categories_stats', fn_get_categories_stats()); }
$_statuses = array('A', 'H'); $_condition = ' AND (' . fn_find_array_in_set($auth['usergroup_ids'], 'usergroup_ids', true) . ')'; $_condition .= fn_get_localizations_condition('localization', true); if ($auth['area'] != 'A' || empty($_REQUEST['action']) || $_REQUEST['action'] != 'preview') { $_condition .= db_quote(' AND status IN (?a)', $_statuses); } $is_avail = db_get_field("SELECT category_id FROM ?:categories WHERE category_id = ?i ?p", $_REQUEST['category_id'], $_condition); if (!empty($is_avail)) { // Save current url to session for 'Continue shopping' button $_SESSION['continue_url'] = "categories.view?category_id={$_REQUEST['category_id']}"; // Save current category id to session $_SESSION['current_category_id'] = $_REQUEST['category_id']; // Get subcategories list for current category $view->assign('subcategories', fn_get_subcategories($_REQUEST['category_id'])); // Get full data for current category $category_data = fn_get_category_data($_REQUEST['category_id'], CART_LANGUAGE, '*'); if (!empty($category_data['meta_description']) || !empty($category_data['meta_keywords'])) { $view->assign('meta_description', $category_data['meta_description']); $view->assign('meta_keywords', $category_data['meta_keywords']); } $params = $_REQUEST; $params['cid'] = $_REQUEST['category_id']; $params['type'] = 'extended'; if (Registry::get('settings.General.show_products_from_subcategories') == 'Y') { $params['subcats'] = 'Y'; } list($products, $search) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page')); if (!empty($products)) { foreach ($products as $k => $v) { fn_gather_additional_product_data($products[$k], true, true, true, true, true); }
function fn_twg_get_api_category_data($category_id, $lang_code) { $category = fn_get_category_data($category_id, $lang_code); if (!empty($category['parent_id'])) { $category['parent_category'] = db_get_field("SELECT category\n FROM ?:category_descriptions\n WHERE ?:category_descriptions.category_id = ?i\n AND ?:category_descriptions.lang_code = ?s", $category['parent_id'], $lang_code); } if (!empty($category['main_pair'])) { $category['icon'] = TwigmoImage::getApiImageData($category['main_pair'], 'category', 'detailed', $_REQUEST); } return Api::getAsApiObject('categories', $category); }
if (!empty($_REQUEST['combination'])) { $product['combination'] = $combination; } fn_gather_additional_product_data($product, true, true); $xml .= fn_array_to_xml($product, 'product_data'); } } if ($mode == 'get_categories') { $_REQUEST['category_id'] = empty($_REQUEST['category_id']) ? 0 : $_REQUEST['category_id']; $params = array('category_id' => $_REQUEST['category_id'], 'visible' => false, 'plain' => !empty($_REQUEST['format']) && $_REQUEST['format'] == 'plain' ? true : false); list($categories, ) = fn_get_categories($params, CART_LANGUAGE); $xml .= fn_array_to_xml($categories, 'categories'); } if ($mode == 'get_category') { $_REQUEST['category_id'] = empty($_REQUEST['category_id']) ? 0 : $_REQUEST['category_id']; $category_data = fn_get_category_data($_REQUEST['category_id'], '*'); if (!empty($category_data)) { $xml .= fn_array_to_xml($category_data, 'category_data'); } } echo $xml; exit; function fn_array_to_xml(&$array, $name) { $xml = "<{$name}>"; $subname = 'item'; foreach ($array as $k => $v) { if (!is_array($v)) { $param = is_int($k) ? $subname : $k; $id = is_int($k) ? " id=\"{$k}\"" : ''; $xml .= "<{$param}{$id}>";
function content_55ccecb4cf6e64_39106577($_smarty_tpl) { if (!is_callable('smarty_function_math')) { include '/home/coriolan/public_html/lead/app/lib/other/smarty/plugins/function.math.php'; } fn_preload_lang_vars(array('edit', 'remove', 'add_categories', 'remove', 'remove', 'remove')); if ($_smarty_tpl->tpl_vars['category_id']->value) { ?> <?php $_smarty_tpl->tpl_vars["category_data"] = new Smarty_variable(fn_get_category_data($_smarty_tpl->tpl_vars['category_id']->value, @constant('CART_LANGUAGE'), '', false, true), null, 0); ?> <?php $_smarty_tpl->tpl_vars["category"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['category_data']->value['category']) === null || $tmp === '' ? (string) $_smarty_tpl->tpl_vars['ldelim']->value . "category" . (string) $_smarty_tpl->tpl_vars['rdelim']->value : $tmp, null, 0); ?> <?php if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && ($_smarty_tpl->tpl_vars['owner_company_id']->value && $_smarty_tpl->tpl_vars['owner_company_id']->value != $_smarty_tpl->tpl_vars['runtime']->value['company_id'] && $_smarty_tpl->tpl_vars['category_data']->value['company_id'] != $_smarty_tpl->tpl_vars['runtime']->value['company_id'] || $_smarty_tpl->tpl_vars['category_data']->value['company_id'] != $_smarty_tpl->tpl_vars['runtime']->value['company_id'])) { ?> <?php $_smarty_tpl->tpl_vars["show_only_name"] = new Smarty_variable(true, null, 0); ?> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && $_smarty_tpl->tpl_vars['owner_company_id']->value && $_smarty_tpl->tpl_vars['owner_company_id']->value != $_smarty_tpl->tpl_vars['runtime']->value['company_id']) { ?> <?php $_smarty_tpl->tpl_vars["hide_delete_button"] = new Smarty_variable(true, null, 0); ?> <?php } } else { ?> <?php $_smarty_tpl->tpl_vars["category"] = new Smarty_variable($_smarty_tpl->tpl_vars['default_name']->value, null, 0); } if ($_smarty_tpl->tpl_vars['multiple']->value) { ?> <tr <?php if (!$_smarty_tpl->tpl_vars['clone']->value) { ?> id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['holder']->value, ENT_QUOTES, 'UTF-8'); ?> _<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> " <?php } ?> class="cm-js-item <?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> cm-clone hidden<?php } ?> "> <?php if ($_smarty_tpl->tpl_vars['position_field']->value) { ?> <td><input type="text" name="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['input_name']->value, ENT_QUOTES, 'UTF-8'); ?> [<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> ]" value="<?php echo smarty_function_math(array('equation' => "a*b", 'a' => $_smarty_tpl->tpl_vars['position']->value, 'b' => 10), $_smarty_tpl); ?> " size="3" class="input-text-short"<?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> disabled="disabled"<?php } ?> /></td><?php } ?> <td> <?php if (!$_smarty_tpl->tpl_vars['show_only_name']->value) { ?> <a href="<?php echo htmlspecialchars(fn_url("categories.update?category_id=" . (string) $_smarty_tpl->tpl_vars['category_id']->value), ENT_QUOTES, 'UTF-8'); ?> "> <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value, ENT_QUOTES, 'UTF-8'); ?> </a> <?php } else { ?> <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value, ENT_QUOTES, 'UTF-8'); ?> <?php echo $_smarty_tpl->getSubTemplate("views/companies/components/company_name.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object' => $_smarty_tpl->tpl_vars['category_data']->value), 0); ?> <?php } ?> </td> <td width="5%" class="nowrap"> <?php if (!$_smarty_tpl->tpl_vars['view_only']->value || $_smarty_tpl->tpl_vars['show_only_name']->value) { ?> <?php $_smarty_tpl->_capture_stack[0][] = array("tools_list", null, null); ob_start(); ?> <li><?php smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'text' => __("edit"), 'href' => "categories.update?category_id=" . (string) $_smarty_tpl->tpl_vars['category_id']->value)); ?> </li> <?php if (!$_smarty_tpl->tpl_vars['hide_delete_button']->value) { ?> <li><?php smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'text' => __("remove"), 'onclick' => "Tygh." . "\$" . ".cePicker('delete_js_item', '" . (string) $_smarty_tpl->tpl_vars['holder']->value . "', '" . (string) $_smarty_tpl->tpl_vars['category_id']->value . "', 'c'); return false;")); ?> </li> <?php } ?> <?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]); if (!empty($_capture_buffer)) { 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(); } ?> <div class="hidden-tools"> <?php smarty_template_function_dropdown($_smarty_tpl, array('content' => Smarty::$_smarty_vars['capture']['tools_list'])); ?> </div> <?php } ?> </td> </tr> <?php } else { ?> <?php if ($_smarty_tpl->tpl_vars['view_mode']->value != "list") { ?> <span <?php if (!$_smarty_tpl->tpl_vars['clone']->value) { ?> id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['holder']->value, ENT_QUOTES, 'UTF-8'); ?> _<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> " <?php } ?> class="cm-js-item <?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> cm-clone hidden<?php } ?> "> <?php if (!$_smarty_tpl->tpl_vars['first_item']->value && $_smarty_tpl->tpl_vars['single_line']->value) { ?> <span class="cm-comma<?php if ($_smarty_tpl->tpl_vars['clone']->value) { ?> hidden<?php } ?> ">, </span><?php } ?> <div class="input-append"> <input class="cm-picker-value-description <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['extra_class']->value, ENT_QUOTES, 'UTF-8'); ?> " type="text" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value, ENT_QUOTES, 'UTF-8'); ?> " <?php if ($_smarty_tpl->tpl_vars['display_input_id']->value) { ?> id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['display_input_id']->value, ENT_QUOTES, 'UTF-8'); ?> "<?php } ?> size="10" name="category_name" readonly="readonly" <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['extra']->value, ENT_QUOTES, 'UTF-8'); ?> id="appendedInputButton"> <?php if (!$_smarty_tpl->tpl_vars['runtime']->value['company_id'] || $_smarty_tpl->tpl_vars['runtime']->value['controller'] != "companies") { ?> <?php if ($_smarty_tpl->tpl_vars['multiple']->value) { ?> <?php $_smarty_tpl->tpl_vars["_but_text"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['but_text']->value) === null || $tmp === '' ? $_smarty_tpl->__("add_categories") : $tmp, null, 0); ?> <?php $_smarty_tpl->tpl_vars["_but_role"] = new Smarty_variable("add", null, 0); ?> <?php $_smarty_tpl->tpl_vars["_but_icon"] = new Smarty_variable("icon-plus", null, 0); ?> <?php } else { ?> <?php $_smarty_tpl->tpl_vars["_but_text"] = new Smarty_variable("<i class='icon-plus'></i>", null, 0); ?> <?php $_smarty_tpl->tpl_vars["_but_role"] = new Smarty_variable("icon", null, 0); ?> <?php } ?> <?php echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_id' => "opener_picker_" . (string) $_smarty_tpl->tpl_vars['data_id']->value, 'but_href' => fn_url("categories.picker?display=" . (string) $_smarty_tpl->tpl_vars['display']->value . "&company_ids=" . (string) $_smarty_tpl->tpl_vars['company_ids']->value . "&picker_for=" . (string) $_smarty_tpl->tpl_vars['picker_for']->value . "&extra=" . (string) $_smarty_tpl->tpl_vars['extra_var']->value . "&checkbox_name=" . (string) $_smarty_tpl->tpl_vars['checkbox_name']->value . "&root=" . (string) $_smarty_tpl->tpl_vars['default_name']->value . "&except_id=" . (string) $_smarty_tpl->tpl_vars['except_id']->value . "&data_id=" . (string) $_smarty_tpl->tpl_vars['data_id']->value . (string) $_smarty_tpl->tpl_vars['extra_url']->value), 'but_text' => $_smarty_tpl->tpl_vars['_but_text']->value, 'but_role' => $_smarty_tpl->tpl_vars['_but_role']->value, 'but_icon' => $_smarty_tpl->tpl_vars['_but_icon']->value, 'but_target_id' => "content_" . (string) $_smarty_tpl->tpl_vars['data_id']->value, 'but_meta' => (string) $_smarty_tpl->tpl_vars['but_meta']->value . " cm-dialog-opener add-on btn"), 0); ?> <?php } ?> </div> </span> <?php } else { ?> <?php $_smarty_tpl->tpl_vars["default_category"] = new Smarty_variable((string) $_smarty_tpl->tpl_vars['ldelim']->value . "category" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, null, 0); ?> <?php $_smarty_tpl->tpl_vars["default_category_id"] = new Smarty_variable((string) $_smarty_tpl->tpl_vars['ldelim']->value . "category_id" . (string) $_smarty_tpl->tpl_vars['rdelim']->value, null, 0); ?> <?php if ($_smarty_tpl->tpl_vars['first_item']->value || !$_smarty_tpl->tpl_vars['category_id']->value) { ?> <p class="cm-js-item cm-clone hidden"> <?php if ($_smarty_tpl->tpl_vars['hide_input']->value != "Y") { ?> <label class="radio inline-block" for="category_rb_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['default_category_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <input id="category_rb_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['default_category_id']->value, ENT_QUOTES, 'UTF-8'); ?> " type="radio" name="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['radio_input_name']->value, ENT_QUOTES, 'UTF-8'); ?> " value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['default_category_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> </label> <?php } ?> <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['default_category']->value, ENT_QUOTES, 'UTF-8'); ?> <a class="icon-remove-sign cm-tooltip hand hidden" onclick="Tygh.$.cePicker('delete_js_item', '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['holder']->value, ENT_QUOTES, 'UTF-8'); ?> ', '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['default_category_id']->value, ENT_QUOTES, 'UTF-8'); ?> ', 'c'); return false;" title="<?php echo $_smarty_tpl->__("remove"); ?> "></a> </p> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['category_id']->value) { ?> <div class="test3 cm-js-item <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['extra_class']->value, ENT_QUOTES, 'UTF-8'); ?> " id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['holder']->value, ENT_QUOTES, 'UTF-8'); ?> _<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> " <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['extra']->value, ENT_QUOTES, 'UTF-8'); ?> > <?php if ($_smarty_tpl->tpl_vars['hide_input']->value != "Y") { ?> <label class="radio inline-block" for="category_radio_button_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <input id="category_radio_button_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> " <?php if ($_smarty_tpl->tpl_vars['main_category']->value == $_smarty_tpl->tpl_vars['category_id']->value) { ?> checked<?php } ?> type="radio" name="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['radio_input_name']->value, ENT_QUOTES, 'UTF-8'); ?> " value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> " /> </label> <?php } ?> <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value, ENT_QUOTES, 'UTF-8'); ?> <?php if ($_smarty_tpl->tpl_vars['category_data']->value['company_id']) { echo $_smarty_tpl->getSubTemplate("views/companies/components/company_name.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object' => $_smarty_tpl->tpl_vars['category_data']->value, 'simple' => true), 0); } ?> <?php if (fn_allowed_for("ULTIMATE")) { ?> <?php if (!$_smarty_tpl->tpl_vars['runtime']->value['company_id'] || $_smarty_tpl->tpl_vars['runtime']->value['company_id'] && ($_smarty_tpl->tpl_vars['category_data']->value['company_id'] == $_smarty_tpl->tpl_vars['runtime']->value['company_id'] || $_smarty_tpl->tpl_vars['runtime']->value['company_id'] == $_smarty_tpl->tpl_vars['owner_company_id']->value)) { ?> <a onclick="Tygh.$.cePicker('delete_js_item', '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['holder']->value, ENT_QUOTES, 'UTF-8'); ?> ', '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> ', 'c'); return false;" class="icon-remove-sign cm-tooltip hand hidden" title="<?php echo $_smarty_tpl->__("remove"); ?> "></a> <?php } ?> <?php } else { ?> <a onclick="Tygh.$.cePicker('delete_js_item', '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['holder']->value, ENT_QUOTES, 'UTF-8'); ?> ', '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['category_id']->value, ENT_QUOTES, 'UTF-8'); ?> ', 'c'); return false;" class="icon-remove-sign cm-tooltip hand hidden" title="<?php echo $_smarty_tpl->__("remove"); ?> "></a> <?php } ?> </div> <?php } ?> <?php } } }
/** * Return product main category data * @return bool */ protected function getCategory() { if (!isset(static::$categories[$this->main_category_id])) { $category = fn_get_category_data($this->main_category_id, CART_LANGUAGE, '', false); if (!empty($category)) { static::$categories[$this->main_category_id] = $category; } } return isset(static::$categories[$this->main_category_id]) ? static::$categories[$this->main_category_id] : false; }
fn_gather_additional_product_data($products[$k], true); } } $view->assign('products', $products); $view->assign('search', $search); $selected_layout = fn_get_products_layout($_REQUEST); $view->assign('selected_layout', $selected_layout); } elseif ($link_to == 'C') { if (!empty($data['categories']) && is_array($data['categories'])) { $first_category_id = key($data['categories']); if (count($data['categories']) == 1 && !empty($first_category_id)) { $redirect_url = "categories.view?category_id=" . key($data['categories']); } else { $b_categories = array(); foreach ($data['categories'] as $category_id => $category_name) { $b_categories[$category_id] = fn_get_category_data($category_id, CART_LANGUAGE); } $not_redirect = 'Y'; $view->assign('banner_categories', $b_categories); } unset($first_category_id); } } } if ((!empty($redirect_url) || !empty($not_redirect)) && !empty($banner['banner_id']) && !empty($_REQUEST['aff_id']) && $banner_correct) { fn_add_partner_action('click', $banner['banner_id'], $_REQUEST['aff_id'], $auth['user_id'], array('R' => @$_SERVER['HTTP_REFERER'])); } if (!empty($redirect_url)) { return array(CONTROLLER_STATUS_REDIRECT, $redirect_url, true); } }
$raFeedProducts = fn_get_products(array()); $raFeedProducts = $raFeedProducts[0]; $product_url = '//'; if (Registry::get('config.https_host') != '') { $product_url = Registry::get('config.http_host') == Registry::get('config.https_host') ? 'http://' : 'https://'; $product_url .= Registry::get('config.https_host') . Registry::get('config.https_path'); } echo '<?xml version="1.0" encoding="UTF-8"?>'; echo '<products>'; foreach ($raFeedProducts as $product) { $product_data = fn_get_product_data($product['product_id'], $auth); $category_data = fn_get_category_data($product['main_category']); $category_path = ''; $category_path = $category_data['seo_name'] . $category_path; while ($category_data['level'] > 1) { $category_data = fn_get_category_data($category_data['parent_id']); $category_path = $category_data['seo_name'] . '/' . $category_path; } echo ' <product> <id>' . $product['product_id'] . '</id> <price>' . ($product['list_price'] != 0 ? $product['list_price'] : $product['price']) . '</price> <promo>' . ($product['list_price'] != 0 ? $product['price'] : $product['list_price']) . '</promo> <inventory> <variations>false</variations> <stock>' . ($product['amount'] > 0 ? 1 : 0) . '</stock> </inventory> </product>'; } echo '</products>'; die;
function fn_format_categories_items($params, $lang_code) { $items_data = $additional_data = $timestamps = array(); if (empty($params['category_id'])) { return array($items_data, $additional_data); } else { $params['cid'] = $params['category_id']; $params['sort_by'] = 'updated_timestamp'; $params['sort_order'] = 'desc'; if (Registry::get('settings.General.show_products_from_subcategories') == 'Y') { $params['subcats'] = 'Y'; } } $category_data = fn_get_category_data($params['category_id'], $lang_code, '*'); list($products, ) = fn_get_products($params, Registry::get('addons.rss_feed.category_max_products_items')); fn_gather_additional_products_data($products, array('get_icon' => true, 'get_detailed' => true, 'get_options' => true, 'get_discounts' => true, 'get_features' => false)); $additional_data['title'] = $category_data['category']; $additional_data['description'] = strip_tags(!empty($category_data['description']) ? $category_data['description'] : $additional_data['title']); $additional_data['link'] = fn_url('categories.view?category_id=' . $params['category_id'], 'C', 'current', $lang_code); $additional_data['language'] = $lang_code; $additional_data['lastBuildDate'] = !empty($products[0]['updated_timestamp']) ? $products[0]['updated_timestamp'] : TIME; $items_data = fn_format_products_items($products, array(), $lang_code); return array($items_data, $additional_data); }