Jump to content

$$ REWARD $$ Earn $$ to figure this one out!


socommaster

Recommended Posts

I have a brand new website with an online store.  It is up and running with one big problem... when somebody checks out, my administration page isnt recognizing the order.  it just says, "No new orders!" the payment goes through to paypal, but i have no idea as to what they ordered.  can anyone help?  If you can fix it, I will send you $10 through paypal.  It shows the orders in the mysql but they arent showing on the admin page.  Im so confused and need some assistance.

 

I dont know if this is where the error is, but Here is what the php is for my order page is:

 

 

<?
require_once("../conn.php");
require_once("access.php");

//get the orders
$q1 = "select *, from_unixtime(OrderDate, '%b/%d/%Y') as MyDate from devbg_orders where OrderStatus = 'paid' order by OrderDate desc";
$r1 = mysql_query($q1) or die(mysql_error());
$orders = mysql_num_rows($r1);

if($orders == '0') //we do not have any new orders
{
   echo "

<center>No new orders!</center>";
}
else
{
   ?>
      


      <table align=center width=500 cellspacing=0 cellpadding=0>
      <tr style="background-color:black; font-family:verdana; font-size:11; color:white; font-weight:bold">
         <td width=40 align=center>ID</td>
         <td width=280>Client Names</td>
         <td width=80 align=center>Date</td>
         <td width=100 align=right>Order Total</td>
      </tr>      

   <?
      $col = "#FFFFFF";
      //list the orders
      while($a1 = mysql_fetch_array($r1))
      {
         if($col == "#FFFFFF")
         {
            $col = "#DDDDDD";
         }
         else
         {
            $col = "#FFFFFF";
         }

         echo "<tr bgcolor=$col>\n\t<td align=center>$a1[OrderID]</td>\n\t<td><a href=\"ViewOrder.php?OrderID=$a1[OrderID]\" class=Nav>$a1[billToFirstName] $a1[billToLastName][/url]</td>\n\t<td align=center>$a1[MyDate]</td>\n\t<td align=right>$$a1[OrderTotal]</td>\n</tr>";
      }

      echo "</table>\n\n

";
}

?>

Link to comment
Share on other sites

I can go into the database and retrieve the info:

OrderID 1

SubTotal  0

ShippingPrice 14.99

SalesTax  0

OrderTotal  45.99

ShipToFirstName Joe

ShipToLastName  Blow

ShipToAddress1 123 madeupstreet

ShipToAddress2 

ShipToCity Beverly Hills

ShipToCountry USA

ShipToState CA

ShipToPhone 213 555 1212

ShipToZIP 91210

BillToFirstName Joe

BillToLastName Blow

BillToAddress1 123 madupstreet

BillToAddress2 

BillToCity Beverly Hills

BillToState CA

BillToCountry USA

BillToZIP 90210

BillToPhone 213 555 1212

ClientEmail non@nmljsdkdjlfkjalkj.com

CC_type 

CC_number 0

CC_sec 0

ExpMonth 0

ExpYear 0

OrderStatus 

OrderDate  1161529979

 

I noticed the order status isnt saying paid and the order date looks funky.  Problem there?

     

 

Link to comment
Share on other sites

Try this please.

 

if u get help and it works donate to the forum ok.

<?php
require_once("../conn.php");

require_once("access.php");


//get the orders

$q1 = "select *, from_unixtime(OrderDate, '%b/%d/%Y') as MyDate from devbg_orders where OrderStatus = 'paid' order by OrderDate desc";
$r1 = mysql_query($q1) or die("mysql_error()");

while($x=mysql_fetch_assoc($r1)){

if($x['orders']=="0") //we do not have any new orders
{
  echo "<center>No new orders!</center>";
}
else
{
  ?>
     <table align=center width=500 cellspacing=0 cellpadding=0>
     <tr style="background-color:black; font-family:verdana; font-size:11; color:white; font-weight:bold">
        <td width=40 align=center>ID</td>
        <td width=280>Client Names</td>
        <td width=80 align=center>Date</td>
        <td width=100 align=right>Order Total</td>
     </tr>      

  <?php
     $col = "#FFFFFF";
     //list the orders
     while($a1 = mysql_fetch_assoc($r1))
     {
        if($col == "#FFFFFF")
        {
           $col = "#DDDDDD";
        }
        else
        {
           $col = "#FFFFFF";
        }

        echo "<tr bgcolor=$col>\n\t<td align=center>$a1[OrderID]</td>\n\t<td><a href=\"ViewOrder.php?OrderID=$a1[OrderID]\" class=Nav>$a1[billToFirstName] $a1[billToLastName][/url]</td>\n\t<td align=center>$a1[MyDate]</td>\n\t<td align=right>$$a1[OrderTotal]</td>\n</tr>";
     }
echo "</table>\n\n";
}
}
?>

Link to comment
Share on other sites

lol remind me not to shop at this guys store..

 

BillToFirstName Joe

BillToLastName Blow

BillToAddress1 123 madupstreet

BillToAddress2

BillToCity Beverly Hills

BillToState CA

BillToCountry USA

BillToZIP 90210

BillToPhone 213 555 1212

 

