Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2007
    Posts
    36
    Plugin Contributions
    0

    Default How to do something if the price is greater than $100

    Hi,

    I am doing a shop where there will be a certificate of Authenticity issued if the price of the product is over $100.00 and want the information to show automatically on the product info page.

    I have tried this
    PHP Code:
    <?php 
    $main_price 
    zen_get_products_display_price((int)$_GET['products_id']);
    echo 
    $main_price;

    If (
    $main_price >= 10.00)  {
    echo 
    TEXT_CERT_AUTHENTICITY ;
    }
     
    ?>
    However, it is not showing anything. I have tested that $main_price is giving the correct price for the product. I have also tested that TEXT_CERT_AUTHENTICITY can be written correctly.

    I have viewed products that are over 10.00 and they are not showing the extra text. I have also tested with viewing products under 10.00 and still get nothing.

    However, if I change it to $main_price <= 10.00 then the TEXT_CERT_AUTHENTICITY will show if the product is OVER $10.00 but if the product is less than 10.00 it will not show the TEXT_CERT_AUTHENTICITY

    Ok, so it is doing what I want it to do, but I would like to understand why the <= (less than or equal to) gives greater than or equal to results and the >= gives less than or equal to results.

    What am I doing wrong? I am not really familiar with php only asp.

    Thank you!

  2. #2
    Join Date
    Sep 2007
    Posts
    36
    Plugin Contributions
    0

    Default Re: How to do something if the price is greater than $100

    More info:

    However, evey now and again all products show the TEXT_CERT_AUTHENTICITY regardless of price, then sometimes all products show no TEXT_CERT_AUTHENTICITY regardless of price.

    Using the Zen Cart v1.3.7.1/v1.3.7.1 on windows server running PHP Version 5.1.1

    Thank you for your time

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

    Default Re: How to do something if the price is greater than $100

    Display price is just that, a display ... this is not a numeric value ...

    Something like this can help but be aware when attributes are involved then the products_id must include the attributes to show the price or it will not validate. This takes some of your code but adds additional code to the look up:
    PHP Code:
    <?php
    $main_price 
    zen_get_products_display_price((int)$_GET['products_id']);
    echo 
    'I see price in alpha form: ' $main_price . ($main_price ' YES' ' NO') . '<br>';
    $products_lookup $_SESSION['cart']->get_products();
    $not_in_cart true;
    for (
    $i=0$n=sizeof($products_lookup); $i<$n$i++) {
      if (
    $products_lookup[$i]['id'] == $_GET['products_id']) {
        
    $not_in_cart false;
        echo 
    'products_lookup price only if in cart: ' $products_lookup[$i]['final_price'];
      }
    }
    if (
    $not_in_cart == true) {
      echo 
    'products_lookup price NOT in cart ';
    }

    If (
    $main_price >= 10.00)  {
    echo 
    TEXT_CERT_AUTHENTICITY ;
    }
     
    ?>
    To see prices that are in the cart that do not show, go to the shopping cart and click the link back to the product ... more than likely this is a product with attributes and now the products_id has the attributes added to get the full price ...

    There are other methods but this might give you an idea of where to start ...
    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: v1.5.5]
    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. v155 How do I get the tab on my browser to say something other than Zencart?
    By bscho in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 17 Jul 2016, 06:48 PM
  2. How can I dispaly stock quantities only if quantity in stock is greater than zero?
    By Liamv in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 22 Feb 2013, 12:39 AM
  3. How to make the price from 100.99 to 101.0?
    By explorer1979 in forum General Questions
    Replies: 3
    Last Post: 27 May 2011, 01:48 PM
  4. Price To must be greater than or equal to Price From
    By CaroleAs in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 15 Feb 2009, 10:25 PM
  5. Adding products greater than the quantity in stock.
    By namae in forum Managing Customers and Orders
    Replies: 1
    Last Post: 15 Jan 2009, 06:10 PM

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