Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2005
    Posts
    123
    Plugin Contributions
    0

    Default Conditional statement in product info

    Hi Guys,

    This is doing my head in!

    I want to show a "we will not be beaten on price" type image on the product listing page and the product info page EXCEPT for all products in one category.

    The ID of the cat to exclude is 22

    I've added this to product_listing.php and it works fine

    if((int)$_GET['cPath'] !== 22) $lc_text .= '<img src="/images/low-price-prom.jpg" style="padding-right: 20px;" alt="We will NOT be beaten on price!" title="We will NOT be beaten on price!" /><br />';

    But then I add the following to tpl_product_info_display.php:

    <?php if((int)$_GET['cPath'] !== 22) echo '<img src="/images/low-price-prom.jpg" style="float: right;" alt="We will not be beaten on price!" title="We will not be beaten on price!" />'; ?>

    And it doesn't work - the image is shown on all products regardless of category????

    I am sure I am missing something obvious - but what??

    Thanks

    Tony

  2. #2
    Join Date
    Mar 2005
    Posts
    123
    Plugin Contributions
    0

    Default Re: Conditional statement in product info

    ok - I've figured out that the code is correct, it's the CEON URI mapping that is loosing the cPath on the product pages.

    I can append the cPath to the product URL's but this looks messy so I don't think this can be done with URI mapping as it is - the page simply doesn't know what current cPath it's in!

    Tony

  3. #3
    Join Date
    Nov 2006
    Location
    Dartmouth, NS Canada
    Posts
    2,378
    Plugin Contributions
    0

    Default Re: Conditional statement in product info

    I'm not sure if this too would not work as usual because of the URI mapping, but you may be able to simply hide that element in that category by using a category-specific style sheet. Details on how to do this are in the readme file in the css folder. You'll need to ensure the image is in a div with a unique class.

    Rob

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

    Default Re: Conditional statement in product info

    See if using the variable:
    $current_category_id

    works for you rather than the (int)$_GET['cPath'] ...
    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!

 

 

Similar Threads

  1. Conditional statement in shopping_cart
    By The_Mech in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 9 Mar 2014, 11:29 PM
  2. Conditional Statement - Parent and Child Category Display Additional Information
    By crlannen in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 6 Feb 2011, 04:13 AM
  3. IF statement for a specific product info page
    By milkyway in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 4 Jul 2007, 07:59 AM
  4. Stock quantity conditional statement?
    By doodlebee in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 18 Jun 2007, 03:57 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