Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2007
    Posts
    104
    Plugin Contributions
    0

    Default Make New Products Cateogory Top of List

    Right now I have my new products link in my list of categories. It's at the bottom of the category list. How do I move it to the top of the list?

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Make New Products Cateogory Top of List

    You can edit /includes/templates/your_template/sideboxes/tpl_categories.php, and move the code that displays the new listing to above the loop that displays the categories.

    This will require some care, because tpl_categories is not laid out like tpl_header.php with nice comments marking off the beginning and end of each section, but find this:
    PHP Code:
        if (SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true') {
          
    // display limits
    //      $display_limit = zen_get_products_new_timelimit();
          
    $display_limit zen_get_new_date_range();

          
    $show_this $db->Execute("select p.products_id
                                     from " 
    TABLE_PRODUCTS " p
                                     where p.products_status = 1 " 
    $display_limit " limit 1");
          if (
    $show_this->RecordCount() > 0) {
            
    $content .= '<a class="category-links" href="' zen_href_link(FILENAME_PRODUCTS_NEW) . '">' CATEGORIES_BOX_HEADING_WHATS_NEW '</a>' '<br />' "\n";
          }
        } 
    and move it to just above this
    PHP Code:
    for ($i=0;$i<sizeof($box_categories_array);$i++) {
        switch(
    true) {
    // to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
    // uncomment the select below and set the cPath=3 to the cPath= your_categories_id 

  3. #3
    Join Date
    Feb 2007
    Posts
    104
    Plugin Contributions
    0

    Default Re: Make New Products Cateogory Top of List

    Thanks Glen for your help. My document has been altered and is different. Could you tell me where to move the text to? Here's what I have:

    <?php
    /**
    * Side Box Template
    *
    * @package templateSystem
    * @copyright Copyright 2003-2006 Zen Cart Development Team
    * @copyright Portions Copyright 2003 osCommerce
    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    * @version $Id: tpl_categories.php 4162 2006-08-17 03:55:02Z ajeh $
    */
    $content = "";
    $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
    for ($i=0;$i<sizeof($box_categories_array);$i++) {
    // Begin stockFilter code
    if (($_SESSION['stockFilter'] == 'in_stock') && ((!$stock_filter_excluded) || ($stock_filter_unfilter_sideboxes != true))) {
    $myCheck = true;
    list($mycrap, $mycpath)= split('=', $box_categories_array[$i]['path']);
    $mycid = split('_', $mycpath);
    $category_id = array_pop($mycid);
    $cat_count = zen_count_products_in_category_stockFilter($category_id);
    }
    if (($myCheck != true) || (($cat_count > 0) && ($myCheck == true))) {
    // End stockFilter code
    switch(true) {
    // to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
    // uncomment the select below and set the cPath=3 to the cPath= your_categories_id
    // many variations of this can be done
    // case ($box_categories_array[$i]['path'] == 'cPath=3'):
    // $new_style = 'category-holiday';
    // break;
    case ($box_categories_array[$i]['top'] == 'true'):
    $new_style = 'category-top';
    break;
    case ($box_categories_array[$i]['has_sub_cat']):
    $new_style = 'category-subs';
    break;
    default:
    $new_style = 'category-products';
    }
    if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
    // skip if this is for the document box (==3)
    } else {
    $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';

    if ($box_categories_array[$i]['current']) {
    if ($box_categories_array[$i]['has_sub_cat']) {
    $content .= '<span class="category-subs-parent">' . $box_categories_array[$i]['name'] . '</span>';
    } else {
    $content .= '<span class="category-subs-selected">' . $box_categories_array[$i]['name'] . '</span>';
    }
    } else {
    $content .= $box_categories_array[$i]['name'];
    }

    if ($box_categories_array[$i]['has_sub_cat']) {
    $content .= CATEGORIES_SEPARATOR;
    }
    $content .= '</a>';

    if (SHOW_COUNTS == 'true') {
    if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
    $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
    }
    }

    $content .= '<br />' . "\n";
    }
    }
    } // stockFilter code
    if (SHOW_CATEGORIES_BOX_SPECIALS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true' or SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
    // display a separator between categories and links
    if (SHOW_CATEGORIES_SEPARATOR_LINK == '1') {
    $content .= '<hr id="catBoxDivider" />' . "\n";
    }
    if (SHOW_CATEGORIES_BOX_SPECIALS == 'true') {
    $show_this = $db->Execute("select s.products_id from " . TABLE_SPECIALS . " s where s.status= 1 limit 1");
    if ($show_this->RecordCount() > 0) {
    $content .= '<a class="category-top" href="' . zen_href_link(FILENAME_SPECIALS) . '">' . CATEGORIES_BOX_HEADING_SPECIALS . '</a>' . '<br />' . "\n";
    }
    }
    if (SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true') {
    // display limits
    // $display_limit = zen_get_products_new_timelimit();
    $display_limit = zen_get_new_date_range();
    $show_this = $db->Execute("select p.products_id
    from " . TABLE_PRODUCTS . " p
    where p.products_status = 1 " . $display_limit . " limit 1");
    if ($show_this->RecordCount() > 0) {
    $content .= '<a class="category-top" href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . CATEGORIES_BOX_HEADING_WHATS_NEW . '</a>' . '<br />' . "\n";
    }
    }
    if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') {
    $show_this = $db->Execute("select products_id from " . TABLE_FEATURED . " where status= 1 limit 1");
    if ($show_this->RecordCount() > 0) {
    $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a>' . '<br />' . "\n";
    }
    }
    if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
    $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a>' . "\n";
    }
    }
    $content .= '</div>';
    ?>

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Make New Products Cateogory Top of List

    The alterations don't matter in this case.

    Put the new products code just above

    for ($i=0;$i<sizeof($box_categories_array);$i++) {

    as described previously.

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Make New Products Cateogory Top of List

    Oops, double post...

 

 

Similar Threads

  1. How to make Specials Category display at top of list?
    By nathanscrivener in forum Setting Up Specials and SaleMaker
    Replies: 3
    Last Post: 31 Oct 2010, 06:52 AM
  2. Moving Featured Products, New Products, etc to the top of category list
    By AirsoftOutfitter in forum Templates, Stylesheets, Page Layout
    Replies: 13
    Last Post: 10 Sep 2010, 10:21 AM
  3. Replies: 0
    Last Post: 5 Aug 2010, 07:19 AM
  4. make category product list look like new product list
    By loosefast in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 8 Jun 2007, 09:03 PM
  5. How do I make new prod display same as List?
    By ikoiko in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 18 Feb 2007, 12:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg