Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2009
    Location
    Australia
    Posts
    604
    Plugin Contributions
    0

    Default Display text when sub category is off

    Hi There,

    I have a category.

    Lets say A

    Inside the A there are products.

    I have disabled the products. (The category is still ON)

    The text displayed when you select A : There are no products to list in this category.

    My question is.. I wish to display my own text here.

    Can I enable the text that is entered in my Categories 'EDIT' section?

    Categories > A (edit button)

    The text displays fine when products are enabled but disappear when products are disabled.

    Hope that's clear enough.

    Thanks
    That wasn't the plan!

  2. #2
    Join Date
    Jul 2010
    Posts
    7
    Plugin Contributions
    0

    Default Re: Display text when sub category is off

    You can edit this file: includes/languages/english/index.php

    Find the following code:
    define('TEXT_NO_PRODUCTS', 'There are no products to list in this category.');

    And replace it with:

    define('TEXT_NO_PRODUCTS', 'Whatever you want.');

    IMPORTANT NOTE - That will change the "no product" text for ALL categories.

    As far as only changing it for that one category, this one may not work, but it's a guess for you and maybe a starting point - just make sure you backup the file first.

    Open up includes/modules/product_listing.php

    Find this line: 'text' => TEXT_NO_PRODUCTS);

    Replace it with:

    $myrandomvariable = $listing->fields['master_categories_id'];

    if($myrandomvariable == ID) {
    'text' => "Whatever you want");
    }
    else
    'text' => TEXT_NO_PRODUCTS);

    ID should be the ID# of your Category A, which you can find in the backend of Zen Cart (the admin area). Whatever you want is self explanatory and you can name $myrandomvariable whatever you want.

    Let me know how it goes! Good luck...

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Display text when sub category is off

    You can't put multiple lines of PHP inside an array statement like that. I would move the testing to above the array line, and insert its outcome into the array.
    PHP Code:
    $cat_noprod_text TEXT_NO_PRODUCTS;
    if(
    defined('TEXT_NO_PRODUCTS' $listing->fields['master_categories_id']) {
      
    $cat_noprod_text constant('TEXT_NO_PRODUCTS' $listing->fields['master_categories_id']);
    }

    //or the more compact version

      
    $cat_noprod_text = (defined('TEXT_NO_PRODUCTS_' $listing->fields['master_categories_id'])? constant('TEXT_NO_PRODUCTS_' $listing->fields['master_categories_id']): TEXT_NO_PRODUCTS;

    //and the insertion

                                                  
    'text' => $cat_noprod_text); 
    PHP Code:
    } else {
      
    $cat_noprod_text = (defined('TEXT_NO_PRODUCTS_' $listing->fields['master_categories_id'])? constant('TEXT_NO_PRODUCTS_' $listing->fields['master_categories_id']): TEXT_NO_PRODUCTS;

      
    $list_box_contents = array();

      
    $list_box_contents[0] = array('params' => 'class="productListing-odd"');
      
    $list_box_contents[0][] = array('params' => 'class="productListing-data"',
                                                  
    'text' => $cat_noprod_text); 
    Make a new file /includes/languages/english/extra_definitions/no_products_defines.php
    PHP Code:
    <?php
    //text for different categories when no products

    define('TEXT_NO_PRODUCTS_23''Category 23 is out of products right now.'); 
    define('TEXT_NO_PRODUCTS_27''Category 27 is fresh out of products - we\'ll have more soon.');

  4. #4
    Join Date
    Mar 2009
    Location
    Australia
    Posts
    604
    Plugin Contributions
    0

    Default Re: Display text when sub category is off

    Sorry for extremely belated reply.

    Been Overseas.

    I will give your suggestions a try and respond back.

    Thanks again.
    That wasn't the plan!

  5. #5
    Join Date
    Jan 2010
    Posts
    124
    Plugin Contributions
    0

    Default Re: Display text when sub category is off

    Hi all! Do any of you know a way to set ZC to NOT display any products or categories that are disables or do not exist and throw a 404 error? I have search engines indexing pages as if they are still good when categories and products are in fact gone.

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Display text when sub category is off

    It's not a matter of a Zen Cart setting; if a page that is searched for does not currently exist, you will get a "page not found" error. ZC has a standard page for that so you don't see a generic browser error page. You could use 301 redirects for any URLs that you want to go to a page specifically for deleted products, or if there is a new similar product, send the visitor to that URL.

  7. #7
    Join Date
    Jan 2010
    Posts
    124
    Plugin Contributions
    0

    Default Re: Display text when sub category is off

    I have hundreds of them so what would be the best way. I'm still not sure why an invalid url can be entered and return a result but I guess it doesn't matter. So I need to make a redirect for a few hundred urls some how. Any idea how t do that? What happens with the search engines indexing pages that are deleted they continue to index them? I searched the generic not found text text from zen cart and got bunches of hits from online stores which is basically useless content and in my case may cause the site to use that as key words. So if a category or product is deleted or disabled it is still a valid url. That doesn't sound right. There has got to be a way to do it some how I'm sure. Would it be worse to show a page not found error? Wouldn't the search engines get the hint? I'm not sure what is best in this case. Should I just leave it?

  8. #8
    Join Date
    Jan 2010
    Posts
    124
    Plugin Contributions
    0

    Default Re: Display text when sub category is off

    Ok it appears I did not know that a 404 response was returned so no harm done. Shoot.... I found info in this thread in case anyone is following...

    http://www.zen-cart.com/forum/showthread.php?t=167335

 

 

Similar Threads

  1. v151 Display images of Sub-Sub category in Main page while navigating.
    By Javier Romero in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 3 May 2013, 10:02 AM
  2. Replies: 1
    Last Post: 1 May 2013, 10:20 PM
  3. Display sub cat names as text not images on category page
    By Sushigal in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 7 Jun 2010, 05:00 PM
  4. How to NOT display sub sub category images?
    By magneteye in forum General Questions
    Replies: 19
    Last Post: 11 Apr 2009, 05:09 AM
  5. Replies: 3
    Last Post: 5 Dec 2006, 02:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR