for ($i = sizeof($category_path[0]) - 1; $i > 0; $i--) {
         $category_path_string .= $category_path[0][$i]['id'] . '_';
     }
     $category_path_string = substr($category_path_string, 0, -1);
     $heading_title = '<b>' . $cInfo->categories_or_pages_name . '</b>';
     $contents[] = array('text' => '<a href="' . xos_href_link(FILENAME_CATEGORIES, 'cPath=' . $category_path_string . '&cpID=' . $cInfo->categories_or_pages_id . '&action=new_category') . '" 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_CATEGORIES, 'cPath=' . $category_path_string . '&cpID=' . $cInfo->categories_or_pages_id . '&action=delete_category') . '" 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_CATEGORIES, 'cPath=' . $category_path_string . '&cpID=' . $cInfo->categories_or_pages_id . '&action=move_category') . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_MOVE . ' "><span>' . BUTTON_TEXT_MOVE . '</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 />' . xos_info_image('categories/small/' . $cInfo->categories_image, $cInfo->categories_or_pages_name) . '<br />' . $cInfo->categories_image);
     $contents[] = array('text' => '<br />' . TEXT_SUBCATEGORIES . ' ' . $cInfo->children_count . '<br />' . TEXT_PRODUCTS . ' ' . $cInfo->products_count);
 } elseif (isset($pInfo) && is_object($pInfo)) {
     // product info box contents
     $category_path_string = '';
     $category_path = xos_generate_category_path($pInfo->products_id, 'product');
     for ($i = 0, $n = sizeof($category_path[0]); $i < $n; $i++) {
         $category_path_string .= $category_path[0][$i]['id'] . '_';
     }
     $category_path_string = substr($category_path_string, 0, -1);
     $product_image = xos_get_product_images($pInfo->products_image);
     $products_prices = xos_get_product_prices($pInfo->products_price);
     $heading_title = '<b>' . xos_get_products_name($pInfo->products_id, $_SESSION['used_lng_id']) . '</b>';
     $contents[] = array('text' => '<a href="' . xos_href_link(FILENAME_CATEGORIES, 'cPath=' . $category_path_string . '&pID=' . $pInfo->products_id . '&action=new_product') . '" 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_CATEGORIES, 'cPath=' . $category_path_string . '&pID=' . $pInfo->products_id . '&action=delete_product') . '" 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_CATEGORIES, 'cPath=' . $category_path_string . '&pID=' . $pInfo->products_id . '&action=move_product') . '" 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_CATEGORIES, 'cPath=' . $category_path_string . '&pID=' . $pInfo->products_id . '&action=copy_to') . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_COPY_TO . ' "><span>' . BUTTON_TEXT_COPY_TO . '</span></a><a href="' . xos_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'cPath=' . $category_path_string . '&pID=' . $pInfo->products_id) . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_PRODUCTS_ATTRIBUTES . ' "><span>' . BUTTON_TEXT_PRODUCTS_ATTRIBUTES . '</span></a>');
     $contents[] = array('text' => '<br />' . TEXT_DATE_ADDED . ' ' . xos_date_short($pInfo->products_date_added));
     if (xos_not_null($pInfo->products_last_modified)) {
         $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . xos_date_short($pInfo->products_last_modified));
     }
     if (date('Y-m-d') < $pInfo->products_date_available) {
         $contents[] = array('text' => TEXT_DATE_AVAILABLE . ' ' . xos_date_short($pInfo->products_date_available));
     }
Example #2
0
function xos_get_generated_category_path_ids($id, $from = 'category')
{
    $calculated_category_path_string = '';
    $calculated_category_path = xos_generate_category_path($id, $from);
    for ($i = 0, $n = sizeof($calculated_category_path); $i < $n; $i++) {
        for ($j = 0, $k = sizeof($calculated_category_path[$i]); $j < $k; $j++) {
            $calculated_category_path_string .= $calculated_category_path[$i][$j]['id'] . '_';
        }
        $calculated_category_path_string = substr($calculated_category_path_string, 0, -1) . '<br />';
    }
    $calculated_category_path_string = substr($calculated_category_path_string, 0, -6);
    if (strlen($calculated_category_path_string) < 1) {
        $calculated_category_path_string = TEXT_TOP;
    }
    return $calculated_category_path_string;
}
         for ($i = 0, $n = sizeof($cat_path[0]); $i < $n; $i++) {
             $cPath .= $cat_path[0][$i]['id'] . '_';
         }
         $cPath = substr($cPath, 0, -1);
     }
     if ((!isset($_GET['pID']) && !isset($_GET['cpID']) || isset($_GET['pID']) && $_GET['pID'] == $products['products_id']) && !isset($pInfo) && !isset($cInfo) && substr($action, 0, 3) != 'new') {
         // find out the rating average from customer reviews
         $reviews_query = xos_db_query("select (avg(reviews_rating) / 5 * 100) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . (int) $products['products_id'] . "'");
         $reviews = xos_db_fetch_array($reviews_query);
         $pInfo_array = array_merge((array) $products, (array) $reviews);
         $pInfo = new objectInfo($pInfo_array);
     }
     $products_array[] = array('selected' => isset($pInfo) && is_object($pInfo) && $products['products_id'] == $pInfo->products_id ? true : false, 'status' => $products['products_status'] == '1' ? true : false, 'name' => $products['products_name'], 'sort_order' => $products['products_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&flag=0&pID=' . $products['products_id'] . '&cPath=' . $cPath), 'link_filename_categories_flag_1' => xos_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=1&pID=' . $products['products_id'] . '&cPath=' . $cPath), 'link_filename_categories_action_product_preview' => xos_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id'] . '&action=product_preview&read=only'), 'link_filename_categories_cpath_cpath_pid' => xos_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id']));
 }
 $cPath_back = '';
 $category_path = xos_generate_category_path($current_category_id);
 for ($i = sizeof($category_path[0]) - 1; $i > 0; $i--) {
     $current_category_id != $category_path[0][$i]['id'] ? $cPath_back .= $category_path[0][$i]['id'] . '_' : '';
 }
 $cPath_back = substr($cPath_back, 0, -1);
 $cPath_back = xos_not_null($cPath_back) ? 'cPath=' . $cPath_back . '&' : '';
 if (isset($_GET['search'])) {
     $smarty->assign('link_filename_categories_back', xos_href_link(FILENAME_CATEGORIES));
 } elseif ($current_category_id > 0) {
     $smarty->assign('link_filename_categories_back', xos_href_link(FILENAME_CATEGORIES, $cPath_back . 'cpID=' . $current_category_id));
 }
 if (!isset($_GET['search'])) {
     $smarty->assign(array('link_filename_categories_action_new_category' => xos_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_category'), 'link_filename_categories_action_new_product' => xos_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_product')));
 }
 if (SESSID) {
     $smarty->assign('hidden_field_session', xos_draw_hidden_field(xos_session_name(), xos_session_id()));