Joined: Jan 17, 2009 Posts: 268 Location: Missouri
Posted:
Tue Feb 10, 2009 3:56 pm
Dont be I need to be simpler with my posts.
Code:
$link = mysql_connect($dbhost,$dbuname, $dbpass) OR DIE ("Unable To Connect To Database");
mysql_select_db($dbname, $link) OR DIE("Unable To Select To Database");
$sql = "SELECT pid,name, pnum, a1, listp, specialprice,numberstock,stock FROM CCart_products ORDER BY name LIMIT $offset,$searchrows";
$result = $db->sql_query($sql);
mysql_close($link);
mysql_connect
mysql_select_db
mysql_close
What should those be?
Those are found in root/ipn.php, admin/modules/ccart/orders.php, and admin/modules/ccart/inventory.php
Joined: Jan 17, 2009 Posts: 268 Location: Missouri
Posted:
Tue Feb 10, 2009 7:03 pm
Im not sure what you mean, Ive tried comparing it to other files but than again I dont have that much experience at this. I tried just leaving sql and result but that doesnt make a difference.
Joined: Jan 17, 2009 Posts: 268 Location: Missouri
Posted:
Tue Feb 10, 2009 8:44 pm
Just to use it, I was using oscommerce before but got tired of its complexity. It seems alot simpler, plus it seems well thought out. On top of that this has been a great learning experience, Ive tried a couple other coversions in the past and never had one this succesful, your code was nicely wrote from the get go.
I tried what you gave and it worked with inventory.php but not orders.php and Im not sure but I dont think Ill know about ipn until I test?
Another note make sure you include global $db with inventory.php and ipn.php. I rewrote the ipn about 3-4 years ago with more detail but in all honestly I can't remember where I put it :>)
Joined: Jan 17, 2009 Posts: 268 Location: Missouri
Posted:
Wed Feb 11, 2009 10:56 am
This one Im getting no where fast with, when you go to orders it just echos the "Delete IPN/Order" box, not sure why but Im sure theres not supposed to be 2. I tried global before and after OpenTable just to check, Anyways heres the old code:
Code:
echo "<br>";
OpenTable();
echo "<center>";
echo "<form action=\"delete\" method=\"post\"><select name=\"choice\" size=\"1\">";
$sql = sql_query("select * from CCart_ipn_orders ORDER BY ipn_id ");
while(list($ipn_id, $txn_id) = sql_fetch_row($sql)) {
if ($ipn_id == $txn_id){
$sel = "selected ";
}
$delete = "admin.php?op=delete_orders&id=$ipn_id&delete=true";
echo "<option $sel value=\"$delete\">$ipn_id==>$txn_id</option>";
$sel = "";
}
echo "</select>";
echo "<input TYPE=\"button\" VALUE=\"Delete IPN/Order!\" onClick=\"jump(this.form)\"></form>";
echo "</center>";
CloseTable();
echo "<br>";
OpenTable();
search_display($offset,$numresults);
CloseTable();
echo "<br>";
OpenTable();
$link = mysql_connect($dbhost,$dbuname, $dbpass) OR DIE ("Unable To Connect To Database");
mysql_select_db($dbname, $link) OR DIE("Unable To Select To Database");
$sql = "SELECT * FROM CCart_ipn_orders ORDER BY ipn_id DESC LIMIT $offset,$searchrows ";
$result = mysql_query($sql);
mysql_close($link);
print "<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=2>";
$even = 0;
while ($row = mysql_fetch_array($result)) {
($even % 2) == 0 ? $bgcolor = "#eeeeee" : $bgcolor = "#FFFFFF";
$even = $even + 1;
print "<TR BGCOLOR=$bgcolor>
And the new, Im thinking something to do with the empty select option, line 12?
You won't see any orders in the IPN until you get orders from Paypal. There's 2 boxes there and when page fills up you will have one on the top and one on bottom.
Joined: Jan 17, 2009 Posts: 268 Location: Missouri
Posted:
Wed Feb 11, 2009 11:26 am
Oh...than its working lol...thank you.
What about ipn in root, if you go to the url you get an error, the same error about rnconfig, so I added the require mainfile and it returns another error. With the others in root I added the require/include mainfile and it loads the module page.
Joined: Jan 17, 2009 Posts: 268 Location: Missouri
Posted:
Wed Feb 11, 2009 1:04 pm
Alright, it works but it doesnt seemto be sending the ipn data back to the site, nothing shows up on the orders page and it doesnt update the quantity/stock, it never shows the customer message either so I dont know.
Im starting a new project right now though, but it does work Ill just have a message stating that all payments have to undergo 24 hour verification. Oh this is the new ipn you had in the scripts.zip btw, I changed the old dbi in there and changed the email addys but that didnt help.
You did enter the ipn address in your Paypal account right? Unfortunately CCart doesn't update stock. This was a feature that was planned, but never came about. So I did put the new ipn in the zip file.. cool!
Joined: Jan 17, 2009 Posts: 268 Location: Missouri
Posted:
Wed Feb 11, 2009 9:32 pm
Sorry, yeah I entered it in paypal. Hope you finish that stock feature someday, for now its okay though. About the return address I was wondering that myself, it lets you set a return address but it sends some weird stuff back with you in the url, and Id have to test it again to get that.
Code:
<?php
///////////////////////////////////////
//CCart Pro 2.1b IPN updated version 2
//Licenced Under GPL 2003/////////////
//www.theguitarfiles.com/CC/CallowaysCart
//www.theguitarfiles.com//////////////
///////////////////////////////////////
include "config.php";
////////////////////////////////////////////
///////EDIT the 2 email address below////////
$from_email="hcrc@horror-code.com"; //<-------------Enter your email address here
$reply_email="sales@horror-code.com";//<-------------Enter your reply email address here
////////////////////////////////////////////
///////END EDIT////////
// 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.paypal.com', 80, $errno, $errstr, 30);
$ipn_id = $_POST['ipn_id'];
$txn_id = $_POST['txn_id'];
$item_name1 = $_POST['item_name1'];
$item_name2 = $_POST['item_name2'];
$item_name3 = $_POST['item_name3'];
$item_name4 = $_POST['item_name4'];
$item_name5 = $_POST['item_name5'];
$receiver_email = $_POST['receiver_email'];
$item_number1 = $_POST['item_number1'];
$item_number2 = $_POST['item_number2'];
$item_number3 = $_POST['item_number3'];
$item_number4 = $_POST['item_number4'];
$item_number5 = $_POST['item_number5'];
$payment_status = $_POST['payment_status'];
$payment_type = $_POST['payment_type'];
$payment_gross = $_POST['payment_gross'];
$payment_fee = $_POST['payment_fee'];
$tax = $_POST['tax'];
$pending_reason = $_POST['pending_reason'];
$payer_email = $_POST['payer_email'];
$payer_id = $_POST['payer_id'];
$num_cart_items = $_POST['num_cart_items'];
$quantity1 = $_POST['quantity1'];
$quantity2 = $_POST['quantity2'];
$quantity3 = $_POST['quantity3'];
$quantity4 = $_POST['quantity4'];
$quantity5 = $_POST['quantity5'];
$payment_date = $_POST['payment_date'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$address_street = $_POST['address_street'];
$address_city = $_POST['address_city'];
$address_state = $_POST['address_state'];
$address_zip = $_POST['address_zip'];
$address_country = $_POST['address_country'];
$address_status = $_POST['address_status'];
$verify_sign = $_POST['verify_sign'];
$option_name1 = $_POST['option_name1'];
$option_selection1 = $_POST['option_selection1'];
$option_name2 = $_POST['option_name2'];
$option_selection2 = $_POST['option_selection2'];
$memo = $_POST['memo'];
$custom = $_POST['custom'];
$invoice = $_POST['invoice'];
$txn_type = $_POST['txn_type'];
$subscr_id = $_POST['subscr_id'];
$subscr_date = $_POST['subscr_date'];
$subscr_effective = $_POST['subscr_effective'];
$period1 = $_POST['period1'];
$period2 = $_POST['period2'];
$period3 = $_POST['period3'];
$amount1 = $_POST['amount1'];
$amount2 = $_POST['amount2'];
$amount3 = $_POST['amount3'];
$mc_amount1 = $_POST['mc_amount1'];
$mc_amount2 = $_POST['mc_amount2'];
$mc_amount3 = $_POST['mc_amount3'];
$mc_currency = $_POST['mc_currency'];
$mc_gross = $_POST['mc_gross'];
$recurring = $_POST['recurring'];
$recur_times = $_POST['recur_times'];
$password = $_POST['password'];
$username = $_POST['username'];
if (!$fp) {
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
$mailbody.="NOTE:This is an automated customer receipt: Please do not reply\n\n";
$mailbody.="=======================================================\n\n";
$mailbody.="Dear $first_name $last_name,\n";
$mailbody.="Thank you for your recent order with us!\n\n";
$mailbody.="Your order will has be processed \n\n";
$mailbody.="If you have any questions, please contact us: $from_email\n\n";
$mailbody.="Customer ID#: $payer_id \n\n";
$mailbody.="Invoice#: $txn_id\n\nDate/Time Of Order:$payment_date\n\nOrder Details:\n\n";
$mailbody.="=======================================================\n\n";
$mailbody.="Product Description: ($item_name1) \n";
$mailbody.="Item #: ($item_number1) \n";
$mailbody.="Quantity: ($quantity1)\n\n";
if ($item_name2==""){
}else{
$mailbody.="Product Description (2): ($item_name2)\n";
$mailbody.="Item #: ($item_number2) \n";
$mailbody.="Quantity: ($quantity2)\n\n";
}
if ($item_name3==""){
}else{
$mailbody.="Product Description (3):($item_name3) \n";
$mailbody.="Item #: ($item_number3) \n";
$mailbody.="Quantity: ($quantity3)\n\n";
}
if ($item_name4==""){
}else{
$mailbody.="Product Description (4):($item_name4) \n";
$mailbody.="Item #: ($item_number4) \n";
$mailbody.="Quantity: ($quantity4)\n\n ";
}
if ($item_name5==""){
}else{
$mailbody.="Product Description (5):($item_name5) \n";
$mailbody.="Item #: ($item_number5) \n";
$mailbody.="Quantity: ($quantity5)\n\n";
}
$mailbody.="=======================================================\n\n";
$mailbody.="Total Products to be shipped:($num_cart_items)\n\n";
$mailbody.="Total Gross Payment=$$payment_gross \n\n";
$mailbody.="Sales Tax=$$tax\n\n";
$mailbody.="=======================================================\n\n";
$mailbody.="Shipping To Address: \n\n $address_street\n $address_city \n $address_state $address_zip\n $address_country \n\n";
$mailbody.="Your Address is : $address_status by Paypal\n\n";
$mailbody.="=======================================================\n\n";
$mailbody.=" Verify ID: $verify_sign\n\n $first_name - Please print this email for your personal records\n\n Thanks again for shopping with us!\n\n";
mail($payer_email, "Thanks for your order", $mailbody, "From: $from_email\nReply-To: $reply_email");
If your referring to the return address of the the customer Paypal sends the address info to the ipn which is then stored in CCart orders table. Or if your referring to his Paypal details? If so he would need to edit he Paypal email etc.. in admin under main settings.
Joined: Jan 17, 2009 Posts: 268 Location: Missouri
Posted:
Thu Feb 12, 2009 12:59 am
Already did that and no dice^^ The address I wonder about is the one paypal uses to return you to the site, yes thats set in admin but it has a funny string behind it when you click return in paypal, I have to replicate it unless you can remember where or what that is? Maybe the ipn api changed too much, are there others still using ccart??
Joined: Mar 30, 2006 Posts: 2408 Location: Pennsylvania
Posted:
Thu Feb 12, 2009 3:06 pm
I was refering to the fact that in the form you can send
Only registered users can see links on this board! Get registered or login to the forums!
instead of setting it in your paypal preferences.
I'm not 100% certain on this. That is just my limited understanding. The reason for this is that if you have multiple sites then setting it in your preferences would not work.
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum