Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2005
    Location
    Lake Havasu, AZ
    Posts
    1,149
    Plugin Contributions
    0

    Default Hiding a portion of text on one category

    It's been a mighty long time since I have had to post a question, but a PHP coder I am definitely not so here we go...

    I have a portion of text (sizing information) on a site which I have "coded" into the tpl_product_info_display.php which is working perfect because we want this info to show on all products... until now.

    Now we have added a new category of product which doesn't need that extra text and I would like to hide it on that specific category only.

    I know this can be achieved with an "if" statement, my problem is that I am apparently not writing the "if" statement correctly. Can someone please tell me the correct way to write the code.

    Thanks!
    When the world gets in my face I say Have A Nice Day.
    * I DO Think and I HAVE BEEN Zenned - therefore, I AM * I donate - do you?
    Custom Templates and Zen Services CRS Designs, Inc.

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

    Default Re: Hiding a portion of text on one category

    Something like
    PHP Code:
    if($_GET['cPath'] != '##') {//replace ## with your cPath
      //output the text


  3. #3
    Join Date
    Jan 2005
    Location
    Lake Havasu, AZ
    Posts
    1,149
    Plugin Contributions
    0

    Default Re: Hiding a portion of text on one category



    That didn't work either... I had tried using the code for hiding columns from tpl_main_page and that didn't do it either.

    I am thinking that it might have something to do with either the length of the text that I am putting there or maybe I need to escape some characters, because I get a blank page completely when I put the "if" in...

    I will look closer at it and see if I can get it to work through some miracle.

    Thanks Glen!
    When the world gets in my face I say Have A Nice Day.
    * I DO Think and I HAVE BEEN Zenned - therefore, I AM * I donate - do you?
    Custom Templates and Zen Services CRS Designs, Inc.

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

    Default Re: Hiding a portion of text on one category

    Try the if test with a simple text output inside the switched area, to see if it is the test or the output causing the problem.

    Post the text you are trying to use (exactly as it is in the code) so we can see if there are any problem characters.

  5. #5
    Join Date
    Jan 2005
    Location
    Lake Havasu, AZ
    Posts
    1,149
    Plugin Contributions
    0

    Default Re: Hiding a portion of text on one category

    Good Idea Glenn - unfortunately the test shows that it is the code itself. When I add this :

    Code:
    <?php
    if($_GET['cPath'] != '19') {
    
    TESTING THIS TO SEE WHERE ERROR IS
    }  
    ?>
    I get a blank page for the product description. It loads as far as breadcrumbs and then goes blank
    When the world gets in my face I say Have A Nice Day.
    * I DO Think and I HAVE BEEN Zenned - therefore, I AM * I donate - do you?
    Custom Templates and Zen Services CRS Designs, Inc.

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

    Default Re: Hiding a portion of text on one category

    You need to either go back to HTML or use a PHP echo statement for the text:
    PHP Code:
    <?php
    if($_GET['cPath'] != '19') {

      echo 
    'TESTING THIS TO SEE WHERE ERROR IS';
    }  
    ?>
    or
    PHP Code:
    <?php
    if($_GET['cPath'] != '19') {
    ?>
    TESTING THIS TO SEE WHERE ERROR IS
    <?php
    }  
    ?>

  7. #7
    Join Date
    Jan 2005
    Location
    Lake Havasu, AZ
    Posts
    1,149
    Plugin Contributions
    0

    Default Re: Hiding a portion of text on one category

    OK - we got the page back while it is wrapped in the if statement.

    Only problem now is that it still shows on all products pages.

    In this case I need it to either show only on cpath=19 or I need it to not show on cpath=23 - either way doesn't matter to me :)
    When the world gets in my face I say Have A Nice Day.
    * I DO Think and I HAVE BEEN Zenned - therefore, I AM * I donate - do you?
    Custom Templates and Zen Services CRS Designs, Inc.

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

    Default Re: Hiding a portion of text on one category

    The test as written should hide the content on category 19. Add this just above the if line to see what the actual cPath is in each case:
    PHP Code:
    echo 'cPath ' $_GET['cPath']; 

  9. #9
    Join Date
    Jan 2005
    Location
    Lake Havasu, AZ
    Posts
    1,149
    Plugin Contributions
    0

    Default Re: Hiding a portion of text on one category



    Thank you very very much Glen!

    Works like a champ :)
    When the world gets in my face I say Have A Nice Day.
    * I DO Think and I HAVE BEEN Zenned - therefore, I AM * I donate - do you?
    Custom Templates and Zen Services CRS Designs, Inc.

 

 

Similar Threads

  1. v151 2 problems, one with URL, another with hiding text on page
    By Ridgh in forum General Questions
    Replies: 7
    Last Post: 2 Apr 2014, 05:24 PM
  2. Hiding the Sold Out image on just one product
    By ArtsygalDotNet in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 1 Jul 2010, 10:12 AM
  3. Replies: 4
    Last Post: 20 Mar 2009, 03:46 AM
  4. Hiding product images under one category but not another
    By robgt in forum Templates, Stylesheets, Page Layout
    Replies: 21
    Last Post: 7 Mar 2008, 01:13 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