Forums / Templates, Stylesheets, Page Layout / Disabled products show as new products after editing

Disabled products show as new products after editing

Locked

Views: 1,842

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
18 Feb 2009, 10:19 PM
#1
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Disabled products show as new products after editing

Hi all,

before I attack the code, I had some items in my store that I have editted and then disabled. The edit makes Zen Cart thinks the products are new. Fair enough. But they show up in the New Products box even though they are disabled. Does this need a tweak or are there settings for this?

Also, I have found that a category that has products in it, all of which are disabled, still shows in the category list. Again, does this need a tweak or is there a configuration setting?

Thanks

Kevin

18 Feb 2009, 10:24 PM
#2
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Disabled products show as new products after editing

To be clear, when I say need a tweak, I mean if I want to change the desired behavior. I am not trying to imply Zen Cart is at fault. I thik we all know Zen Cart is great - why else would we be on the forum in the first place!

Kev

18 Feb 2009, 11:09 PM
#3
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Disabled products show as new products after editing

Yuu guys must be thinking I like talking to myself - I keep replying to myself! :smile:

Well everyday, more things about Zen Cart click into place. Like the template system. it doesn't matter how well it's explained, once the penny drops it drops. I'm beginning to find my way around now.

So....with regard to not displaying categories with no products. There is no option for this. And I see why. It's not that straight forward. To do this needs a slight change to

/includes/templates/YOUR_TEMPLATE/sideboxes/tpl_categories.php

It's easy if you don't use sub categories. Will post if anyone wants it - but don't use it if you use sub-categories. I may have a go at making it sub-category compatible later.

With regard to disabled products in the New Products box - I'm on it now, but if anyone knows do get back to me.

Thanks again

Kev

18 Feb 2009, 11:18 PM
#5
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Disabled products show as new products after editing

To hide categories with no products IF YOU DON'T USE sub-categories, mkae these code changes (and I suggest doing it in your template rather than changing original Zen files).

File: /includes/templates/YOUR_TEMPLATE/sideboxes/tpl_categories.php

Around line 30 change:

if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
        // skip if this is for the document box (==3)
    } else {
        $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';

to:

if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
        // skip if this is for the document box (==3)
    } else {
        if ($box_categories_array[$i]['count'] > 0) {

        $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';

And around line 60 change:

if (SHOW_COUNTS == 'true') {
          if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
              $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
          }
      }
      $content .= '<br />' . "\n";
    }
  }

to:

if (SHOW_COUNTS == 'true') {
          if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
              $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
          }
      }
      $content .= '<br />' . "\n";
      } // extra brace for if count > 0
    }
  }

Kev

21 Feb 2009, 2:32 PM
#6
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Disabled products show as new products after editing

Just to let you know I have tried the above fix with sub categories

e.g.

Cat 1
|
|- Sub Cat 2
|
|-Sub Cat 3 ( 1 product)
|-Sub Cat 4

Without the fix above you would see
Cat 1 (1)
|
|- Sub Cat 2 (1)
|
|-Sub Cat 3 (1)
|-Sub Cat 4

With the fix abouve you see
Cat 1 (1)
|
|- Sub Cat 2 (1)
|
|-Sub Cat 3 (1)

So it works perfectly for sub-categories.

Kev

21 Feb 2009, 4:52 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: Disabled products show as new products after editing

You may wish to read through and apply the Known Bug Fixes for v1.3.8 ...
http://www.zen-cart.com/forum/showthread.php?p=659717#post659717

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!