Results 1 to 10 of 19

Threaded View

  1. #1
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Customised Specials_Index.php - want to Remove the Randomize Feature

    I'm hoping someone can help me with this. Way back when we created the www.silkblooms.co.uk website about 18mnths ago (or more) we wanted the "special_index" files to appear in a completely random order. Our thinking was that this would make the home page appear to Google as a constantly changing page with new items appearing there all the time. I'm not sure if that helped our SEO ratings but we're doing well in that respect. We also thought it'd be nice for customers landing on the home page to see a range of random produts.

    Now, we just want to put the specials_index back to the way it should be. However, we can't just copy the original file over as there have been too many customisations to this file and we don't want to lose them all. We simply want to remove the random feature and make the products appear in the order from new-old.

    Here is a copy of the coding. Can anyone help me replace whatever is causing the products to 'randomize' with a new code that makes them apear in date listed order from new to old?



    PHP Code:
    <?php
    /**
     * specials_index 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: specials_index.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 '';
    $specials_index_query '';
    $display_limit '';

    $where_str " AND p.master_categories_id != 349 ";
    $where_str .= " AND p.master_categories_id != 350 ";

    // m.manufacturers_name     m.manufacturers_id     p.products_quantity     p.products_model     p.manufacturers_id     p.master_categories_id     ".TABLE_MANUFACTURERS . " m

    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') ) {
      
    $specials_index_query "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, p.products_quantity,
                               p.products_date_added, p.products_price, p.products_type,  p.products_model,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 " 
    $where_str $display_limit;
    } 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
        
    $specials_index_query "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id,  p.products_model, p.products_quantity
                                 from (" 
    TABLE_PRODUCTS " p
                                 left join " 
    TABLE_SPECIALS " s on p.products_id = s.products_id
                                 left join " 
    TABLE_PRODUCTS_DESCRIPTION " pd on p.products_id = pd.products_id )
                                 where p.products_id = s.products_id
                                 and p.products_id = pd.products_id
                                 and p.products_status = '1' and s.status = '1'
                                 and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "' 
                                 and p.products_id in (" 
    $list_of_products ")" $where_str
      }
    }
    if (
    $specials_index_query != ''$specials_index $db->ExecuteRandomMulti($specials_index_queryMAX_DISPLAY_SPECIAL_PRODUCTS_INDEX);

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

    $num_products_count = ($specials_index_query == '') ? $specials_index->RecordCount();

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

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


        
    $soldoutimage = ($specials_index->fields['products_quantity'] > 0) ? '' '<div class="sold_out_on_image"><a href="'
         
    zen_href_link(zen_get_info_page($specials_index->fields['products_id']), 'cPath=' $productsInCategory[$specials_index->fields['products_id']] . '&products_id='
         
    $specials_index->fields['products_id'])
         . 
    '"><img src="http://www.silkblooms.co.uk/includes/templates/freetemplate2/images/sold_out_mine.png" style="position:relative;top:30px;left:7px;border:0;"></a></div>';  


        
    $specials_index->fields['products_name'] = zen_get_products_name($specials_index->fields['products_id']);
        
    $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsSpecials centeredContent back"' ' ' 'style="width:' $col_width '%;"',

        
    'text' => (($specials_index->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' '<a href="' zen_href_link(zen_get_info_page($specials_index->fields['products_id']), 'cPath=' $productsInCategory[$specials_index->fields['products_id']] . '&products_id=' $specials_index->fields['products_id']) . '">' zen_image(DIR_WS_IMAGES $specials_index->fields['products_image'], $specials_index->fields['products_name'], SMALL_IMAGE_WIDTHSMALL_IMAGE_HEIGHT) . '</a><br />'.$soldoutimage) . '<a href="' zen_href_link(zen_get_info_page($specials_index->fields['products_id']), 'cPath=' $productsInCategory[$specials_index->fields['products_id']] . '&products_id=' $specials_index->fields['products_id']) . '">''</a>' .$specials_index->fields['manufacturers_name'] . $manufacturers_name.''$specials_index->fields['products_model'] .$products_model .'<br />' .$products_price.'<br /><p>' );

        
    $col ++;
        if (
    $col > (SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS 1)) {
          
    $col 0;
          
    $row ++;
        }
        
    $specials_index->MoveNextRandom();
      }

      if (
    $specials_index->RecordCount() > 0) {
        
    $title '<h2 class="centerBoxHeading">' sprintf(TABLE_HEADING_SPECIALS_INDEXstrftime('%B')) . '</h2>';
        
    $zc_show_specials true;
      }
    }
    ?>
    Last edited by limelites; 13 Jul 2012 at 11:02 AM.

 

 

Similar Threads

  1. v154 How Do I Randomize The Reviews?
    By DK_Scully in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 30 Apr 2015, 01:20 PM
  2. search_header.php - Want it in header / remove from side column
    By DeeLite808 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 17 Nov 2009, 07:36 AM
  3. Customised checkout_shipping.php now comes up as blank page?!
    By horrorvision in forum General Questions
    Replies: 2
    Last Post: 30 Jun 2009, 03:09 PM
  4. i want to remove the 'categories' title on the multi product listing page
    By what44 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 2 Nov 2007, 08:25 PM
  5. I want to remove the reviews option from the main page?
    By nagmier in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 20 Aug 2007, 07:33 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