$contents[] = array('text' => sprintf(TEXT_MOVE_PAGES_INTRO, $cInfo->categories_or_pages_name)); $contents[] = array('text' => '<br />' . sprintf(TEXT_MOVE, $cInfo->categories_or_pages_name) . '<br /><div class="form-group">' . xos_draw_pull_down_menu('move_to_page_id', xos_get_page_tree(), $cInfo->categories_or_pages_id, 'class="form-control"') . '</div>'); $contents[] = array('text' => '<br /><a href="" onclick="pages.submit(); return false" class="btn btn-default btn-margin-infobox" title=" ' . BUTTON_TITLE_MOVE . ' ">' . BUTTON_TEXT_MOVE . '</a><a href="' . xos_href_link(FILENAME_PAGES, 'cPath=' . $cPath . '&cpID=' . $cInfo->categories_or_pages_id) . '" class="btn btn-default btn-margin-infobox" title=" ' . BUTTON_TITLE_CANCEL . ' ">' . BUTTON_TEXT_CANCEL . '</a><br /> '); break; default: if ($rows > 0) { if (isset($cInfo) && is_object($cInfo)) { // page info box contents $page_path_string = ''; $page_path = xos_generate_page_path($cInfo->categories_or_pages_id); for ($i = sizeof($page_path[0]) - 1; $i > 0; $i--) { $page_path_string .= $page_path[0][$i]['id'] . '_'; } $page_path_string = substr($page_path_string, 0, -1); $heading_title = '<b>' . $cInfo->categories_or_pages_name . '</b>'; $contents[] = array('text' => '<a href="' . xos_href_link(FILENAME_PAGES, 'cPath=' . $page_path_string . '&cpID=' . $cInfo->categories_or_pages_id . '&action=new_page') . '" class="btn btn-default btn-margin-infobox" title=" ' . BUTTON_TITLE_EDIT . ' ">' . BUTTON_TEXT_EDIT . '</a><a href="' . xos_href_link(FILENAME_PAGES, 'cPath=' . $page_path_string . '&cpID=' . $cInfo->categories_or_pages_id . '&action=move_page') . '" class="btn btn-default btn-margin-infobox" title=" ' . BUTTON_TITLE_MOVE . ' ">' . BUTTON_TEXT_MOVE . '</a><a href="' . xos_href_link(FILENAME_PAGES, 'cPath=' . $page_path_string . '&cpID=' . $cInfo->categories_or_pages_id . '&action=delete_page') . '" class="btn btn-danger btn-margin-infobox" title=" ' . BUTTON_TITLE_DELETE . ' ">' . BUTTON_TEXT_DELETE . '</a><a href="' . xos_href_link(FILENAME_PAGES, xos_get_path($cInfo->categories_or_pages_id) . '&action=new_page') . '" class="btn btn-default btn-margin-infobox" title=" ' . BUTTON_TITLE_NEW_PAGE . ' ' . $cInfo->categories_or_pages_name . ' ">' . BUTTON_TEXT_NEW_PAGE . ' "' . $cInfo->categories_or_pages_name . '"</a>'); $contents[] = array('text' => '<br />' . TEXT_DATE_ADDED . ' ' . xos_date_short($cInfo->date_added)); if (xos_not_null($cInfo->last_modified)) { $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . xos_date_short($cInfo->last_modified)); } $contents[] = array('text' => '<br />' . TEXT_SUBPAGES . ' ' . $cInfo->children_count . '<br /> '); } } else { $heading_title = '<b>' . EMPTY_PAGE . '</b>'; $contents[] = array('text' => TEXT_NO_CHILD_PAGES); } break; } $smarty->assign(array('info_box_heading_title' => $heading_title, 'info_box_form_tag' => $form_tag, 'info_box_contents' => $contents)); $output_infobox_pages = $smarty->fetch(ADMIN_TPL . '/includes/boxes/infobox_pages.tpl'); $smarty->clearAssign(array('info_box_heading_title', 'info_box_form_tag', 'info_box_contents'));
$smarty->assign('central_contents', $output_new_page); } else { $pages_count = 0; $rows = 0; $pages_query = xos_db_query("select c.categories_or_pages_id, cpd.categories_or_pages_name, c.parent_id, c.page_not_in_menu, c.sort_order, c.date_added, c.last_modified, c.categories_or_pages_status from " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_CATEGORIES_OR_PAGES_DATA . " cpd where c.parent_id = '" . (int) $current_page_id . "' and c.categories_or_pages_id = cpd.categories_or_pages_id and c.is_page != 'false' and cpd.language_id = '" . (int) $_SESSION['used_lng_id'] . "' order by c.sort_order, cpd.categories_or_pages_name"); $pages_array = array(); while ($pages = xos_db_fetch_array($pages_query)) { $pages_count++; $rows++; $children_in_page = xos_children_in_page_count($pages['categories_or_pages_id']); if ((!isset($_GET['cpID']) && !isset($_GET['pID']) || isset($_GET['cpID']) && $_GET['cpID'] == $pages['categories_or_pages_id']) && !isset($cInfo) && substr($action, 0, 3) != 'new') { $page_children = array('children_count' => $children_in_page); $cInfo_array = array_merge((array) $pages, (array) $page_children); $cInfo = new objectInfo($cInfo_array); } $pages_array[] = array('selected' => isset($cInfo) && is_object($cInfo) && $pages['categories_or_pages_id'] == $cInfo->categories_or_pages_id ? true : false, 'children' => $children_in_page > 0 ? $children_in_page : false, 'status' => $pages['categories_or_pages_status'] == '1' ? true : false, 'page_not_in_menu' => $pages['page_not_in_menu'] == '1' ? true : false, 'name' => htmlspecialchars($pages['categories_or_pages_name']), 'sort_order' => $pages['sort_order'], 'icon_status_green' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_green.gif', ICON_TITLE_STATUS_GREEN), 'icon_status_red' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_red.gif', ICON_TITLE_STATUS_RED), 'icon_status_green_light' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_green_light.gif', ICON_TITLE_STATUS_GREEN_LIGHT), 'icon_status_red_light' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_red_light.gif', ICON_TITLE_STATUS_RED_LIGHT), 'icon_not_in_menu_green' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_not_in_menu_green.gif', ICON_TITLE_STATUS_GREEN), 'icon_not_in_menu_red' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_not_in_menu_red.gif', ICON_TITLE_STATUS_RED), 'icon_not_in_menu_green_light' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_not_in_menu_green_light.gif', ICON_TITLE_STATUS_GREEN_LIGHT), 'icon_not_in_menu_red_light' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_not_in_menu_red_light.gif', ICON_TITLE_STATUS_RED_LIGHT), 'link_filename_pages_flag_status_0' => xos_href_link(FILENAME_PAGES, 'action=setflag_status&flag_status=0&cpID=' . $pages['categories_or_pages_id'] . '&cPath=' . $cPath), 'link_filename_pages_flag_status_1' => xos_href_link(FILENAME_PAGES, 'action=setflag_status&flag_status=1&cpID=' . $pages['categories_or_pages_id'] . '&cPath=' . $cPath), 'link_filename_pages_flag_not_in_menu_0' => xos_href_link(FILENAME_PAGES, 'action=setflag_menu&flag_menu=0&cpID=' . $pages['categories_or_pages_id'] . '&cPath=' . $cPath), 'link_filename_pages_flag_not_in_menu_1' => xos_href_link(FILENAME_PAGES, 'action=setflag_menu&flag_menu=1&cpID=' . $pages['categories_or_pages_id'] . '&cPath=' . $cPath), 'link_filename_pages_get_path' => xos_href_link(FILENAME_PAGES, xos_get_path($pages['categories_or_pages_id'])), 'link_filename_pages_edit' => xos_href_link(FILENAME_PAGES, 'cPath=' . $cPath . '&cpID=' . $pages['categories_or_pages_id'] . '&action=new_page'), 'link_filename_pages_cpath_cpath_cid' => xos_href_link(FILENAME_PAGES, 'cPath=' . $cPath . '&cpID=' . $pages['categories_or_pages_id'])); } $cPath_back = ''; $page_path = xos_generate_page_path($current_page_id); for ($i = sizeof($page_path[0]) - 1; $i > 0; $i--) { $current_page_id != $page_path[0][$i]['id'] ? $cPath_back .= $page_path[0][$i]['id'] . '_' : ''; } $cPath_back = substr($cPath_back, 0, -1); $cPath_back = xos_not_null($cPath_back) ? 'cPath=' . $cPath_back . '&' : ''; if ($current_page_id > 0) { $smarty->assign('link_filename_pages_back', xos_href_link(FILENAME_PAGES, $cPath_back . 'cpID=' . $current_page_id)); } $page_tree = xos_get_page_tree(); $current_page_name = ''; for ($i = 0, $n = sizeof($page_tree); $i < $n; $i++) { if ($current_page_id == $page_tree[$i]['id']) {
} } else { $categories_query = xos_db_query("select c.categories_or_pages_id, cpd.categories_or_pages_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_CATEGORIES_OR_PAGES_DATA . " cpd where c.categories_or_pages_status = '1' and c.parent_id = '" . (int) $current_category_id . "' and c.categories_or_pages_id = cpd.categories_or_pages_id and cpd.language_id = '" . (int) $_SESSION['languages_id'] . "' order by sort_order, cpd.categories_or_pages_name"); } $number_of_categories = xos_db_num_rows($categories_query); $rows = 0; $categories_array = array(); while ($categories = xos_db_fetch_array($categories_query)) { if (SHOW_EMPTY_CATEGORIES == 'true') { $products_in_categories = 1; } else { $products_in_categories = xos_count_products_in_category($categories['categories_or_pages_id']); } if ($products_in_categories > 0) { $rows++; $cPath_new = xos_get_path($categories['categories_or_pages_id']); $width = (int) (100 / MAX_DISPLAY_CATEGORIES_PER_ROW - 1) . '%'; if ($rows / MAX_DISPLAY_CATEGORIES_PER_ROW == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) && $rows != $number_of_categories) { $more_rows = true; } else { $more_rows = false; } $categories_array[] = array('link_to_product_listing' => xos_href_link(FILENAME_DEFAULT, $cPath_new), 'image' => xos_image(DIR_WS_IMAGES . 'categories/medium/' . rawurlencode($categories['categories_image']), $categories['categories_or_pages_name']), 'name' => $categories['categories_or_pages_name'], 'td_width' => $width, 'more_rows' => $more_rows); } } $smarty->assign(array('heading_title' => $category['categories_or_pages_heading_title'], 'category_name' => $category['categories_or_pages_name'], 'category_description' => $category['categories_or_pages_content'], 'heading_image' => $page_info == 'false' ? xos_image(DIR_WS_IMAGES . 'categories/small/' . rawurlencode($category['categories_image']), $category['categories_or_pages_name']) : '', 'display' => 'categories', 'categories' => $categories_array)); // needed for the new products module shown below $new_products_category_id = $current_category_id; if (DISPLAY_PRODUCT_LISTING_IN_PARENT_CATEGORY == 'true') { if ($category['product_list_b'] == 1 && $_SESSION['pcv'] != 'list' || $_SESSION['pcv'] == 'grid') { $product_list_b = true;
$contents[] = array('text' => sprintf(TEXT_MOVE_PAGES_INTRO, $cInfo->categories_or_pages_name)); $contents[] = array('text' => '<br />' . sprintf(TEXT_MOVE, $cInfo->categories_or_pages_name) . '<br />' . xos_draw_pull_down_menu('move_to_page_id', xos_get_page_tree(), $cInfo->categories_or_pages_id)); $contents[] = array('text' => '<br /><a href="" onclick="pages.submit(); return false" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_MOVE . ' "><span>' . BUTTON_TEXT_MOVE . '</span></a><a href="' . xos_href_link(FILENAME_PAGES, 'cPath=' . $cPath . '&cpID=' . $cInfo->categories_or_pages_id) . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_CANCEL . ' "><span>' . BUTTON_TEXT_CANCEL . '</span></a><br /> '); break; default: if ($rows > 0) { if (isset($cInfo) && is_object($cInfo)) { // page info box contents $page_path_string = ''; $page_path = xos_generate_page_path($cInfo->categories_or_pages_id); for ($i = sizeof($page_path[0]) - 1; $i > 0; $i--) { $page_path_string .= $page_path[0][$i]['id'] . '_'; } $page_path_string = substr($page_path_string, 0, -1); $heading_title = '<b>' . $cInfo->categories_or_pages_name . '</b>'; $contents[] = array('text' => '<a href="' . xos_href_link(FILENAME_PAGES, 'cPath=' . $page_path_string . '&cpID=' . $cInfo->categories_or_pages_id . '&action=new_page') . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_EDIT . ' "><span>' . BUTTON_TEXT_EDIT . '</span></a><a href="' . xos_href_link(FILENAME_PAGES, 'cPath=' . $page_path_string . '&cpID=' . $cInfo->categories_or_pages_id . '&action=delete_page') . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_DELETE . ' "><span>' . BUTTON_TEXT_DELETE . '</span></a><a href="' . xos_href_link(FILENAME_PAGES, 'cPath=' . $page_path_string . '&cpID=' . $cInfo->categories_or_pages_id . '&action=move_page') . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_MOVE . ' "><span>' . BUTTON_TEXT_MOVE . '</span></a><a href="' . xos_href_link(FILENAME_PAGES, xos_get_path($cInfo->categories_or_pages_id) . '&action=new_page') . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_NEW_PAGE . ' ' . $cInfo->categories_or_pages_name . ' "><span>' . BUTTON_TEXT_NEW_PAGE . ' "' . $cInfo->categories_or_pages_name . '"</span></a>'); $contents[] = array('text' => '<br />' . TEXT_DATE_ADDED . ' ' . xos_date_short($cInfo->date_added)); if (xos_not_null($cInfo->last_modified)) { $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . xos_date_short($cInfo->last_modified)); } $contents[] = array('text' => '<br />' . TEXT_SUBPAGES . ' ' . $cInfo->children_count . '<br /> '); } } else { $heading_title = '<b>' . EMPTY_PAGE . '</b>'; $contents[] = array('text' => TEXT_NO_CHILD_PAGES); } break; } $smarty->assign(array('info_box_heading_title' => $heading_title, 'info_box_form_tag' => $form_tag, 'info_box_contents' => $contents)); $output_infobox_pages = $smarty->fetch(ADMIN_TPL . '/includes/boxes/infobox_pages.tpl'); $smarty->clearAssign(array('info_box_heading_title', 'info_box_form_tag', 'info_box_contents'));
if (!(@(include DIR_FS_SMARTY . 'admin/templates/' . ADMIN_TPL . '/php/includes/modules/categories_and_products.php') == 'overwrite_all')) { $categories_count = 0; $rows = 0; if (!isset($_GET['search'])) { $categories_query = xos_db_query("select c.categories_or_pages_id, cpd.categories_or_pages_name, c.categories_image, c.parent_id, c.product_list_b, c.sort_order, c.date_added, c.last_modified, c.categories_or_pages_status from " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_CATEGORIES_OR_PAGES_DATA . " cpd where c.parent_id = '" . (int) $current_category_id . "' and c.categories_or_pages_id = cpd.categories_or_pages_id and c.is_page = 'false' and cpd.language_id = '" . (int) $_SESSION['used_lng_id'] . "' order by c.sort_order, cpd.categories_or_pages_name"); $categories_array = array(); while ($categories = xos_db_fetch_array($categories_query)) { $categories_count++; $rows++; if ((!isset($_GET['cpID']) && !isset($_GET['pID']) || isset($_GET['cpID']) && $_GET['cpID'] == $categories['categories_or_pages_id']) && !isset($cInfo) && substr($action, 0, 3) != 'new') { $category_children = array('children_count' => xos_children_in_category_count($categories['categories_or_pages_id'])); $category_products = array('products_count' => xos_products_in_category_count($categories['categories_or_pages_id'])); $cInfo_array = array_merge((array) $categories, (array) $category_children, (array) $category_products); $cInfo = new objectInfo($cInfo_array); } $categories_array[] = array('selected' => isset($cInfo) && is_object($cInfo) && $categories['categories_or_pages_id'] == $cInfo->categories_or_pages_id ? true : false, 'status' => $categories['categories_or_pages_status'] == '1' ? true : false, 'name' => htmlspecialchars($categories['categories_or_pages_name']), 'sort_order' => $categories['sort_order'], 'icon_status_green' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_green.gif', ICON_TITLE_STATUS_GREEN), 'icon_status_red' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_red.gif', ICON_TITLE_STATUS_RED), 'icon_status_green_light' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_green_light.gif', ICON_TITLE_STATUS_GREEN_LIGHT), 'icon_status_red_light' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_red_light.gif', ICON_TITLE_STATUS_RED_LIGHT), 'link_filename_categories_flag_0' => xos_href_link(FILENAME_CATEGORIES, 'action=setflag_cat&flag=0&cpID=' . $categories['categories_or_pages_id'] . '&cPath=' . $cPath), 'link_filename_categories_flag_1' => xos_href_link(FILENAME_CATEGORIES, 'action=setflag_cat&flag=1&cpID=' . $categories['categories_or_pages_id'] . '&cPath=' . $cPath), 'link_filename_categories_get_path' => xos_href_link(FILENAME_CATEGORIES, xos_get_path($categories['categories_or_pages_id'])), 'link_filename_categories_cpath_cpath_cid' => xos_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cpID=' . $categories['categories_or_pages_id'])); } } $products_count = 0; if (isset($_GET['search'])) { $search = xos_db_prepare_input($_GET['search']); $products_query = xos_db_query("select distinct p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_sort_order, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_or_pages_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['used_lng_id'] . "' and p.products_id = p2c.products_id and pd.products_name like '%" . xos_db_input($search) . "%' group by p.products_id order by p.products_sort_order, pd.products_name LIMIT 20"); } else { $products_query = xos_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_sort_order, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['used_lng_id'] . "' and p.products_id = p2c.products_id and p2c.categories_or_pages_id = '" . (int) $current_category_id . "' order by p.products_sort_order, pd.products_name"); } $products_array = array(); while ($products = xos_db_fetch_array($products_query)) { $products_count++; $rows++; // Get categories_or_pages_id for product if search if (isset($_GET['search'])) {