Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2007
    Posts
    132
    Plugin Contributions
    0

    Default Howto: NOT list category on sidebox ?

    is there a way to not show a certain category on the categories sidebox ?

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

    Default Re: Howto: NOT list category on sidebox ?

    In /includes/templates/your_template/sideboxes/tpl_categories.php, find this line near the top of the file:
    PHP Code:
        if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
          
    // skip if this is for the document box (==3) 
        
    } else { 
    and add

    ($box_categories_array[$i]['path'] == 'cPath=23') or

    to the beginning to get
    PHP Code:
        if (($box_categories_array[$i]['path'] == 'cPath=23') or zen_get_product_types_to_category($box_categories_array[$i]['path']) == or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
          
    // skip if this is for the document box (==3), or category 23
        
    } else { 
    Replace the 23 with the correct cPath for your category so it reads (say) 'cPath=4_37'.

  3. #3
    Join Date
    Jul 2007
    Posts
    132
    Plugin Contributions
    0

    Default Re: Howto: NOT list category on sidebox ?

    THANKS !!!

    Worked great

  4. #4
    Join Date
    May 2005
    Posts
    539
    Plugin Contributions
    0

    Default Re: Howto: NOT list category on sidebox ?

    Hi

    I am trying to get a link to category to disappear of a product page if you are in that category.

    the code works but if I am on a different category and I want the same to happen but this is a subcategory then code does not seem to work. I am a novice at php and so have pinched code from else where to get it to work for the first bit.

    elseif ($_GET['cPath'] != 11_233 )

    does not seem to like the underscore in the cPath reference. Could some one help with the syntax

    Thanks MG

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

    Default Re: Howto: NOT list category on sidebox ?

    You might try using quotes around the value, as it is a string and not a numeric value:

    elseif ($_GET['cPath'] != '11_233' )

  6. #6
    Join Date
    May 2005
    Posts
    539
    Plugin Contributions
    0

    Default Re: Howto: NOT list category on sidebox ?

    gjh42

    I did try this but then this caused a complete error on the page and did not load at all.

    MG

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

    Default Re: Howto: NOT list category on sidebox ?

    It's impossible to troubleshoot a partial line of code without context. What is the complete statement you are trying to use? (And the ones before and after might be relevant too.)

  8. #8
    Join Date
    May 2005
    Posts
    539
    Plugin Contributions
    0

    Default Re: Howto: NOT list category on sidebox ?

    gjh42

    this is in the tpl_product-info-diplay.php file:

    current code is:

    <div id="giftwrap"><?php if ($_GET['cPath'] != 194 )
    echo '<a href ="http://www.funkymoose.co.uk/index.php?main_page=index&cPath=194" ><img src="/includes/templates/template_default/images/icons/giftwrap.gif"> Gift wrapping available </a>';
    else
    echo "";


    This hides the gift wrap link if I am in the gift wrap catagory. I would like to also hide the link if I am on the greeting card category ( As I feel it is unlikely that some one wants to gift wrap a greeting card and it looks a bit odd having the link there. Of course if the worst comes to the worst it is not the end of the world but I am certainly curious about getting the code to work as I am sure it would hep with similar options.

    I tried:


    <div id="giftwrap"><?php if ($_GET['cPath'] != 11_223)
    echo '<a href ="http://www.funkymoose.co.uk/index.php?main_page=index&cPath=194" ><img src="/includes/templates/template_default/images/icons/giftwrap.gif"> Gift wrapping available </a>';
    else
    echo "";

    but I get the following error:

    Parse error: syntax error, unexpected T_STRING in \includes\templates\mytemplate\templates\tpl_product_info_display.php on line 122


    11_223 is the subcategory.

    Ideally I thought I should be able to run it as an if, elseif, else so both the initial category and subcategory can work.

    it might be that using if / case would be a better way to go???

    Hope this is enough code to help

    Sorry if this is a basic php question I am certainly a complete beginner.

    thanks

    MG

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

    Default Re: Howto: NOT list category on sidebox ?

    I don't know enough advanced PHP to know why the $_GET[] is better or necessary in certain circumstances, but the value of $cPath should be available in tpl_product_info_display.php. Instead of
    if ($_GET['cPath'] != 11_223)
    try
    if ($cPath != '11_223')
    and see if that works.

  10. #10
    Join Date
    May 2005
    Posts
    539
    Plugin Contributions
    0

    Default Re: Howto: NOT list category on sidebox ?

    Just some feed back

    if ($cPath != '11_223') - does not work.

    However I have just re-written this using switch / case statement and it worked first time

    Thanks

    MG

 

 

Similar Threads

  1. Expanded Category List Sidebox - How to Sort?
    By Jeff G in forum Addon Sideboxes
    Replies: 0
    Last Post: 2 May 2010, 09:37 PM
  2. Current Category Product List Sidebox
    By Aetherlux in forum Addon Sideboxes
    Replies: 1
    Last Post: 21 Feb 2009, 12:03 AM
  3. Expanded Category List - make it a page and not a sidebox
    By bradymc in forum Addon Sideboxes
    Replies: 11
    Last Post: 16 Feb 2008, 05:23 AM
  4. How to add two category list in sidebox
    By wdh in forum Customization from the Admin
    Replies: 1
    Last Post: 2 Nov 2007, 06:11 AM

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