Results 1 to 10 of 34

Hybrid View

  1. #1
    Join Date
    May 2007
    Location
    Los Angeles
    Posts
    89
    Plugin Contributions
    0

    Default Re: Excluding a product or category from best selling list

    Ajeh,
    I have uploaded it to the correct folder and made the changes in two section. Below is the complete code. Could it because the categories are under a hidden category? The categories are setup like this:
    Categories / Products - Top > Brand Names (HIDDEN) > Categories (52, 43)

    Thanks a lot!


    Code:
    <?php
    /**
     * best_sellers sidebox - displays selected number of (usu top ten) best selling products
     *
     * @package templateSystem
     * @copyright Copyright 2003-2005 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: best_sellers.php 2718 2005-12-28 06:42:39Z drbyte $
     */
    
    // test if box should display
      $show_best_sellers= false;
    
      if (isset($_GET['products_id'])) {
        if (isset($_SESSION['customer_id'])) {
          $check_query = "select count(*) as count
                          from " . TABLE_CUSTOMERS_INFO . "
                          where customers_info_id = '" . (int)$_SESSION['customer_id'] . "'
                          and global_product_notifications = '1'";
    
          $check = $db->Execute($check_query);
    
          if ($check->fields['count'] > 0) {
            $show_best_sellers= true;
          }
        }
      } else {
        $show_best_sellers= true;
      }
    
      if ($show_best_sellers == true) {
        if (isset($current_category_id) && ($current_category_id > 0)) {
          $best_sellers_query = "select distinct p.products_id, pd.products_name, p.products_ordered
                                 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
                                        . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c
                                 where (p.products_status = '1'
                                 and p.products_ordered > 0
                                 and p.products_id = pd.products_id
                                 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                                 and p.products_id = p2c.products_id
                                 and p2c.categories_id = c.categories_id
                                 and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id))
    and p.products_id not in (52, 43)" . "
    
                                 order by p.products_ordered desc, pd.products_name
                                 limit " . MAX_DISPLAY_BESTSELLERS;
    
          $best_sellers = $db->Execute($best_sellers_query);
    
        } else {
          $best_sellers_query = "select distinct p.products_id, pd.products_name, p.products_ordered
                                 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                                 where (p.products_status = '1'
                                 and p.products_ordered > 0
                                 and p.products_id = pd.products_id
                                 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "')
    and p.products_id not in (52, 43)" . "
    
                                 order by p.products_ordered desc, pd.products_name
                                 limit " . MAX_DISPLAY_BESTSELLERS;
    
          $best_sellers = $db->Execute($best_sellers_query);
        }
    
        if ($best_sellers->RecordCount() >= MIN_DISPLAY_BESTSELLERS) {
          $title =  BOX_HEADING_BESTSELLERS;
          $box_id =  'bestsellers';
          $rows = 0;
          while (!$best_sellers->EOF) {
            $rows++;
            $bestsellers_list[$rows]['id'] = $best_sellers->fields['products_id'];
            $bestsellers_list[$rows]['name']  = $best_sellers->fields['products_name'];
            $best_sellers->MoveNext();
          }
    
          $title_link = false;
          require($template->get_template_dir('tpl_best_sellers.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_best_sellers.php');
          $title =  BOX_HEADING_BESTSELLERS;
          require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
        }
      }
    ?>

  2. #2
    Join Date
    May 2007
    Location
    Los Angeles
    Posts
    89
    Plugin Contributions
    0

    Default Re: Excluding a product or category from best selling list

    Ajeh,
    Never mind! The template file apparently wasn't uploaded completely. I re-uploaded the tpl_best_sellers.php to custom folder and is working like a charm!

    Thank you so much!

  3. #3
    Join Date
    May 2007
    Location
    Los Angeles
    Posts
    89
    Plugin Contributions
    0

    Default Re: Excluding a product or category from best selling list

    Ajeh,
    Sorry, I spoke too soon. The products that I don't want, they show sometime depending on the category clicked on the website. But they are still there.

    thanks!

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Excluding a product or category from best selling list

    So far, I cannot reproduce this issue ...
    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!

  5. #5
    Join Date
    Feb 2009
    Posts
    895
    Plugin Contributions
    0

    Default Re: Excluding a product or category from best selling list

    Thanks to the OP and the help of those who replied, i got this done on my store too (never thought it was feasible so i never asked!).

 

 

Similar Threads

  1. Excluding free items from Best Sellers
    By meljen in forum Customization from the Admin
    Replies: 3
    Last Post: 29 Nov 2012, 03:57 AM
  2. Best selling list for a defines period - is it possible?
    By CaroleAs in forum Basic Configuration
    Replies: 9
    Last Post: 21 Nov 2010, 11:19 PM
  3. Excluding category from search
    By kgeoffrey in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 13 Jan 2009, 12:46 AM
  4. Excluding sideboxes from product list pages
    By ctcentralinfo in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 11 Jul 2008, 12:56 AM
  5. excluding categories from bestseller list
    By CreativeWitch in forum General Questions
    Replies: 0
    Last Post: 21 Feb 2007, 05:41 PM

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