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

Exclude category from also purchased?

Views: 5,155

Results 1 to 20 of 36
10 May 2012, 4:51 PM
#1
swamyg1 avatar

swamyg1

Zen Follower

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

Exclude category from also purchased?

I was wondering if anyone can tell me how to exclude a category from this feature. I'm still running on 1.3.9h and could really use some help with this. I have a category that does not have images and I would rather have those products not show at all. Thanks for the help!

12 May 2012, 8:49 PM
#2
balihr avatar

balihr

Totally Zenned

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

Re: Exclude category from also purchased?

Edit your includes/templates/YOUR_TEMPLATE/templates/tpl_modules_also_purchased_products.php (if you don't have that file there, then copy it from template_default)
Find line 17 and change from ```

<?php if ($zc_show_also_purchased == true) { ?>

to

<?php if ($zc_show_also_purchased == true && ($current_page_base == 'index' and $cPath != 'YOUR_CAT_ID') ) { ?>

Replace YOUR_CAT_ID with the category ID where you don't want to show APP. I haven't tested, but it should work... :smile: Hopefully, you'll tell us if it does.
4 Jun 2012, 2:10 PM
#3
swamyg1 avatar

swamyg1

Zen Follower

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

Re: Exclude category from also purchased?

Sorry for the late response here, but this isn't working. It's showing up blank on my product pages and seems to have no effect on the shopping cart page at all. Would appreciate if you could take another look:-)

4 Jun 2012, 2:28 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

Try changing:

<?php if ($zc_show_also_purchased == true) { ?>

To read:

<?php if ($zc_show_also_purchased == true && ($current_category_id != '10') ) { ?>

Where 10 is the immediate category ... this would be, for example when you see $cPath=3_10 in the URL the last number is the $current_category_id and when you see $cPath=21 in the URL then you would use 21 ...

4 Jun 2012, 2:40 PM
#5
swamyg1 avatar

swamyg1

Zen Follower

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

Re: Exclude category from also purchased?

Hi Linda, thanks so much for being so speedy. However, this also seems to have no effect. My category ID is 70, I have subcats 71, 72, 75, and 76. Have tried all of them in the code you provided to no avail :(

4 Jun 2012, 3:09 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

Let's say in the URL I see:
cPath=3_10
cPath=3_12
cPath=3_15

and I do not want to see the Also Purchased on these ...

I would use the code:

<?php if ($zc_show_also_purchased == true && ($current_category_id != '10' && $current_category_id != '12' && $current_category_id != '15') ) { ?>

So in your case you would use:
71, 72, 75, and 76

Just add an additional:
&& $current_category_id != 'XX'

for each one that you need to add ... where XX is the number on the end of the cPath= that you see in the URL when on a Product where you are not wanting to see the Also Purchased ...

4 Jun 2012, 4:59 PM
#7
swamyg1 avatar

swamyg1

Zen Follower

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

Re: Exclude category from also purchased?

Hi Linda,

I'm sorry but it seems this modification is having no effect on both the product page and the shopping cart page where I have the "also purchased" mod enabled. I am still seeing the items from the category and subcategories on all my pages :(

My code looks like this:

<?php
/**
 * Module Template
 *
 * Displays content related to "also-purchased-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: tpl_modules_also_purchased_products.php 3206 2006-03-19 04:04:09Z birdbrain $
 */
  $zc_show_also_purchased = false;
  include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_ALSO_PURCHASED_PRODUCTS));
?>

<?php if ($zc_show_also_purchased == true && ($current_category_id != '71' && $current_category_id != '72' && $current_category_id != '75' && $current_category_id != '76') ) { ?>
<div class="centerBoxWrapper clearfix" id="alsoPurchased">
<?php
  require($template->get_template_dir('tpl_columnar_display.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_columnar_display.php');
?>
</div>
<?php } ?>
4 Jun 2012, 5:12 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

Have you an URL to the Products where you are trying to make this change work?

4 Jun 2012, 5:15 PM
#9
swamyg1 avatar

swamyg1

Zen Follower

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

Re: Exclude category from also purchased?

Surely, there's this page: http://www.perfectlocks.com/virgin-indian-hair/straight-virgin-indian-hair-weave

The product "10" Wavy Machine Weft (#2 Dark Brown)" is from our "clearance rack" and does not have an image associated with it. None of our "Clearance Rack" items have an image, that's why I'm trying to find a workaround for this.

4 Jun 2012, 5:27 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

Is your templates and overrides using:
plocks_v1

If so, could you look to see if you have a templates and overrides file:
/includes/templates/plocks_v1/templates/tpl_modules_also_purchased_products.php

If so, can you put the custom code in your templates and overrides file ...

4 Jun 2012, 5:45 PM
#11
swamyg1 avatar

swamyg1

Zen Follower

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

Re: Exclude category from also purchased?

Hi Linda, I most definitely am using that file. See attached.
Attachment 10549

I'm certain it's the right file because "also purchased" did not display with the earlier code modification.

4 Jun 2012, 5:48 PM
#12
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 have a templates and overrides file for that, then you have to put your custom code in that file if you want it to work ...

4 Jun 2012, 5:57 PM
#13
swamyg1 avatar

swamyg1

Zen Follower

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

Re: Exclude category from also purchased?

Hmmm, but I don't. This is the only template I use and the only template file for "also purchased".

If I remove all the code from the file, the mod doesn't display on the page. I'm certain it's this file, the code is having no effect.

I really do appreciate your help, but please believe me that this is the correct file :-P

4 Jun 2012, 5:59 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

Could you put the code back in and turn off the SEO/rewrites for a bit .... I cannot "see" anything those on ...

5 Jun 2012, 4:53 PM
#15
swamyg1 avatar

swamyg1

Zen Follower

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

Re: Exclude category from also purchased?

I would do this, but I just did it on my test site and all of my URL's seem to lead to 404's. Furthermore, they all have 404's even after re-enabling the mod... Is this behavior normal? It makes me extremely nervous, and happy I didn't do it on my live site.

5 Jun 2012, 5:04 PM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Exclude category from also purchased?

I do not use the SEO/rewrites so I really cannot answer you on that one ...

5 Jun 2012, 5:14 PM
#17
balihr avatar

balihr

Totally Zenned

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

Re: Exclude category from also purchased?

Which SEF URL mod are you using? Are you sure your .htaccess file is good for your test site? What's the URL for your test site?

5 Jun 2012, 5:20 PM
#18
swamyg1 avatar

swamyg1

Zen Follower

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

Re: Exclude category from also purchased?

I'm using Simple SEO Urls by Rubik. My dev site is located here http://dev.perfectlocks.com.

5 Jun 2012, 5:30 PM
#19
balihr avatar

balihr

Totally Zenned

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

Re: Exclude category from also purchased?

Well, this obviously has nothing to do with SSU. As you can see, header works just fine and SEF URLs are properly generated. Take a look at your Login / My Account / Shopping Cart links...

Something else is causing the site to break. What does your error log say in /cache directory?

5 Jun 2012, 6:01 PM
#20
swamyg1 avatar

swamyg1

Zen Follower

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

Re: Exclude category from also purchased?

The links in the header are not being rewritten. They are excluded from SSU.

This page is a good example, it breaks on the dev site:
http://dev.perfectlocks.com/virgin-indian-hair/wavy-virgin-indian-hair-weave

The live page obviously works just fine:
http://www.perfectlocks.com/virgin-indian-hair/wavy-virgin-indian-hair-weave

I do not see an error log in my cache folder, am I missing something?