Zen Cart Logo
Forums / Basic Configuration / Exclude category from also purchased?

Exclude category from also purchased?

Views: 5,155

Results 21 to 36 of 36
5 Jun 2012, 6:13 PM
#21
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,795
Plugin Contributions:
22

Exclude category from also purchased?

What do you mean "are not being rewritten"? The link takes you to /login and not /index.php?main_page=login - or did you hard code the links?

It seems like you should reset SSU cache. I think you're mixing it's cache from two different shops since you obviously have some URLs with cPath showing and some without (your dev site probably doesn't have Alias turned on). Anyway, try resetting SSU cache first. If that doesn't do the trick, set SSU status to false and remove the .htaccess file from the root (or rename it to htaccess.old) and try again. It seems you're simply missing something because SSU works fine:
http://dev.perfectlocks.com/wavy-indian-hair-c-116_122

5 Jun 2012, 6:28 PM
#22
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Re: Exclude category from also purchased?

Ahhh, thank you very much. I have a correctly loading page without SSU now. Here is a product:

http://dev.perfectlocks.com/virgin-indian-hair-c-94_56/wavy-virgin-indian-hair-weave-p-222

You can see that a 12" Straight Hand Tied Weft (Virgin Medium Brown) product is in the Also purchased mod. The product is from this category http://dev.perfectlocks.com/discount-weaves-c-70_76 which I do have excluded in tpl_modules_also_purchased_products.php by adding the code here:

<?php if ($zc_show_also_purchased == true && ($current_category_id != '71' && $current_category_id != '72' && $current_category_id != '75' && $current_category_id != '76') ) { ?>

Maybe now we can get to the root of the problem, thanks so much for your persistence in helping me!

5 Jun 2012, 6:51 PM
#24
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Re: Exclude category from also purchased?

5 Jun 2012, 7:18 PM
#25
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

If you look in categories_id 70 in your Zen Cart Admin, does it contain only subcategories or both Categories and Products?

5 Jun 2012, 7:20 PM
#26
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Re: Exclude category from also purchased?

Only the subcategories, no products directly under the category.

5 Jun 2012, 9:33 PM
#27
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

Okay so you are trying to block the actual Products from the Also Purchased from showing on other Products that they were purchased from if they are in these 4 categories, correct?

If so, are these 4 categories of Products using these 4 categories_id numbers as their master_categories_id for the Products that should not show?

5 Jun 2012, 10:17 PM
#28
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Re: Exclude category from also purchased?

To answer your first question, yes I believe.

To answer the second question, I believe it's no. The following subcats are in master category 70:
http://dev.perfectlocks.com/discount-bulk-hair-c-70_72
http://dev.perfectlocks.com/discount-clip-ons-c-70_75
http://dev.perfectlocks.com/discount...n-hair-c-70_71
http://dev.perfectlocks.com/discount-weaves-c-70_76

I do not have these subcategories in any other master_categories_id except 70, which is our Clearance Rack.

An example of a product that we do not want to show is here:

http://dev.perfectlocks.com/discount-weaves-c-70_76/12-straight-hand-tied-weft-virgin-medium-brown-m-574

I hope that makes sense.

5 Jun 2012, 10:39 PM
#29
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

The master_categories_id is NOT the parent Categories categories_id ...

It should be the immediate category that the products are in ...

When you edit one of these Products, what do you see listed for the:

Product Master Category:

at the top of the screen?

Do you use Linked Products?

5 Jun 2012, 10:47 PM
#30
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Re: Exclude category from also purchased?

Ok, sorry about that. I see one of the following numbers: 71, 72, 75, 76.

These are the numbers that I used in your proposed code, but they are having no effect on hiding the products.

<?php if ($zc_show_also_purchased == true && ($current_category_id != '71' && $current_category_id != '72' && $current_category_id != '75' && $current_category_id != '76') ) { ?>

The products are not linked.

6 Jun 2012, 1:14 AM
#31
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

There are several aspects to the Also Purchased ...

That code blocks the Also Purchased from showing on the product _info when in the products of those categories ...

To block Products from those categories from showing on other categories in the Also Purchased but still let the Also Purchased to show, you need to customize the code in:
/includes/classes/db/mysql/define_queries.php

and change the code to include the code in RED:

DEFINE('SQL_ALSO_PURCHASED', "select p.products_id, p.products_image
                     from " . TABLE_ORDERS_PRODUCTS . " opa, " . TABLE_ORDERS_PRODUCTS . " opb, "
                            . TABLE_ORDERS . " o, " . TABLE_PRODUCTS . " p
                     where opa.products_id = '%s'
                     and opa.orders_id = opb.orders_id
                     and opb.products_id != '%s'
                     and opb.products_id = p.products_id
                     and opb.orders_id = o.orders_id
                     and p.products_status = 1
and master_categories_id NOT IN (71, 72, 75, 76)
                     group by p.products_id
                     order by o.date_purchased desc
                     limit " . MAX_DISPLAY_ALSO_PURCHASED);
6 Jun 2012, 6:03 PM
#32
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Re: Exclude category from also purchased?

Just wanted to give big thanks to you Linda. The code worked flawlessly, thank you so much for your persistence in helping me and understanding my needs. It's exactly what I was looking for.

This is the reason I love Zen Cart so much, this forum is unbelievably helpful and gives me everything I'm looking in an e-commerce platform. Thanks again.

6 Jun 2012, 6:10 PM
#33
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

You are most welcome ... glad that this is now working for you as you needed ... remember the Zen Cart Team when you are rich and famous ... :cool:

22 Oct 2012, 1:45 AM
#34
mcpisik avatar

mcpisik

Zen Follower

Join Date:
Jan 2007
Location:
Mount Maunganui, New Zealand
Posts:
417
Plugin Contributions:
0

Re: Exclude category from also purchased?

Thanks for answering this post also. I've just used your answer to instantly do the same thing. Cheers.

22 Oct 2012, 1:52 AM
#35
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

Thank you for the update that you were also able to use this solution ... :smile:

29 Nov 2012, 5:09 AM
#36
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Exclude category from also purchased?

Hi Gautama,

I tried messaging you but your inbox is full. Sorry for the bandwidth, but I had no other way to reach you:)