Thread: Coding Nudge

Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2009
    Posts
    206
    Plugin Contributions
    2

    Default Coding Nudge

    I'm trying to turn off certain banner boxes in specific categories. I have achieved part of what I want to do by using

    PHP Code:
      if ($show_banner_box2 true && (!in_array($current_category_id, array('1','53','4','2','3','47','55','57','56','54','48','49','50','51')))){
      
    // show it
      
    $show_banner_box2 == true;
    } else {
      
    // do not show it
      
    $show_banner_box2 == false;

    in includes/modules/sideboxes/my_template/banner_box2.php,
    but was hoping someone would be able to help me reduce the query time on this statement (as it is a very long with the other banner box that I'm using).

    I can't figure out how to exclude just a top level category instead of having to exclude the top level category and all the subcategories.

    I've tried using $master_category_id, $category_id, $top_category_id as well as $categories_id and I'm outta ideas. I've hunted through other posts, trying to figure out which "$" controls the top level category, but can't seem to find what I'm looking for.

    I'm not proficient at coding but I've got google, so feel free to be as technical as necessary.

    Thanks in advance!

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Coding Nudge

    Just as a test, before the start of your IF put in:
    Code:
    echo 'Start banner 2 time: ' . date("D M j G:i:s T Y") . '<br>';
    and after the close of the IF put:
    Code:
    echo 'End banner 2 time: ' . date("D M j G:i:s T Y") . '<br>';
    now when you refresh the page you will see by banner_box2 the start and end time ...

    How much time is actually being used?
    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!

  3. #3
    Join Date
    Dec 2009
    Posts
    206
    Plugin Contributions
    2

    Default Re: Coding Nudge

    Oh fine - now it's not being slow. It must have been my server. I really appreciate your help, though and now I know how to check the query time on my banners.

    If you have a sec, I'd still like to know what specifies the top category - I looked for it for a few hours yesterday and must have missed it somewhere. (Sorry - I'm a little OC about knowing what I was doing wrong.)

    If you don't, it's all good - I'm sure I'll come across my mistake somewhere when I'm looking for something else.

    Thanks again!

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Coding Nudge

    The top category is cPath= 0 ...

    You could do something similar to echo the $current_category_id so you can see what it is as you navigate ...
    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!

  5. #5
    Join Date
    Dec 2009
    Posts
    206
    Plugin Contributions
    2

    Default Re: Coding Nudge

    Thanks so much - that was driving me nuts... Have a great night!

 

 

Similar Threads

  1. HTML Coding
    By annettes in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 9 Feb 2011, 12:33 AM
  2. Please nudge me in the right direction
    By alnaad in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 27 Jun 2009, 06:41 AM
  3. PHP coding.
    By Xam in forum General Questions
    Replies: 5
    Last Post: 10 Apr 2008, 09:47 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