Forums / Basic Configuration / Excluding a product or category from best selling list

Excluding a product or category from best selling list

Locked

Views: 11,576

Results 1 to 20 of 34
This thread is locked. New replies are disabled.
14 Feb 2007, 4:06 PM
#1
moncia avatar

moncia

New Zenner

Join Date:
Nov 2006
Posts:
57
Plugin Contributions:
0

Excluding a product or category from best selling list

Can that be done?

I am having som free products in my store, and off course - those are the most downloaded products. So I would like to exclude these from the list of most selling items. Is that possible.

Also - how do I make the newest item show up first in the list when choosing a single manufacturer?

14 Feb 2007, 4:13 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Excluding a product or category from best selling list

If the products are marked as Product is Free YES

Then you could customize the sidebox to not include products where product_is_free = 1

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!

14 Feb 2007, 5:34 PM
#3
moncia avatar

moncia

New Zenner

Join Date:
Nov 2006
Posts:
57
Plugin Contributions:
0

Re: Excluding a product or category from best selling list

Ajeh:

If the products are marked as Product is Free YES

Then you could customize the sidebox to not include products where product_is_free = 1

Ok - and where do I do this? Sory about my stupiduty :no:

14 Feb 2007, 5:38 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Excluding a product or category from best selling list

If I was me ... but I'm not ... I'd peek in the directories:
/includes/modules/sideboxes
/includes/templates/template_default/sideboxes

Copy the bestsellers to my own templates and override directories:
/includes/modules/sideboxes/your_template_dir
/includes/templates/your_template_dir/sideboxes

And then alter the SELECT statements to work the way I need them too ... :smile:

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!

15 Feb 2007, 11:32 AM
#5
moncia avatar

moncia

New Zenner

Join Date:
Nov 2006
Posts:
57
Plugin Contributions:
0

Re: Excluding a product or category from best selling list

Sorry - but I'm way more stupid than that.

I have downloded the two files but what do I do next.

Feel free to talk to me as if I was a child.... :yuck:

15 Feb 2007, 2:52 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Excluding a product or category from best selling list

After you copy the file:
/includes/modules/sideboxes/best_sellers.php

to your templates and overrides directory:
/includes/modules/sideboxes/your_template_dir/best_sellers.php

Change the 2 select statements to include:

      $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.product_is_free != 1
                             order by p.products_ordered desc, pd.products_name
                             limit " . MAX_DISPLAY_BESTSELLERS;
      $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.product_is_free != 1
                             order by p.products_ordered desc, pd.products_name
                             limit " . MAX_DISPLAY_BESTSELLERS;

NOTE: this assumes that your Free Products are Marked:
Product is Free: YES

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!

1 Apr 2007, 6:27 AM
#7
anitalanter avatar

anitalanter

New Zenner

Join Date:
Apr 2007
Posts:
4
Plugin Contributions:
0

Re: Excluding a product or category from best selling list

Is it possible to do this if the product is not free??????? PLease help - this is exactly what I need and I havent a clue how.

1 Apr 2007, 2:03 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Excluding a product or category from best selling list

Could you expand on what it is you want to exclude if you are not trying to exclude the Free Product?

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 Apr 2007, 4:51 AM
#9
anitalanter avatar

anitalanter

New Zenner

Join Date:
Apr 2007
Posts:
4
Plugin Contributions:
0

Re: Excluding a product or category from best selling list

Hi, its a collection of sticker-type decals that we are helping distribute for a local charity. Because they're just $1 people tend to order several of them at once, which means that these items (they're in a category of their own) would dominate the bestseller list or take it up alltogether, and since its not a product of our own my boss wants me to find a way to prevent them showing up there. :blush:

2 Apr 2007, 5:05 AM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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!

3 Apr 2007, 7:07 AM
#11
anitalanter avatar

anitalanter

New Zenner

Join Date:
Apr 2007
Posts:
4
Plugin Contributions:
0

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! :cry:

3 Apr 2007, 1:08 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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:

$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:

                             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 Apr 2007, 8:05 AM
#13
anitalanter avatar

anitalanter

New Zenner

Join Date:
Apr 2007
Posts:
4
Plugin Contributions:
0

Re: Excluding a product or category from best selling list

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

7 Apr 2007, 4:20 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Excluding a product or category from best selling list

Glad that this code worked for you ... thanks for the update! :smile:

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!

9 Nov 2007, 3:30 AM
#15
srturner47 avatar

srturner47

Zen Follower

Join Date:
Oct 2007
Posts:
385
Plugin Contributions:
0

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!!! :)

9 Nov 2007, 4:50 AM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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 ... :smile:

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!

9 Nov 2007, 8:48 AM
#17
srturner47 avatar

srturner47

Zen Follower

Join Date:
Oct 2007
Posts:
385
Plugin Contributions:
0

Re: Excluding a product or category from best selling list

Thanks so much! That worked like a charm! :)

1 Jan 2009, 12:56 PM
#18
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Excluding a product or category from best selling list

I would like to exclude my Sold Gallery category from displaying in Featured Products. in featured_products.php would I just add:

and p.master_categories_id != 8

to get:

if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) {

  $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id

                           from (" . TABLE_PRODUCTS . " p

                           left join " . TABLE_FEATURED . " f on p.products_id = f.products_id

                           left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )

                           where p.products_id = f.products_id

                           and p.products_id = pd.products_id

                           and p.products_status = 1 and f.status = 1

                           and p.master_categories_id != 8
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";

:blink: Thanks!

4 Jan 2009, 3:10 PM
#19
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Excluding a product or category from best selling list

There was an easy fix to address my issue in this thread. I was able to stop all sold items from appearing in New Products.

6 Jan 2009, 8:02 AM
#20
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Excluding a product or category from best selling list

Info from the previously mentioned thread allowed me to block items with a 0 product count. To block entire categories from displaying in New Products, see this thread.