Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Apr 2009
    Posts
    264
    Thanks
    24
    Thanked 1 Time in 1 Post

    PLEASE HELP! Prices now not displaying correctly on php page... ><

    On second thought, no. it's NOT fixed.. It's now displaying $_SESSION['istotal'] & $_SESSION['isdiscounttotal'] as $0.00.... PLEASE HELP! ><

    page2.php:

    PHP Code:
    <?php
    session_start
    ();
    require(
    'sessionvars.php');
    ?><html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Image Poseidon</title>
    </head>

    <body style="font-family: Arial">

    <script src="view_printable.js"></script>
    <script src="mainscripts.js"></script>

    <center>
    <a href="#" onclick="javascript:view_printable();">Click For Printable Page</a><br>
    </center>

    <?php
    require('header.php');
    require(
    'taxheader.php');
    require(
    'sessionvars.php');
    ?>

    <center>
    <h2>This is your order so far: </h2>
    </center>

    <FORM name="f0001" id="f0001" ACTION="processorder.php" method=post>

    <center>

    <?php
    echo "Name: <b><u>".$_SESSION['f_name0001']." ".$_SESSION['l_name0001']."</u></b><br>\n"
    ."Address: <b><u>".$_SESSION['ad_0001']."</u></b><br>\n"
    ."Country: <b><u>".$_SESSION['co_0001']."</u></b><br>\n"
    ."City: <b><u>".$_SESSION['c_0001']."</u></b><br>\n"
    ."State/Province: <b><u>".$_SESSION['sp_0001']."</u></b><br>\n"
    ."Amount of CD(s) you want to purchase: <b><u>".$_SESSION['qtycd_0001']."</u></b><br>\n";

    if(
    $_SESSION['hasadiscount'] == true){echo "Your coupon code: <b><u>".$_SESSION['customercouponcode']."</u></b><br><br>\n";}
    echo 
    "<img src=\"gradient_grey3596386127_footer-iaza.png\"></img><br>\n";

    if(
    $_SESSION['hasadiscount'] == true){

    echo 
    "<br>Original Total: <br><br>\n"
    ."<b>".$_SESSION['istotal']."-"."10%"."</b>"."<br>\n"
    ."<br>Your total: <br><br>\n"
    ."<b>".$_SESSION['isdiscounttotal']."</b><br>\n";

    }else if(
    $_SESSION['hasadiscount'] == false){

    echo 
    "<br>Your Total: <br><br>\n"
    ."<b>".$_SESSION['istotal']."</b><br>\n";

    }

    echo 
    "<br>\n";

    echo 
    "<img src=\"gradient_grey3596386127-iaza.png\"></img>\n";

    ?>

    <br>

    <a href="#" onclick="javascript:view_printable();">Click For Printable Page</a><br><br>

    <input name="subt1" id="subt1" type="submit" value="Submit" onclick="FormControl(1);">

    </center>

    </form>

    </body>

    </html>
    sessionvars.php:

    PHP Code:
    <?php

    $_SESSION
    ['f_name0001'] = $_POST['f_name0001'];
    $_SESSION['l_name0001'] = $_POST['l_name0001'];
    $_SESSION['ad_0001'] = $_POST['ad_0001'];
    $_SESSION['co_0001'] = $_POST['co_0001'];
    $_SESSION['c_0001'] = $_POST['c_0001'];
    $_SESSION['sp_0001'] = $_POST['sp_0001'];
    $_SESSION['qtycd_0001'] = $_POST['qtycd_0001'];
    $_SESSION['customercouponcode'] = $myCoupon;
    $_SESSION['hasadiscount'] = $hasdiscount;
    $_SESSION['istotal'] = $print_pur_po_total;
    $_SESSION['isdiscounttotal'] = $print_pur_po_total2;

    echo 
    "Firstname: ".$_SESSION['f_name0001']."<br>\n"
    ."Lastname: ".$_SESSION['l_name0001']."<br>\n"
    ."Address: ".$_SESSION['ad_0001']."<br>\n"
    ."Country: ".$_SESSION['co_0001']."<br>\n"
    ."City: ".$_SESSION['c_0001']."<br>\n"
    ."State / Province: ".$_SESSION['sp_0001']."<br>\n"
    ."Quantity: ".$_SESSION['qtycd_0001']."<br>\n"
    ."Coupon code: ".$_SESSION['customercouponcode']."<br>\n"
    ."Has discount: ".$_SESSION['hasadiscount']."<br>\n"
    ."is total: ".$_SESSION['istotal']."<br>\n"
    ."is discount total: ".$_SESSION['isdiscounttotal']."<br>\n"
    ."Total: ".$print_pur_po_total."<br>\n"
    ."Discount Total: ".$print_pur_po_total2."<br>\n";

    ?>
    taxheader.php:

    PHP Code:
    <?php

    $itemprice 
    12;
    $taxrate 7;
    $shipping 1.75;
    $discountrate .90;
    $Subtotal $itemprice;
    $Tax round( ($itemprice $taxrate 100 ), 2);
    $Total = (($Tax $Subtotal)*$qtycd)+($shipping*$qtycd);
    $DiscountTotal $Total*$discountrate//round($Total*($discountrate), 2);
    $coupons file('Vm1wS01HRXhVWGxWYmxKV1lrZG9VRlpyVmt0WGJGSllZM3BHVG1KSFVubFhhMXByWWtkR05sSnJXbFpXYldoeVZrZDRWMD VzV2xsYVIwWlhWakpvVkZaVldrWlBWa0pTVUZRd1BRPT0=.txt'FILE_SKIP_EMPTY_LINES);
    $coupons array_map('trim'$coupons);
    $myCoupon $_POST['sd_0001'];
    $hasdiscount false;

    // if found return the position in the array as $key
    if(($key array_search($myCoupon$coupons)) !== false) {
    $hasdiscount true;
    // delete the coupon from the array using $key
    unset($coupons[$key]);
    file_put_contents('Vm1wS01HRXhVWGxWYmxKV1lrZG9VRlpyVmt0WGJGSllZM3BHVG1KSFVubFhhMXByWWtkR05sSnJXbFpXY ldoeVZrZDRWMDVzV2xsYVIwWlhWakpvVkZaVldrWlBWa0pTVUZRd1BRPT0=.txt'implode("\r\n"$coupons));
    }
    else if((
    $key array_search($myCoupon$coupons)) == false) {
    $hasdiscount false;
    }

    $number $Total;
    $pur_item_total $number;
    $pur_po_total = ($pur_po_total $pur_item_total);
    $print_pur_po_total wims_currency($pur_po_total);

    $number2 $DiscountTotal;
    $pur_item_total2 $number2;
    $pur_po_total2 = ($pur_po_total2 $pur_item_total2);
    $print_pur_po_total2 wims_currency2($pur_po_total2);

    function 
    wims_currency($number) {
    if (
    $number 0) {
    $print_number "($" str_replace('-'''number_format ($number2"."",")) . ")";
    } else {
    $print_number "$" number_format ($number2"."",") ;
    }
    return 
    $print_number;
    }

    function 
    wims_currency2($number2) {
    if (
    $number2 0) {
    $print_number2 "($" str_replace('-'''number_format ($number22"."",")) . ")";
    } else {
    $print_number2 "$" number_format ($number22"."",") ;
    }
    return 
    $print_number2;
    }

    ?>
    vieworder.php:

    PHP Code:
    <?php
    session_start
    ();
    ?><html>
    <head><title>Image Poseidon - Order Form</title></head>
    <body>
    <?php
    require('taxheader.php');
    require(
    'variables.php');
    require(
    'sessionvars.php');
    ?>

    <center>

    <h2>Your Receipt: </h2>

    <hr/>

    <?php

    echo "Name: <b><u>".$_SESSION['f_name0001']." ".$_SESSION['l_name0001']."</u></b><br>\n"
    ."Address: <b><u>".$_SESSION['ad_0001']."</u></b><br>\n"
    ."Country: <b><u>".$_SESSION['co_0001']."</u></b><br>\n"
    ."City: <b><u>".$_SESSION['c_0001']."</u></b><br>\n"
    ."State/Province: <b><u>".$_SESSION['sp_0001']."</u></b><br>\n"
    ."Amount of CD(s) you want to purchase: <b><u>".$_SESSION['qtycd_0001']."</u></b><br>\n";

    if(
    $_SESSION['hasadiscount'] == true){echo "Your coupon code: <b><u>".$_SESSION['customercouponcode']."</u></b><br><br>\n";}

    if(
    $_SESSION['hasadiscount'] == true){

    echo 
    "<hr/>\n";

    echo 
    "<br>Original Total: <br><br>\n"
    ."<b>".$_SESSION['istotal']."-"."10%"."</b>"."<br>\n"
    ."<br>Your total: <br><br>\n"
    ."<b>".$_SESSION['isdiscounttotal']."</b><br>\n";

    }else if(
    $_SESSION['hasadiscount'] == false){

    echo 
    "<hr/>\n";

    echo 
    "<br>Your Total: <br><br>\n"
    ."<b>".$_SESSION['istotal']."</b><br>\n";

    }

    echo 
    "<br>\n";

    ?>

    </center>

    </body>
    </html>
    Thanks!

    ShadowIce~
    Last edited by Fou-Lu; 01-19-2010 at 03:24 AM.

  • #2
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    Quote Originally Posted by ShadowIce View Post
    On second thought, no. it's NOT fixed.. It's now displaying $_SESSION['istotal'] & $_SESSION['isdiscounttotal'] as $0.00.... PLEASE HELP! ><

    page2.php:

    PHP Code:
    <?php
    session_start
    ();
    require(
    'sessionvars.php');
    ?><html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Image Poseidon</title>
    </head>
     
    <body style="font-family: Arial">
     
    <script src="view_printable.js"></script>
    <script src="mainscripts.js"></script>
     
    <center>
    <a href="#" onclick="javascript:view_printable();">Click For Printable Page</a><br>
    </center>
     
    <?php
    require('header.php');
    require(
    'taxheader.php');
    require(
    'sessionvars.php');
    ?>
     
    <center>
    <h2>This is your order so far: </h2>
    </center>
     
    <FORM name="f0001" id="f0001" ACTION="processorder.php" method=post>
     
    <center>
     
    <?php
    echo "Name: <b><u>".$_SESSION['f_name0001']." ".$_SESSION['l_name0001']."</u></b><br>\n"
    ."Address: <b><u>".$_SESSION['ad_0001']."</u></b><br>\n"
    ."Country: <b><u>".$_SESSION['co_0001']."</u></b><br>\n"
    ."City: <b><u>".$_SESSION['c_0001']."</u></b><br>\n"
    ."State/Province: <b><u>".$_SESSION['sp_0001']."</u></b><br>\n"
    ."Amount of CD(s) you want to purchase: <b><u>".$_SESSION['qtycd_0001']."</u></b><br>\n";
     
    if(
    $_SESSION['hasadiscount'] == true){echo "Your coupon code: <b><u>".$_SESSION['customercouponcode']."</u></b><br><br>\n";}
    echo 
    "<img src=\"gradient_grey3596386127_footer-iaza.png\"></img><br>\n";
     
    if(
    $_SESSION['hasadiscount'] == true){
     
    echo 
    "<br>Original Total: <br><br>\n"
    ."<b>".$_SESSION['istotal']."-"."10%"."</b>"."<br>\n"
    ."<br>Your total: <br><br>\n"
    ."<b>".$_SESSION['isdiscounttotal']."</b><br>\n";
     
    }else if(
    $_SESSION['hasadiscount'] == false){
     
    echo 
    "<br>Your Total: <br><br>\n"
    ."<b>".$_SESSION['istotal']."</b><br>\n";
     
    }
     
    echo 
    "<br>\n";
     
    echo 
    "<img src=\"gradient_grey3596386127-iaza.png\"></img>\n";
     
    ?>
     
    <br>
     
    <a href="#" onclick="javascript:view_printable();">Click For Printable Page</a><br><br>
     
    <input name="subt1" id="subt1" type="submit" value="Submit" onclick="FormControl(1);">
     
    </center>
     
    </form>
     
    </body>
     
    </html>
    sessionvars.php:

    PHP Code:
    <?php
     
    $_SESSION
    ['f_name0001'] = $_POST['f_name0001'];
    $_SESSION['l_name0001'] = $_POST['l_name0001'];
    $_SESSION['ad_0001'] = $_POST['ad_0001'];
    $_SESSION['co_0001'] = $_POST['co_0001'];
    $_SESSION['c_0001'] = $_POST['c_0001'];
    $_SESSION['sp_0001'] = $_POST['sp_0001'];
    $_SESSION['qtycd_0001'] = $_POST['qtycd_0001'];
    $_SESSION['customercouponcode'] = $myCoupon;
    $_SESSION['hasadiscount'] = $hasdiscount;
    $_SESSION['istotal'] = $print_pur_po_total;
    $_SESSION['isdiscounttotal'] = $print_pur_po_total2;
     
    echo 
    "Firstname: ".$_SESSION['f_name0001']."<br>\n"
    ."Lastname: ".$_SESSION['l_name0001']."<br>\n"
    ."Address: ".$_SESSION['ad_0001']."<br>\n"
    ."Country: ".$_SESSION['co_0001']."<br>\n"
    ."City: ".$_SESSION['c_0001']."<br>\n"
    ."State / Province: ".$_SESSION['sp_0001']."<br>\n"
    ."Quantity: ".$_SESSION['qtycd_0001']."<br>\n"
    ."Coupon code: ".$_SESSION['customercouponcode']."<br>\n"
    ."Has discount: ".$_SESSION['hasadiscount']."<br>\n"
    ."is total: ".$_SESSION['istotal']."<br>\n"
    ."is discount total: ".$_SESSION['isdiscounttotal']."<br>\n"
    ."Total: ".$print_pur_po_total."<br>\n"
    ."Discount Total: ".$print_pur_po_total2."<br>\n";
     
    ?>
    taxheader.php:

    PHP Code:
    <?php
     
    $itemprice 
    12;
    $taxrate 7;
    $shipping 1.75;
    $discountrate .90;
    $Subtotal $itemprice;
    $Tax round( ($itemprice $taxrate 100 ), 2);
    $Total = (($Tax $Subtotal)*$qtycd)+($shipping*$qtycd);
    $DiscountTotal $Total*$discountrate//round($Total*($discountrate), 2);
    $coupons file('Vm1wS01HRXhVWGxWYmxKV1lrZG9VRlpyVmt0WGJGSllZM3BHVG1KSFVubFhhMXByWWtkR05sSnJXbFpXYldoeVZrZDRWMDVzV2xsYVIwWlhWakpvVkZaVldrWlBWa0pTVUZRd1BRPT0=.txt'FILE_SKIP_EMPTY_LINES);
    $coupons array_map('trim'$coupons);
    $myCoupon $_POST['sd_0001'];
    $hasdiscount false;
     
    // if found return the position in the array as $key
    if(($key array_search($myCoupon$coupons)) !== false) {
    $hasdiscount true;
    // delete the coupon from the array using $key
    unset($coupons[$key]);
    file_put_contents('Vm1wS01HRXhVWGxWYmxKV1lrZG9VRlpyVmt0WGJGSllZM3BHVG1KSFVubFhhMXByWWtkR05sSnJXbFpXYldoeVZrZDRWMDVzV2xsYVIwWlhWakpvVkZaVldrWlBWa0pTVUZRd1BRPT0=.txt'implode("\r\n"$coupons));
    }
    else if((
    $key array_search($myCoupon$coupons)) == false) {
    $hasdiscount false;
    }
     
    $number $Total;
    $pur_item_total $number;
    $pur_po_total =  ($pur_po_total $pur_item_total);
    $print_pur_po_total wims_currency($pur_po_total);
     
    $number2 $DiscountTotal;
    $pur_item_total2 $number2;
    $pur_po_total2 =  ($pur_po_total2 $pur_item_total2);
    $print_pur_po_total2 wims_currency2($pur_po_total2);
     
    function 
    wims_currency($number) {
       if (
    $number 0) {
         
    $print_number "($" str_replace('-'''number_format ($number2"."",")) . ")";
        } else {
         
    $print_number "$" .  number_format ($number2"."",") ;
       }
       return 
    $print_number;
    }
     
    function 
    wims_currency2($number2) {
       if (
    $number2 0) {
         
    $print_number2 "($" str_replace('-'''number_format ($number22"."",")) . ")";
        } else {
         
    $print_number2 "$" .  number_format ($number22"."",") ;
       }
       return 
    $print_number2;
    }
     
    ?>
    vieworder.php:

    PHP Code:
    <?php
    session_start
    ();
    ?><html>
    <head><title>Image Poseidon - Order Form</title></head>
    <body>
    <?php
    require('taxheader.php');
    require(
    'variables.php');
    require(
    'sessionvars.php');
    ?>
     
    <center>
     
    <h2>Your Receipt: </h2>
     
    <hr/>
     
    <?php
     
    echo "Name: <b><u>".$_SESSION['f_name0001']." ".$_SESSION['l_name0001']."</u></b><br>\n"
    ."Address: <b><u>".$_SESSION['ad_0001']."</u></b><br>\n"
    ."Country: <b><u>".$_SESSION['co_0001']."</u></b><br>\n"
    ."City: <b><u>".$_SESSION['c_0001']."</u></b><br>\n"
    ."State/Province: <b><u>".$_SESSION['sp_0001']."</u></b><br>\n"
    ."Amount of CD(s) you want to purchase: <b><u>".$_SESSION['qtycd_0001']."</u></b><br>\n";
     
    if(
    $_SESSION['hasadiscount'] == true){echo "Your coupon code: <b><u>".$_SESSION['customercouponcode']."</u></b><br><br>\n";}
     
    if(
    $_SESSION['hasadiscount'] == true){
     
    echo 
    "<hr/>\n";
     
    echo 
    "<br>Original Total: <br><br>\n"
    ."<b>".$_SESSION['istotal']."-"."10%"."</b>"."<br>\n"
    ."<br>Your total: <br><br>\n"
    ."<b>".$_SESSION['isdiscounttotal']."</b><br>\n";
     
    }else if(
    $_SESSION['hasadiscount'] == false){
     
    echo 
    "<hr/>\n";
     
    echo 
    "<br>Your Total: <br><br>\n"
    ."<b>".$_SESSION['istotal']."</b><br>\n";
     
    }
     
    echo 
    "<br>\n";
     
    ?>
     
    </center>
     
    </body>
    </html>
    Thanks!

    ShadowIce~
    How/where is page2.php being called? It looks like these two are always being set in sessionvars.php:
    PHP Code:
    $_SESSION['istotal'] = $print_pur_po_total;
    $_SESSION['isdiscounttotal'] = $print_pur_po_total2
    ...and nowhere in page2.php are those variables defined before hand.

  • #3
    Regular Coder
    Join Date
    Apr 2009
    Posts
    264
    Thanks
    24
    Thanked 1 Time in 1 Post
    $_SESSION['istotal']
    $_SESSION['isdiscounttotal']

    Both of the above are defined in sessionvars.php

    And

    $print_pur_po_total
    $print_pur_po_total2

    Are both defined in taxheaders.php

    As for page2.php, it is being called in here:

    Orderform.php:

    PHP Code:
    <?php
    require('errorheader.php');
    session_start();
        
    ?><?php
    /*This code is for use on www.imageposeidon.com ONLY!
    Using this code without written permission from imageposeidon.com is a violation of the GNU Public License (GPL)
    And will be dealt with to the fullest extent of the law
    */
          
    ?><html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Image Poseidon</title>
    </head>
    <body onsubmit="return validate_required(this)" style="font-family: Arial">

    <script src="cstate_0001.js"></script>

    <?php
    require('header.php');
    ?>

    <Script Language="JavaScript" type="JavaScript">

    function validate_required(field)
    {

    var alerttxt = "One or more fields are empty.\\nPlease fill them out before submitting";


    with (field)
    {

    if (value==null||value=="")
    {
    alert(alerttxt);
    return false;
    }else{
    return true;
    }
    }
    }
    </Script>

    <FORM onsubmit="return validate_required(this)" ACTION="page2.php" method=post>

    <center>
    <table border="0">
    <tr>
    <td><label for="fname_0001">First Name: </label></td>
    <td><input type="text" name="f_name0001" maxlength="30" id="f_name0001" size="30" /></td>
    </tr>
    <tr>
    <td><label for="lname_0001">Last Name: </label></td>
    <td><input type="text" name="l_name0001" maxlength="30" id="l_name0001" size="30" /></td>
    </tr>
    <tr>
    <td><label for="a_d0001">Shipping Address: </label></td>
    <td><input type="text" name="ad_0001" maxlength="128" id="ad_0001" size="30" /></td>
    </tr>
    <tr>
    <td>Country: </td>
    <td><select id='countrySelect' name='co_0001' onchange='populateState()' style="width: 209px;"></select></td>
    </tr>
    <tr>
    <td><label for="c0001">City: </label></td>
    <td><input type="text" name="c_0001" maxlength="30" id="c_0001" size="30" /></td>
    </tr>
    <br><br>
    <tr>
    <td>State: </td>
    <td><select name='sp_0001' id='stateSelect' name='state' style="width: 209px;"></select></td>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    <td width=150>Item: <br>
    &nbsp;</td>
    <td width=15>Quantity: <br>
    &nbsp;</td>
    </tr>
    <tr>
    <td>CD</td>
    <td><input type="text" name="qtycd_0001" value = "1" size="30" maxlength="7"></td>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    <td>Please enter a discount code if you have one: </td>
    <td><input type="text" name="sd_0001" value="000-000-00000" size="30" maxlength="64"></td>
    </tr>
    <tr>
    <td><input onsubmit="return validate_required(this)" type="submit" value="Go To Next Page"></td>
    </tr>

    <script type="text/javascript">initCountry('US');</script>

    </table>
    </center>

    </form>

    </body>
    </html>
    Last edited by Fou-Lu; 01-19-2010 at 03:27 AM.

  • #4
    Regular Coder
    Join Date
    Oct 2004
    Posts
    168
    Thanks
    0
    Thanked 5 Times in 5 Posts
    Why are you citing the GPL in your code?

  • #5
    Regular Coder
    Join Date
    Apr 2009
    Posts
    264
    Thanks
    24
    Thanked 1 Time in 1 Post
    Bah I fgt. to take that out. Please just ignore it.
    +
    There, I took it out..

    Can someone else please help?

    Ok. I've narrowed it down. the problem is in this file:

    taxorder.php:

    PHP Code:
    <?php

    $itemprice 
    12;
    $taxrate 7;
    $shipping 1.75;
    $discountrate .90;
    $Subtotal $itemprice;
    $Tax round( ($itemprice $taxrate 100 ), 2);
    $Total = (($Tax $Subtotal)*$qtycd)+($shipping*$qtycd);
    $DiscountTotal $Total*$discountrate//round($Total*($discountrate), 2);
    $coupons file('Vm1wS01HRXhVWGxWYmxKV1lrZG9VRlpyVmt0WGJGSllZM3BHVG1KSFVubFhhMXByWWtkR05sSnJXbFpXYldoeVZrZDRWMD VzV2xsYVIwWlhWakpvVkZaVldrWlBWa0pTVUZRd1BRPT0=.txt'FILE_SKIP_EMPTY_LINES);
    $coupons array_map('trim'$coupons);
    $myCoupon $_POST['sd_0001'];
    $hasdiscount false;

    // if found return the position in the array as $key
    if(($key array_search($myCoupon$coupons)) !== false) {
    $hasdiscount true;
    // delete the coupon from the array using $key
    unset($coupons[$key]);
    file_put_contents('Vm1wS01HRXhVWGxWYmxKV1lrZG9VRlpyVmt0WGJGSllZM3BHVG1KSFVubFhhMXByWWtkR05sSnJXbFpXY ldoeVZrZDRWMDVzV2xsYVIwWlhWakpvVkZaVldrWlBWa0pTVUZRd1BRPT0=.txt'implode("\r\n"$coupons));
    }
    else if((
    $key array_search($myCoupon$coupons)) == false) {
    $hasdiscount false;
    }

    $number $Total;
    $pur_item_total $number;
    $pur_po_total = ($pur_po_total $pur_item_total);
    $print_pur_po_total wims_currency($pur_po_total);

    $number2 $DiscountTotal;
    $pur_item_total2 $number2;
    $pur_po_total2 = ($pur_po_total2 $pur_item_total2);
    $print_pur_po_total2 wims_currency2($pur_po_total2);

    function 
    wims_currency($number) {
    if (
    $number 0) {
    $print_number "($" str_replace('-'''number_format ($number2"."",")) . ")";
    } else {
    $print_number "$" number_format ($number2"."",") ;
    }
    return 
    $print_number;
    }

    function 
    wims_currency2($number2) {
    if (
    $number2 0) {
    $print_number2 "($" str_replace('-'''number_format ($number22"."",")) . ")";
    } else {
    $print_number2 "$" number_format ($number22"."",") ;
    }
    return 
    $print_number2;
    }

    echo 
    "Has discount: ".$hasdiscount."<br>\n"
    ."$"."print_pur_po_total=".$print_pur_po_total."<br>\n"
    ."$"."print_pur_po_total2=".$print_pur_po_total2."<br>\n";

    ?>
    Last edited by Fou-Lu; 01-19-2010 at 03:28 AM.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Where is $qtycd being defined?
    In taxheader.php, the lack of $qtycd will adversely effect the entire script:
    PHP Code:
    $Total = (($Tax $Subtotal)*$qtycd)+($shipping*$qtycd); // Total = 0
    $DiscountTotal $Total*$discountrate// DiscountTotal = 0

    //... cascades to:
    $number $Total// 0
    $pur_item_total $number// 0
    $pur_po_total =  ($pur_po_total $pur_item_total); // 0
    $print_pur_po_total wims_currency($pur_po_total); // 0
     
    $number2 $DiscountTotal// 0
    $pur_item_total2 $number2// 0
    $pur_po_total2 =  ($pur_po_total2 $pur_item_total2); // 0
    $print_pur_po_total2 wims_currency2($pur_po_total2);  // 0 
    So, with the lack of $qtycd, all these numbers will stack to 0, unless you've defined it elsewhere.
    Also, why do you have two identical functions with different names (wims_currency and wims_currency2)? You can simplify by looking into the money_format function. At the very least, reuse you're functions instead of redefining a new one that has the exact same body.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #7
    Regular Coder
    Join Date
    Apr 2009
    Posts
    264
    Thanks
    24
    Thanked 1 Time in 1 Post
    I know. Funny thing is, I JUST realized that. Thanks anyway mate, but I fixed it, and was getting ready to edit it :P

    Also, wims_currency does all the comma seperation for me, cuz I noticed a few glitches in money_format() after I reached the thousands numbers :P

    Case: Closed! Problem has been solved! =D
    Last edited by Fou-Lu; 01-19-2010 at 03:37 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
    •