Want to give me access to your DB when done? :)

Link to comment
Share on other sites

It's a simple problem ...

 

You have:

<?php

if($orders == '0')

?>

 

You shouldn't be testing against the character '0' -- you need to test against the number 0. '0' is always true in the context you provide.

 

Try:

 
‹?php

if($orders == 0) 

?> 

Link to comment
Share on other sites

Still no luck.  There are 8 orders in the system, but the administration page is still showing 0 open orders. And the adminstration page pulls up the orders.php

 

Any other suggestions?

 

Which version of the script are you using?  The original or redarrow's?  My proposed fix is intended for the original.

Link to comment
Share on other sites

I figured it out, the order status wasnt saying paid so the it wasnt being recognized on the orders.php screen.  By manually putting paid next to the orders in the mysql the orders would appear on the admin page.  Thanks for everybodys help on this.

 

Now does anyone know how to make it so "paid" shows up next to the order status without me having to go in to it manually and change it?

Link to comment
Share on other sites

here a quick example u need to test via sandbox what is paypal

mirroried brother for ipn testing ok.

 

//create a mysql database for the ipn reponse.


CREATE TABLE paypal_table (
  id int(11) NOT NULL auto_increment,
  payer_id varchar(60) default NULL,
  payment_date varchar(50) default NULL,
  txn_id varchar(50) default NULL,
  first_name varchar(50) default NULL,
  last_name varchar(50) default NULL,
  payer_email varchar(75) default NULL,
  payer_status varchar(50) default NULL,
  payment_type varchar(50) default NULL,
  memo tinytext,
  item_name varchar(127) default NULL,
  item_number varchar(127) default NULL,
  quantity int(11) NOT NULL default '0',
  mc_gross decimal(9,2) default NULL,
  mc_currency char(3) default NULL,
  address_name varchar(255) NOT NULL default '',
  address_street varchar(255) NOT NULL default '',
  address_city varchar(255) NOT NULL default '',
  address_state varchar(255) NOT NULL default '',
  address_zip varchar(255) NOT NULL default '',
  address_country varchar(255) NOT NULL default '',
  address_status varchar(255) NOT NULL default '',
  payer_business_name varchar(255) NOT NULL default '',
  payment_status varchar(255) NOT NULL default '',
  pending_reason varchar(255) NOT NULL default '',
  reason_code varchar(255) NOT NULL default '',
  txn_type varchar(255) NOT NULL default '',
  PRIMARY KEY  (id),
  UNIQUE KEY txn_id (txn_id),
  KEY txn_id_2 (txn_id)
) TYPE=MyISAM;


// use this for the insert of the above mysql table.


$qry="INSERT INTO paypal_table VALUES (0 , '$payer_id', '$payment_date', '$txn_id', '$first_name', '$last_name', '$payer_email', '$payer_status', '$payment_type', '$memo', '$item_name', '$item_number', $quantity, $mc_gross, '$mc_currency', '$address_name', '".nl2br($address_street)."', '$address_city', '$address_state', '$address_zip', '$address_country', '$address_status', '$payer_business_name', '$payment_status', '$pending_reason', '$reason_code', '$txn_type')";

$result=mysql_query($qry);




//make a form to get payments.

// sandbox is for testing and paypal is for live transaction.

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="admin@hotmail.com">
<input type="hidden" name="item_name" value='<? echo"Freelance Programming Advert From $added_date to $exspire_date"?>'>
<input type="hidden" name="item_number" value='<?php echo $record['id'] ?>'>
<input type="hidden" name="amount" value='<?php echo $price ?>'>
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="return" value="http://xxxxxxxxxxxxx/test.php">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cancel_return" value=" ">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>



//php working ipn code

<?php session_start();

$db=mysql_connect("localhost","xxx","xxxx");
mysql_select_db("xxxxx",$db)or die("mysql problam");

// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}

// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30);




// assign posted variables to local variables

$item_name = $_POST['item_name'];
$item_number =$_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email= $_POST['receiver_email'];
$payer_email= $_POST['payer_email'];



$query=" select * from payment where id='$id' order by added_date limit 1";

$result=mysql_query($query);

while($record=mysql_fetch_assoc($result)){


$item_name="advert";
$item_number=$record['id'];
$payment_amount=$price;
$payment_currency="GBP";
$receiver_email="admin@hotman.com";
$payer_email="admin@hotmail.com";

}


if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {


$qry="INSERT INTO paypal_table VALUES (0 , '$payer_id', '$payment_date', '$txn_id', '$first_name', '$last_name', '$payer_email', '$payer_status', '$payment_type', '$memo', '$item_name', '$item_number', $quantity, $mc_gross, '$mc_currency', '$address_name', '".nl2br($address_street)."', '$address_city', '$address_state', '$address_zip', '$address_country', '$address_status', '$payer_business_name', '$payment_status', '$pending_reason', '$reason_code', '$txn_type')";

$result=mysql_query($qry);

echo 'payment tacken';
}
else if (strcmp ($res, "INVALID") == 0) {

echo 'no payment sorry';
}
}
fclose ($fp);
}

?>

//////////// end//////////////

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.