Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Posts
    32
    Plugin Contributions
    0

    help question PHP: Help Using If Statement To Check Category?

    Ok, so it's about some simple php, but I'm not the best at that. ;-)

    So, say I have two html blocks, block#1 and block#2. In my catalog, I have only 2 categories. On my page, I want block#1 to show up only if the visitor is viewing category#1 of my catalog. Otherwise, he's viewing category#2 and then, I want block#2 to show up.

    I want to use an "if statement" that would do just that, but don't know how to check which category is being viewed.

    Below is an example of what I'm looking to achieve:

    PHP Code:
    <?php if ($_GET['main_page'] == "page_2") { ?> // This is the part I need to adapt
    //some HTML here
    <? } else { ?>
    //some HTML here
    <? } ?>
    Thanks a zillion for your help guys!

    PS: I can't post a url to my website yet coz it's local for now. Sorry

  2. #2
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: PHP: Help Using If Statement To Check Category?

    Try:
    Code:
    if ($cPath == '1') {
    ... substituting '1' with whatever the actual cPath number is for the category you're wanting to show on.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Feb 2009
    Posts
    32
    Plugin Contributions
    0

    Default Re: PHP: Help Using If Statement To Check Category?

    Works!!! You're the man! And if I remember well, every time I searched for help on this forum, you were the one to answer. THANK YOU, THANK YOU, THANK YOU!

 

 

Similar Threads

  1. v151 Help with a php statement
    By suportafaceri in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 6 Apr 2014, 09:43 AM
  2. Need an IF statement to check if a product is in cart?
    By philip937 in forum General Questions
    Replies: 3
    Last Post: 17 Sep 2012, 12:07 AM
  3. Using php next to Category descriptions
    By retched in forum General Questions
    Replies: 20
    Last Post: 27 Sep 2010, 08:18 PM
  4. adding php statement ! please help
    By gentmat in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 11 Apr 2009, 06:36 PM
  5. Php Conditional Statement
    By zforrest in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 16 Jun 2006, 01:07 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