} if ($mode == 'add' && !$current_category['memberships']) { $current_category['membership_ids'] = unserialize($config['category_settings']['default_category_memberships']); } if (!empty($ge_id)) { $total_items = cw_group_edit_count($ge_id); $navigation = cw_core_get_navigation($target, $total_items, $page); $navigation['script'] = 'index.php?target=' . $target . '&mode=edit&cat_id=' . $cat_id . $redirect_ge_id; $smarty->assign('navigation', $navigation); $smarty->assign('categories', cw_query("select {$tables['group_editing']}.obj_id, {$tables['categories']}.category, {$tables['categories']}.category_id from {$tables['categories']}, {$tables['group_editing']} WHERE {$tables['categories']}.category_id = {$tables['group_editing']}.obj_id AND {$tables['group_editing']}.ge_id = '{$ge_id}' LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}")); $smarty->assign('ge_id', $ge_id); } $location[] = array(cw_get_langvar_by_name('lbl_categories'), 'index.php?target=' . $target); if ($mode == 'add') { $location[] = array(cw_get_langvar_by_name('lbl_add_category'), ''); } else { $location[] = array(cw_get_langvar_by_name('lbl_modify_category'), ''); $location[] = array($current_category['category'], ''); } if ($mode == 'add') { $attributes = cw_func_call('cw_attributes_get', array('item_id' => 0, 'item_type' => 'C', 'prefilled' => $attributes, 'language' => $edited_language)); } else { $attributes = cw_func_call('cw_attributes_get', array('item_id' => $cat, 'item_type' => 'C', 'prefilled' => $attributes, 'language' => $edited_language)); } $smarty->assign('attributes', $attributes); $smarty->assign('current_category', $current_category); $smarty->assign('category_location', cw_category_get_location($cat, 'categories', 1)); $smarty->assign('cat', $cat); $smarty->assign('js_tab', $js_tab); $smarty->assign('main', 'category_modify'); $smarty->assign('mode', $mode);
list($products, $navigation, $product_filter) = cw_func_call('cw_product_search', array('data' => $data, 'user_account' => $user_account, 'current_area' => $current_area, 'info_type' => $info_type)); $navigation['script'] = cw_call('cw_core_get_html_page_url', array(array('var' => 'index', 'cat' => $cat, 'include_question' => 1, 'delimiter' => '&', 'att' => $att))); $smarty->assign('navigation', $navigation); $smarty->assign('products', $products); $smarty->assign('product_filter', $product_filter); if ($config['product_filter']['is_ajax'] == 'Y' && $ajax_filter) { $ns = cw_call('cw_core_get_html_page_url', array(array('var' => 'index', 'cat' => $cat, 'include_question' => 1, 'delimiter' => '&'))); $url = cw_product_get_filter_replaced_url($product_filter, $ns); $smarty->assign('replaced_url', $url); } $current_category = cw_func_call('cw_category_get', array('cat' => $cat)); if (!$current_category) { cw_header_location('index.php'); } $smarty->assign('current_category', $current_category); $location = array_merge($location, cw_category_get_location($cat, '', 0, 1)); if (!empty($products) && count($products)) { $smarty->assign('category_category_url', str_replace($app_web_dir, "", cw_category_category_url($cat))); } $smarty->assign('sort_fields', cw_call('cw_product_get_sort_fields')); $smarty->assign('search_prefilled', $data); # kornev, recent categories $recent_categories =& cw_session_register('recent_categories', array()); array_unshift($recent_categories, $cat); if (count($recent_categories)) { $recent_categories = array_unique($recent_categories); $recent_categories = array_slice($recent_categories, 0, $config['General']['recent_categories_amount']); $tmp = cw_query("select category_id from {$tables['categories']} where category_id in ('" . implode("', '", $recent_categories) . "')"); $to_sort = array_flip($recent_categories); foreach ($tmp as $val) { $ret = cw_func_call('cw_category_get', array('cat' => $val['category_id']));