Page 1 of 2 12 LastLast
Results 1 to 10 of 34

Hybrid View

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

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

    Are they all in the same category?

    If so, you could set the best sellers to not select products where the master_categories_id is that category ...
    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. #2
    Join Date
    Apr 2007
    Posts
    4
    Plugin Contributions
    0

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

    Hi, yes they are all in a category of their own! So I assume I'd make a change very like whats detailed above? PLease could you spoonfeed me the code? Sorry to ask all this of you but I'm a moron at programming stuff!

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

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

    Let's say you want to toss out all products in categories_id 42 ...

    That would now use the master_categories_id 42 in the products table so you should be able to use:
    PHP Code:
    $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.master_categories_id != 42
                                 order by p.products_ordered desc, pd.products_name
                                 limit " 
    MAX_DISPLAY_BESTSELLERS
    Note: this assumes all products that should not display use the same Category and that Category is "owns" these Products which would reflect that in that the master_categories_id of all of these Products would be the same ...

    In this example:
    PHP Code:
                                 and p.master_categories_id != 42 
    this is the key to the block ...
    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!

  4. #4
    Join Date
    Apr 2007
    Posts
    4
    Plugin Contributions
    0

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

    THANK YOU SO MUCH!!!! That's exactly what i needed!

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

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

    Glad that this code worked for you ... thanks for the update!
    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!

  6. #6

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

    Is there a way to exclude certain product categories from the 'All Products' list?

    I noticed this on this thread:

    and p.master_categories_id != 42

    which would work perfectly if I could figure out how to apply it to all products instead of best sellers...

    Thanks for the help!!! :)

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

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

    The SELECT statement for All Products is in the:
    /includes/modules/pages/products_all/header_php.php

    You can customize it in there ...

    NOTE: this is not an override file so be sure to save both the original and your changes ...
    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!

  8. #8
    Join Date
    Feb 2009
    Location
    Melbourne, Australia
    Posts
    85
    Plugin Contributions
    0

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

    Quote Originally Posted by Ajeh View Post
    Let's say you want to toss out all products in categories_id 42 ...

    That would now use the master_categories_id 42 in the products table so you should be able to use:
    PHP Code:
    $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.master_categories_id != 42
                                 order by p.products_ordered desc, pd.products_name
                                 limit " 
    MAX_DISPLAY_BESTSELLERS
    Note: this assumes all products that should not display use the same Category and that Category is "owns" these Products which would reflect that in that the master_categories_id of all of these Products would be the same ...

    In this example:
    PHP Code:
                                 and p.master_categories_id != 42 
    this is the key to the block ...
    Hiya, i was wondering if it is possible to exclude certain products for the bestsellers list? there is 10 of them and they are in different catagories. They where givin as freebies for 3 days before going up for sale and so there for they have taken up all the space on the bestsellers box

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

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

    Let's say you didn't want products_id 199 and 26 to show in the Best sellers sidebox ...

    You could customize the best_sellers.php sidebox module with something like:
    Code:
        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 (199, 26)" . "
    
                                 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 (199, 26)" . "
    
                                 order by p.products_ordered desc, pd.products_name
                                 limit " . MAX_DISPLAY_BESTSELLERS;
    
          $best_sellers = $db->Execute($best_sellers_query);
        }
    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!

  10. #10
    Join Date
    Feb 2009
    Location
    Melbourne, Australia
    Posts
    85
    Plugin Contributions
    0

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

    Thank you so much for the reply, i will give it a go and post back with a result xoxo

 

 
Page 1 of 2 12 LastLast

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