Forums / General Questions / preventing category, and products display in new box

preventing category, and products display in new box

Views: 1,157

Results 1 to 14 of 14
25 May 2012, 5:16 PM
#1
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

preventing category, and products display in new box

Hi,

is it possible to prevent a specific category, and its products from displaying in the "new products" box?
If yes how can it be done?

On a side note would it be advisable as per SEO?

Thank you

26 May 2012, 1:43 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: preventing category, and products display in new box

You could block them based on the master_categories_id by using your templates and overrides and customizing:
/includes/modules/new_products.php

to the file:
/includes/modules/your_templates_directory/new_products.php

And add to the 2 SELECT statements something like, for example to block categories_id 10, us:

and p.master_categories_id != 10

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!

26 May 2012, 5:37 PM
#3
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: preventing category, and products display in new box

Thank you.

If you don't mind I would need a little (lot) more info, not being a coder.

I put the snip you suggested like this

select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, pd.products_description,
                                p.products_date_added, p.products_price, p.products_type, p.master_categories_id and p.master_categories_id != 66

But it does display the product inserted in that category (id 66), both in the new products box, and in the new products listing page.

Will you kindly tell me how exactly I should add your code?

26 May 2012, 5:39 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: preventing category, and products display in new box

In the first SELECT, to block master_categories_id 10 try using:

  $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
[B]and p.master_categories_id != 10[/B]
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                           and   p.products_status = 1 " . $display_limit;

Then do the same in the other SELECT statement in that file ...

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!

26 May 2012, 6:15 PM
#5
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: preventing category, and products display in new box

Thank you again.

I copy-pasted the code you posted, but it still displays the new product.

A bit confused on the != 10 is that the category's id number, or it has to be 10?
I tried both, 10 as per your code, and 66 as the category id of the store.

26 May 2012, 6:18 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: preventing category, and products display in new box

If your Category is categories_id 66 and your Products use that as their master_categories_id then you want to use:

and p.master_categories_id != [B]66[/B]

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!

26 May 2012, 6:33 PM
#7
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: preventing category, and products display in new box

Thank you for your patience.

I added
and p.master_categories_id != 66
to
modules/pages/products_new/header_php.php
as well, and it works fine.

26 May 2012, 6:33 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: preventing category, and products display in new box

Thanks for the update that this is now working for you ... :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!

27 May 2012, 10:52 AM
#9
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: preventing category, and products display in new box

I need an update of the code please.

I added sub-cats to the category with id 66, and noticed they do display, then I added

and p.master_categories_id != 66
and p.master_categories_id != 67
and p.master_categories_id != 68

to /includes/modules/your_templates_directory/new_products.php
and it works fine.

Question:
is that correct way of doing, or there is a group syntax I'm unaware of, i.e.

and p.master_categories_id != '66 67 68'?

Actually I tried that, and other "creative" combinations, but of course knowing nothing they returned errors.

Thank you

27 May 2012, 1:55 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: preventing category, and products display in new box

You need to be using the master_categories_id of the Products that you do not want to display ...

So if they are in a Category with categories_id 66 then a subcategory where the categories_id is 68, the the master_categories_id is most likely 68 ...

If you are unsure of the master_categories_id ... edit the Product and you will see:
Product Master Category:

and that will list the master_categories_id

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!

27 May 2012, 2:28 PM
#11
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: preventing category, and products display in new box

Thank you.

Yes I understand that, the situation is I have more than one category to prevent displaying.

Cat-1 id 66
subcat-11 id 67
subcat-12 id 68
subcat-13 id 69

I need to block all of them (67, 68, 69)
I used

and p.master_categories_id != 66
and p.master_categories_id != 67
and p.master_categories_id != 68

and it works fine, I am wondering if there was a different way of using the php code, instead of repeating

and p.master_categories_id !=

as many times as the categories I need to block, using that statement only once, and grouping the id numbers.

27 May 2012, 2:43 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: preventing category, and products display in new box

Try instead on the two SELECT statements, where 10, 12 and 15 are 3 master_categories_id not to show:

and master_categories_id NOT IN (10,12,15)

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!

27 May 2012, 2:58 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: preventing category, and products display in new box

You are most welcome, glad that this is working for you now ... :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!