Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23
  1. #21
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: New Product Box Sort Order

    The line with all the ######### is causing the error ... comments are done with two forward slashes // in php not the # sign ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  2. #22
    Join Date
    Sep 2010
    Posts
    111
    Plugin Contributions
    0

    Default Re: New Product Box Sort Order

    You- Are A LIFESAVER digidiva kathy!!! This solved all my problems with the random sort order- GOD BLESS YOU!!! Oh my goodness!! Been at this ALL DAY--- and it was here- in your post..

    Great work!! Thank you - thank you- and oh thank you!!!!

  3. #23
    Join Date
    Mar 2011
    Posts
    6
    Plugin Contributions
    0

    Default Re: New Product Box Sort Order

    Quote Originally Posted by digidiva-kathy View Post
    Okay, so this would be the code, then?

    PHP Code:
    <?php
    /**
     * new_products.php module
     *
     * @package modules
     * @copyright Copyright 2003-2007 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: new_products.php 6424 2007-05-31 05:59:21Z ajeh $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die(
    'Illegal Access');
    }

    // initialize vars
    $categories_products_id_list '';
    $list_of_products '';
    $new_products_query '';

    $display_limit zen_get_new_date_range();

    if ( ((
    $manufacturers_id && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) {
      
    $new_products_query "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
                                    p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                               from " 
    TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd
                               where p.products_id = pd.products_id
                               and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'
                               and   p.products_status = 1 " 
    $display_limit;
                                
    $new_products_query .= " ORDER BY products_date_added DESC
                            LIMIT " 
    MAX_DISPLAY_NEW_PRODUCTS;
    } else {
      
    // get all products and cPaths in this subcat tree
      
    $productsInCategory zen_get_categories_products_list( (($manufacturers_id && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), falsetrue0$display_limit);

      if (
    is_array($productsInCategory) && sizeof($productsInCategory) > 0) {
        
    // build products-list string to insert into SQL query
        
    foreach($productsInCategory as $key => $value) {
          
    $list_of_products .= $key ', ';
        }
        
    $list_of_products substr($list_of_products0, -2); // remove trailing comma

        
    $new_products_query "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
                                      p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                               from " 
    TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd
                               where p.products_id = pd.products_id
                               and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'
                               and p.products_id in (" 
    $list_of_products ")";
                               
                               
    $new_products_query .= " ORDER BY products_date_added DESC
                            LIMIT " 
    MAX_DISPLAY_NEW_PRODUCTS;
      }
    }


    if (
    $new_products_query != ''$new_products $db->Execute($new_products_query);

    $row 0;
    $col 0;
    $list_box_contents = array();
    $title '';

    $num_products_count = ($new_products_query == '') ? $new_products->RecordCount();

    // show only when 1 or more
    if ($num_products_count 0) {
      if (
    $num_products_count SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS == ) {
        
    $col_width floor(100/$num_products_count);
      } else {
        
    $col_width floor(100/SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS);
      }

      while (!
    $new_products->EOF) {
        
    $products_price zen_get_products_display_price($new_products->fields['products_id']);
        if (!isset(
    $productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']);

        
    $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' ' ' 'style="width:' $col_width '%;"',
        
    'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' '<a href="' zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' $productsInCategory[$new_products->fields['products_id']] . '&products_id=' $new_products->fields['products_id']) . '">' zen_image(DIR_WS_IMAGES $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTHIMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . '<a href="' zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' $productsInCategory[$new_products->fields['products_id']] . '&products_id=' $new_products->fields['products_id']) . '">' $new_products->fields['products_name'] . '</a><br />' $products_price);

        
    $col ++;
        if (
    $col > (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS 1)) {
          
    $col 0;
          
    $row ++;
        }
        
    $new_products->MoveNext();
      }

      if (
    $new_products->RecordCount() > 0) {
        if (isset(
    $new_products_category_id) && $new_products_category_id != 0) {
          
    $category_title zen_get_categories_name((int)$new_products_category_id);
          
    $title '<h2 class="centerBoxHeading">' sprintf(TABLE_HEADING_NEW_PRODUCTSstrftime('%B')) . ($category_title != '' ' - ' $category_title '' ) . '</h2>';
        } else {
          
    $title '<h2 class="centerBoxHeading">' sprintf(TABLE_HEADING_NEW_PRODUCTSstrftime('%B')) . '</h2>';
        }
        
    $zc_show_new_products true;
      }
    }
    ?>
    It seems to have corrected the problem and all looks okay. Thought I'd come back and repost it so someone else didn't have the same problem. If you'd like to edit my previous post with the code, it might save someone the same error :) .

    Thanks!!
    I tried to use this solution and it worked on the top page!!
    I show new products on each categories too and it seems like they show products which status is out of stock.
    (original new_products.php file doesn't show them)
    Does anyone can fix this??

    Thank you so much!!

    Rie

 

 
Page 3 of 3 FirstFirst 123

Similar Threads

  1. v139h Product sort order on New Products Page not working
    By jmsnyder23 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 4 Aug 2014, 02:34 PM
  2. v151 Product Sort within Category - having problems changing the default sort order
    By Don Wagner in forum Customization from the Admin
    Replies: 4
    Last Post: 21 Oct 2012, 03:03 AM
  3. Change sort order in new products box on index.php page
    By jolewin in forum Customization from the Admin
    Replies: 2
    Last Post: 28 Mar 2011, 05:11 AM
  4. New Products Center Box Sort Order
    By jordandsa in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 24 Sep 2009, 07:19 PM
  5. Specials Box - sort order
    By skype55 in forum Setting Up Specials and SaleMaker
    Replies: 1
    Last Post: 24 Feb 2008, 03:47 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